-   Programming (
-   -   OpenCV - Pixel format of incoming image is unsupported by OpenCV (

golmschenk 11-06-2010 08: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:

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:

#include "highgui.h"

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

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 12:32 PM

I was get an error same like U, then I try dan_s's suggestion at


Make sure that you have video for linux control panel installed (v4l2ucp) and also ensure that you have the 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/ as the environment variable
and tv:// as the argument

the key here is setting 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/ ./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 05:56 PM.