Conversion from cv::Mat to ofImage

Hi everybody,

I encountered a problem when converting from cv::Mat to ofImage. For my application I use a depthframe(grayscale image) converted to cv::Mat to perform certain pixel operations. After finishing the operations on the pixels, I convert the cv::Mat into ofImage using the toOf function. The initial conversion from depthframe to cv::Mat using toCV works correctly but when I convert from cv :: Mat to ofImage the image seems zoomed respect to the initial frame.
How can i solve this problem?

Thanks for your help

usually toCv creates a reference to the original image so you don’t really need to convert it back just update the texture in the original by calling update() on the ofImage

Sorry, i badly explained myself. I use a depthframe converted in cv::Mat as image reference to do operations inside 3 new cv::Mat that are declared using the same width and height as the initial frame. If pixel inside the original cv::Mat take certain value, I modify pixels inside one of the three new cv::Mat. After all the changes i have to convert the three new cv::Mat into ofImage but the output seems zoomed respect the output of the original cv::Mat.

The images on the bottom are zoomed respect the two above. Why the result is zoomed respect the original frame that is the first top image on the left? I did some pixel operations using pixel loop. The two image above are two cv::Mat converted into ofImage. @arturo

i don’t think this is related to toCv / toOf functions but to the process you are applying to the images. it looks like the image is stretched rather than zoomed in, perhaps you are initializing the auxiliary images with wrong sizes?