LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 11-06-2010, 08:21 PM   #1
golmschenk
Member
 
Registered: Nov 2009
Posts: 144

Rep: Reputation: 15
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.
 
Old 04-01-2011, 12:32 PM   #2
lqman
LQ Newbie
 
Registered: Nov 2010
Location: Surabaya, Indonesia
Distribution: debian, ubuntu, FreeBSD, Solaris
Posts: 17

Rep: Reputation: 3
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
opencv+opensolaris? srinivasmiriyalu Linux - Software 2 02-13-2012 04:41 AM
Anyone know opencv practically? Guttorm Programming 0 08-31-2010 02:27 PM
OpenCV commands cp_almora09 Linux - Software 1 02-17-2009 03:51 AM
Help me for OpenCV application qinglau Linux - Software 0 03-09-2006 11:25 AM
OpenCV fistroman Programming 0 07-28-2003 09:43 AM


All times are GMT -5. The time now is 03:34 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration