I have an bumblebee2 and I'm using the flycapture SDK to capture the incoming images. I then convert the left flycapture2 image to an openCV format so I can do some basic manipulations to it. Then I'd like to feed it back into the Flycapture SDK but I cant seem to figure out how. To convert from Flycapture to OpenCV I do the following:
FlyCapture2::Image cf2Img;
grabbedImage.Convert(FlyCapture2::PIXEL_FORMAT_BGR, &cf2Img );
unsigned int rowBytes = (double)cf2Img.GetReceivedDataSize()/(double)cf2Img.GetRows();
cv::Mat cvImage = cv::Mat( cf2Img.GetRows(), cf2Img.GetCols(), CV_8UC3, cf2Img.GetData(), rowBytes );
I then do my manipulations (thresholding/contour detections/background removal etc), I'd then like to feed this image back into Flycapture. My attempts at converting it back haven't worked.
Does anyone have any code they have used before to take an OpenCV format back to Flycapture?
I work for Point Grey and I'll try to help here. Please note though you can contact us directly via our support site at ptgrey.com/support/ and we can help you out as well.
Looking at the code you attached and looking at the openCV source, when you make the cvImage, you are just reassigning the pointer to the data, you are not making an actual copy of the data.
So as long as the size of the data stays the same (ie. you keep it at 24 bits per pixel), any changes you make to the openCV image should be reflected in the flycapture (cf2Img) data and be able to save properly.
If you can explain the problems you are having trying to move back to a flycapture image, or send us the source code of how you are doing that, we can help you further.
To summarize, I expect any manipulations you do to the cvImage after the code you have provided should just be reflected in cf2Img without the need to convert back, assuming you are not changing the bit depth of the image.
I hope that helps, but please let me know if I can help clarify anything or if you can provide an example of the failure to convert back to fc2.
Thank you, Point Grey Support