Ask Your Question

Revision history [back]

opencv imread, does it perform a deep copy?

Hi all,

I am new to OpenCV. I am using the following syntax in my code Mat image = imread(filename);

I wanted to understand how image is loaded into matrix and dug into source code of imread. Mat imread( const string& filename, int flags ) { Mat img; imread_( filename, flags, LOAD_MAT, &img ); return img; }

In this context, it seems that image from file is loaded into img, then to image.

Is the copy from img to image a shallow copy or deep copy? Any information in understanding details is greatly appreciated.

opencv imread, does it perform a deep copy?

Hi all,

I am new to OpenCV. I am using the following syntax in my code Mat image = imread(filename);

I wanted to understand how image is loaded into matrix and dug into source code of imread. Mat imread( const string& filename, int flags ) { Mat img; imread_( filename, flags, LOAD_MAT, &img ); return img; }

In this context, it seems that image from file is loaded into img, then to image.

Is the copy from img to image a shallow copy or deep copy? Any information in understanding details is greatly appreciated.