Updated by Andrey Kamaev almost 13 years ago
I build opencv WITH_PVAPI flag and install it on my Linux Xubuntu 11.10 (x86_64) with 3.0.0-17-generic linux kernel.
My camera is Manta G-032, I tried put it to work with opencv using the below example program:
<pre><code class="cpp"> <pre>
#include <stdio.h>
#include <opencv/highgui.h>
int main( int argc, char** argv )
{
cvNamedWindow("Example", CV_WINDOW_AUTOSIZE);
CvCapture* capture = cvCreateCameraCapture(CV_CAP_PVAPI);
assert(capture != NULL);
IplImage* frame;
while(1)
{
frame = cvQueryFrame(capture);
if(!frame) break;
cvShowImage("Example", frame);
char c = cvWaitKey(13);
if(c == 27) break;
}
cvReleaseCapture(&capture);
cvDestroyWindow("Example");
return 0;
}
</code></pre> </pre>
The result of this program is a segfault. After of navigate on google and analyse the codes cap_pvapi.cpp from opencv and StreamAndGrab.cpp from AVT GigE SDK code I can solve the problem.
On PvAPI of opencv is missing a 'memset' of structure tCamera as StreamAndGrab.cpp code.
I put the follow line: @memset(&capture->Camera, 0, sizeof(tCamera));@ just after of object CvCaptureCAM_PvAPI creation.
My camera is Manta G-032, I tried put it to work with opencv using the below example program:
<pre><code class="cpp"> <pre>
#include <stdio.h>
#include <opencv/highgui.h>
int main( int argc, char** argv )
{
cvNamedWindow("Example", CV_WINDOW_AUTOSIZE);
CvCapture* capture = cvCreateCameraCapture(CV_CAP_PVAPI);
assert(capture != NULL);
IplImage* frame;
while(1)
{
frame = cvQueryFrame(capture);
if(!frame) break;
cvShowImage("Example", frame);
char c = cvWaitKey(13);
if(c == 27) break;
}
cvReleaseCapture(&capture);
cvDestroyWindow("Example");
return 0;
}
</code></pre> </pre>
The result of this program is a segfault. After of navigate on google and analyse the codes cap_pvapi.cpp from opencv and StreamAndGrab.cpp from AVT GigE SDK code I can solve the problem.
On PvAPI of opencv is missing a 'memset' of structure tCamera as StreamAndGrab.cpp code.
I put the follow line: @memset(&capture->Camera, 0, sizeof(tCamera));@ just after of object CvCaptureCAM_PvAPI creation.