Ask Your Question
0

pass cv::MAT as pointer to a function in C++

asked 2017-04-22 18:06:50 -0600

opencvddddd gravatar image

I am new to OpenCV, cv::MAT is class including many components, not like an pure array which I could directly use the pointer to pass it to another function, modify it, and still keep the values after that function.

How can I pass cv::MAT as a pointer?

Appreciate a lot for anyone's comments.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2017-04-22 18:47:32 -0600

berak gravatar image

updated 2017-04-22 19:20:42 -0600

that's probably the last thing on earth you should do.

cv::Mat is already a refcounted smartpointer,pass refs or returrn copies, but NEVER pointers, else you'll wreck the refcounting

see, c++ has evolved a lot over the last 20 years, if pointers are your "favourite weapon", you might be just wrong there.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-04-22 18:06:50 -0600

Seen: 2,545 times

Last updated: Apr 22 '17