Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Passing Mat object to function

Hi All,

I have this very simple question that I can get figure it out.

Say I have function

void f(Mat m) { m.at<uchar>(3,3) = 17;}

when I call this function I see that the original Mat object is changed!! as far as I know object passing by value to function in c++ get copied so why when I pass Mat object the original matrix in being changed and not the copied one? Thank u in advance

click to hide/show revision 2
retagged

Passing Mat object to function

Hi All,

I have this very simple question that I can get figure it out.

Say I have function

void f(Mat m) { m.at<uchar>(3,3) = 17;}

when I call this function I see that the original Mat object is changed!! as far as I know object passing by value to function in c++ get copied so why when I pass Mat object the original matrix in being changed and not the copied one? Thank u in advance