Mat::clone() issues
Hello,
I am using a method for thinning an image. The method is beeing executed by a single thread.
void applyThreadedThinning(Mat* input) { Mat output = input->clone(); ..... }
I use MSVC 2015 (32bit) and the plugin Image Watch, which lets me see the content of the image while debugging.
After I set a breakpoint do the line with the clone()... i noticed, that the input image looks fine, but the cloned one is a plain image, filled with values 217 (8bit greyscale).
After jumping to the next line in the debugger, both images are "invalid".
Strange thing is, if I execute the method directly in the main method (not using a thread), it works fine. The threaded(std::thread t1(...)) version aborts during runtime.
Why is the clone method not working as intended? Is it something with scopes?
Thanks
can you explain a bit further why not to use pointers to cv::Mat?
the real code is kinda big, I will try to extract a minimum example and post it below.
i dont need it at all. I try to gain speed and tried different things. On this "trying" I came across this issue.
yes
because it's a refcounted smartpointer already. passing the address of it will defeat its purpose.
Replacing all cv::Mat* to cv::Mat and minor adaptions for the changed type did the trick. Thank you