Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How are cv::Mat objects treated by OpenCV?

Are cv::Mat objects treated as pointers?

My code basically loops through and reads images from a vector of cv::Mat, applies the getParvo fucntion of the Retina class and stores it in a temporary cv::Mat, and the pushes back this temporary cv::Mat to another vector of images.

I found some unusual behavior with the cv::Mat. If my temporary cv::Mat WAS NOT declared inside the loop, then only the parvo of last image of the original image vector was pushed to the new vector. I had to declare it inside the loop, so that it goes out of scope and is recreated at the next iteration. I was able to solve the problem but could not understand why it was happening. Is it because cv::Mat objects are treated as pointers? or is it some other reason?