LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   OpenCV - Pixel format of incoming image is unsupported by OpenCV (http://www.linuxquestions.org/questions/programming-9/opencv-pixel-format-of-incoming-image-is-unsupported-by-opencv-842801/)

golmschenk 11-06-2010 09:21 PM

OpenCV - Pixel format of incoming image is unsupported by OpenCV
 
Hi, I'm using a logitech quickcam pro 3000 on Ubuntu 10.04. When I run a simple program with OpenCV to display the output from a camera I get the following output:
Code:

HIGHGUI ERROR: V4L2: Pixel format of incoming image is unsupported by OpenCV
Unable to stop the stream.: Bad file descriptor

A window still opens with the output from the camera, but it seems very low quality and has far less pixels then it should. The camera built into my computer runs the same program with no problems. My code for the program is simply:
Code:

#include "highgui.h"

int main(int argc, char** argv){
        cvNamedWindow("Camera", CV_WINDOW_AUTOSIZE);
        CvCapture* capture = cvCreateCameraCapture(1);
        IplImage* frame;
        while(1){
                frame = cvQueryFrame(capture);
                if(!frame)break;
                cvShowImage("Camera", frame);
                char c = cvWaitKey(33);
                if(c == 27) break;
        }
        cvReleaseCapture(&capture);
        cvDestroyWindow("Camera");
}

One further note to make is that I still have the bad quality and low number of pixels with the logitech even when using webcam program. I can seem to find any drivers to update or anything though. Any suggestions on what to do? Thanks.

lqman 04-01-2011 01:32 PM

I was get an error same like U, then I try dan_s's suggestion at http://blog.damiles.com/?p=61.

Quote:

Make sure that you have video for linux control panel installed (v4l2ucp) and also ensure that you have the v4l2convert.so in /usr/lib/libv4l/ (it should all be part of the video for linux package I think?

root@localhost~# aptitude install v4l2ucp

then run v4l2ucp, go to preview->configure preview in the video for linux control panel (v4l2ucp) application it should have as the enviroment and application to launch for the view, eg. mplayer or whatever you set it to.

LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so as the environment variable
and tv:// as the argument

the key here is setting v4l2convert.so as a preloader to the viewer, which i think converts the device stream from the camera to a format suitable for v4l2 devices. If you do this before running your opencv application it should fix the problem.

just cd to the directory of your application and type

LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so ./youropencvapp

or you can add it as an environment variable in your launch configuration if you are working with an IDE such as eclipse

Hope this helps someone!
And it works properly for me.


All times are GMT -5. The time now is 12:16 PM.