cv::videoCapture possible memory leak with file read/save

Case closed! Thanks very much indeed, @crackwitz!

For anyone who sees memory leak looking stuff with Windows 10 and OpenCV 4.0.0/ 4.51 / 4.52 when using videocapture, you may have a similar situation to me. That is to say, MSoft MediaFoundation as a backend for the reader might not be behaving as well as it should.

Instead, explicitly set your apiBackend for the reader:

cv::VideoCapture videoReader ("pathtoMovie.avi",  cv::CAP_OPENCV_MJPEG);

Not only do I see no leaked memory, but it’s actually a little faster.

On the topic of the expression:

I did try this but it’s not a syntax that I can get away with in c++. I tried a few things but I was unable to get a version of your suggestion to work. Would you mind explaining a bit more verbosely what a better alternative is to what I was doing please? Is your point that I’m combining a float operation on int matrices?