opencv and Pleora PvBuffer
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
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.
Asked: 2018-03-08 16:58:27 -0600
Seen: 1,142 times
Last updated: Mar 08 '18
Area of a single pixel object in OpenCV
build problems for android_binary_package - Eclipse Indigo, Ubuntu 12.04
OpenCV DescriptorMatcher matches
Can't compile .cu file when including opencv.hpp
Using OpenCV's stitching module, strange error when compositing images
compile error in opencv2/flann/lsh_table.h when compiling bgslibrary