Software Archive
Read-only legacy content
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
17060 Discussions

Saving/loading depth stream frames

Thomas_5207
New Contributor I
506 Views

Hey.

So I plan to process depth frames using OpenCV offline. I want to save a particular depth stream frame as an image openCV can interpret. This is later to be processed in OpenCV and converted into a PXCImage again for constructing point clouds. 

I have functions to convert my PXCImage to CV_16U image mats (and back again). The conversion back to PXCImage works if I do it on the fly so I know these work. Also the saved image looks similar to my depth stream. However, if I first save to disk then try and load that image later on I get weird results. 

I am saving my image in PGM format (said to be uncompressed) using

cv::imwrite("output.pgm", outputMat);

I load my image back using

cv::imread("output.pgm", -1);

But when I convert back to PXCImage and try to show, I just get a bunch of diagonal lines. Is the type somehow getting messed up here?

Any help much appreciated!

0 Kudos
1 Reply
Thomas_5207
New Contributor I
506 Views

Sorry I was able to get things to work. I use imread with the flag CV_LOAD_IMAGE_ANYDEPTH. Things are all good :).

0 Kudos
Reply