Ask Your Question
0

Opencv Camera Interfacing

asked 2014-07-30 00:43:12 -0600

KDsonone gravatar image

Hello I am working on a project based on template matching. In my project I am using Rapberry Pi and Logitech C270 HD webcam. When I am trying to take picture from the camera using the sample program (from opencv build directory) I am getting error during compilation:

pi@raspberrypi ~/opencv-2.4.9/finalproject/templet_matching/camera $ ./starter_video 0
HIGHGUI ERROR: V4L/V4L2: VIDIOC_S_CROP
press space to save a picture. q or esc to quit
init done 
opengl support available 
Corrupt JPEG data: 1 extraneous bytes before marker 0xd2
Mat WIdth:640
Mat Height:480
Corrupt JPEG data: 1 extraneous bytes before marker 0xd0
Mat WIdth:640
Mat Height:480

please help me. Thank you

edit retag flag offensive close merge delete

Comments

Did you built OpenCV with the -WITH_JPEG=ON flag? It seems that it cannot read the supplied JPEG header information.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-07-30 06:14:56 -0600 )edit

I am not sure I have just followed the standard procedure of building opencv.

cmake -D CMAKE_BUILD_TYPE=RELEASE -D INSTALL_C_EXAMPLES=ON -D INSTALL_CPP_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D    BUILD_EXAMPLES=ON -D WITH_QT=ON -D CMAKE_INSTALL_PREFIX=/usr/local -D    WITH_OPENGL=ON -D WITH_V4L=ON ..
KDsonone gravatar imageKDsonone ( 2014-07-30 09:34:25 -0600 )edit

Can you add explicitly -D WITH_JPEG=ON -D WITH_JASPER=ON and see if the error still occurs after rebuilding?

StevenPuttemans gravatar imageStevenPuttemans ( 2014-07-31 02:06:18 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2016-04-10 11:31:49 -0600

Merl1n gravatar image

I have done some experiments and found that the issue in libjpeg. As quick solution you can recompile OpenCV with -D WITH_JPEG=OFF. It solved my issue with camera C270

The full my command you can find here

edit flag offensive delete link more

Comments

It seems to me that the issue is in Java which replaces libjpeg from linux and it causes issues.

Merl1n gravatar imageMerl1n ( 2016-12-15 04:24:45 -0600 )edit

Question Tools

Stats

Asked: 2014-07-30 00:43:12 -0600

Seen: 4,328 times

Last updated: Jul 30 '14