[solved][beaglebone] OpenCV hangs on cvQueryFrame

Problems with packages? Post here, using [tags] of the package name.

[solved][beaglebone] OpenCV hangs on cvQueryFrame

Postby mszubart » Wed Aug 29, 2012 7:14 am

Hello,
I have installed OpenCV package from alarm's repository.
Packege version is 2.4.2-2

First things first. My camera is working on beagle. I have tested it with 'motion'.
Following piece of code works perfectly on PC.

$this->bbcode_second_pass_code('', ' #include "highgui.h"
#include <stdio.h>

int main() {
CvCapture* capture = cvCaptureFromCAM( CV_CAP_ANY );

fprintf(stdout, "1\n");

if ( !capture ) {
fprintf( stderr, "ERROR: capture is NULL \n" );
return -1;
}

fprintf(stdout, "2\n");

IplImage* frame = cvQueryFrame( capture );
if ( !frame ) {
fprintf( stderr, "ERROR: frame is null...\n" );
}

fprintf(stdout, "3\n");

cvSaveImage("cap.jpg", frame, 0);

fprintf(stdout, "4\n");

cvReleaseCapture( &capture );

fprintf(stdout, "5\n");
return 0;
}')

Output on beagle:
$this->bbcode_second_pass_code('', '$ ./capture_frame
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
VIDIOC_QUERYMENU: Invalid argument
1
2
')

cvQueryFrame freezes, which is a bit strange.
'VIDIOC_QUERYMENU: Invalid argument' also shows up on PC, so I think it's not so big deal.

Ubuntu guys also had this problem http://ubuntuforums.org/showthread.php? ... st12113852
I've tried to rebuild OpenCV (from ABS) with and without unicap. I've tried to build unicap (from AUR, v0.9.12).
I've tried to build OpenCV from AUR (opencv-git), but it was installed incorrectly.
I failed on any attempt.

This is rather question for ALARMS's developers.
How do you build OpenCV for ARM? I mean, Which options do you use?

Thanks in advance.
Last edited by mszubart on Fri Sep 07, 2012 6:33 am, edited 1 time in total.
mszubart
 
Posts: 8
Joined: Sat Aug 25, 2012 12:50 pm

Re: [beaglebone] OpenCV hangs on cvQueryFrame

Postby ykmag » Sun Sep 02, 2012 9:13 pm

I use the c++ interface, works for me with stock openCV
$this->bbcode_second_pass_code('', ' cv::VideoCapture capture(0);
if(!capture.isOpened()) return;

cv::Mat mImage;
while(1)
{
capture >> mImage;
}')
ykmag
 
Posts: 61
Joined: Wed Aug 18, 2010 1:28 pm

Re: [beaglebone] OpenCV hangs on cvQueryFrame

Postby mszubart » Tue Sep 04, 2012 6:45 am

@ykmag:
Thank you for your reply.
Unfortunately your code also freezes.
Following code too.
$this->bbcode_second_pass_code('', 'capture.read(mImage);')

Are you using BeagleBone?
mszubart
 
Posts: 8
Joined: Sat Aug 25, 2012 12:50 pm

Re: [beaglebone] OpenCV hangs on cvQueryFrame

Postby ykmag » Wed Sep 05, 2012 7:39 pm

Works on BeagleBone, PandaBoard and BeagleBord Xm, all tested with UVC camera. Have you tested with a different camera?
The ones I have tested is Logitech and Creative cameras.
ykmag
 
Posts: 61
Joined: Wed Aug 18, 2010 1:28 pm

Re: [beaglebone] OpenCV hangs on cvQueryFrame

Postby mszubart » Fri Sep 07, 2012 6:33 am

I found solution.

(C++ version)
$this->bbcode_second_pass_code('', 'capture.set(CV_CAP_PROP_FRAME_WIDTH, 352);
capture.set(CV_CAP_PROP_FRAME_HEIGHT, 288);')
It's a bit strange as I didn't need to configure capture devices on other platforms.
It's also bit strange because I didn't manage to set other resolutions like 640x480 or 1024x768.
But it works, captures image and allows to process it. Fair enough.

Thanks for any help.
mszubart
 
Posts: 8
Joined: Sat Aug 25, 2012 12:50 pm


Return to Packages

Who is online

Users browsing this forum: No registered users and 2 guests