Undefined cv::Mat Behavior

please do not post screenshots of code, but TEXT instead, thank you.

also, we need to see your real code, not an “idea of it” with elipses like //...

then, we don’t know, how your cameraclass looks like, and cameraclass camera = new cameraclass() isn’t valid c++

again, if we can’t try your code, we cannot help.