Ask Your Question
2

OpenCV VideoCapture Not Working in Diamondback?

asked 2011-06-05 02:21:12 -0500

dkst gravatar image

Hi all, I recently updated my diamondback version to the latest version and I realised that my packages that I had written previously that used OpenCV's VideoCapture (webcam) fail to work. That is the code:

cv::VideoCapture capture;

capture.open(0);

always returns FALSE. When I compile the latest OpenCV 2.2 library outside the ROS framework and run it, my web cam is always initialised properly so I know its not a problem with OpenCV. My webcam works fine with Cheese as well so it's not at fault too. I am running Ubuntu 10.04 LTS with a full clean install of ROS Diamondback with the required vision-opencv stacks.

Has anyone else had the same experience? Or does anyone have any advice for me to take?

Thanks.

edit retag flag offensive close merge delete

Comments

Do you have an isolated test case that runs properly when linked against your manually compiled OpenCV libraries works, and does not work if linked against the pre-built OpenCV libraries in Diamondback? That would be pretty strange. Did you check out OpenCV 2.2 from branches/2.2 in revision 5206?
Julius gravatar image Julius  ( 2011-06-07 14:24:37 -0500 )edit
Hi, dkst, have u solved this problem yet? I go through this problem, and have no idea about it. I reinstall my ROS, but it also doesn't work.
Yongqiang Gao gravatar image Yongqiang Gao  ( 2011-06-11 00:03:48 -0500 )edit

3 Answers

Sort by ยป oldest newest most voted
2

answered 2011-06-20 05:49:32 -0500

James Bowman gravatar image

Hi all, the ROS opencv packge (opencv2) does not build the video interface options - we took this decision early because of the fragility of the OpenCV video capture and I/O code.

In use this tends not to be a problem because we usually source images via ROS, and use cv_bridge to import images (or sequences of images for video) into OpenCV.

edit flag offensive delete link more

Comments

Brian Gerkey gravatar image Brian Gerkey  ( 2011-06-20 06:48:38 -0500 )edit
1

answered 2011-06-08 15:04:15 -0500

Yongqiang Gao gravatar image

That problem falls to me unluckily, after i arrange my older openCV libraries for trying to solve the problem that it can't open local video file.

I think it disorder the connections between vision_opencv. I haven't any constructively suggestion, except to re-install diamondback.

Anyone has some better advice?

edit flag offensive delete link more

Comments

I would have surely used this Idea if the others didn't work.Thanks

Leyonce gravatar image Leyonce  ( 2014-03-30 22:38:02 -0500 )edit
1

answered 2011-06-12 06:21:02 -0500

nicktheanimal25 gravatar image

updated 2011-06-12 06:21:41 -0500

I was having the same problem trying to use create_webcam. It looks like there is just something wrong with whatever version of opencv gets installed through the ros repositories. My quick and dirty solution was to compile/install opencv from source, and then copy all of the libraries into the ros opencv/lib directory:

$ roscd opencv2/opencv

$ sudo mv lib/ lib.orig/

$ mkdir lib

$ cd lib

$ sudo cp <path to="" opencv="" binaries="">libopencv* ./

Hopefully ros will get this sorted out soon, but this fix is working for me at the moment.

edit flag offensive delete link more

Comments

I have just solved with this problem. For ROS originally doesn't support ffmpeg, we should turn on those flags at Makefile in "Opencv2" in "vision_opencv" , and then rebuild it. By the way, if ros in /opt/, it doesn't rebuild very well, so I copy "vision_opencv" into my "~/". Hope for helping u.
Yongqiang Gao gravatar image Yongqiang Gao  ( 2011-06-12 13:32:43 -0500 )edit

Cool pal.That's so cool.

Leyonce gravatar image Leyonce  ( 2014-03-30 22:35:26 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2011-06-05 02:21:12 -0500

Seen: 2,187 times

Last updated: Jun 20 '11