Ask Your Question
0

opencv and Pleora PvBuffer

asked 2018-03-08 16:58:27 -0600

Cucchi gravatar image

Hi I'm trying to use opencv to pull in a Pleora PvBuffer type. Has anyone had any experience converting these 2 types. Thank You

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2018-03-08 19:55:47 -0600

Tetragramm gravatar image

As it happens, yes. This is not really the kind of question this forum answers, but I happen to know.

Or, really, you could have googled it, because the first result has this code:

cv::Mat workImage;
PvImage* lImage = lBuffer->GetImage();
lImage->Alloc(lWidth, lHeight, PvPixelRGB8);
// Get image data pointer so we can pass it to CV::MAT container
unsigned char *img = lImage->GetDataPointer();
// Copy/convert Pleora Vision image pointer to cv::Mat container
cv::Mat lframe(lHeight, lWidth, CV_8UC3, img); 
lframe.copyTo(workImage);

I don't know about the call to Alloc, that may not be necessary depending on your use case. What this code does is copy the contents of the PvBuffer to the cv::Mat workImage.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-03-08 16:58:27 -0600

Seen: 1,188 times

Last updated: Mar 08 '18