There is a huge memory leak here. Im trying to fix, but even calling Mat.release(), didn't worked. I think may there is an issue calling read(Mat mat) from another thread.
private Mat grabFrame()
{
// init everything
Mat frame = new Mat();
// check if the capture is open
if (this.capture.isOpened())
{
try
{
// read the current frame
this.capture.read(frame);
// if the frame is not empty, process it
if (!frame.empty())
{
Imgproc.cvtColor(frame, frame, Imgproc.COLOR_BGR2GRAY);
}
}
catch (Exception e)
{
// log the error
System.err.println("Exception during the image elaboration: " + e);
}
}
return frame;
}
There is a huge memory leak here. Im trying to fix, but even calling Mat.release(), didn't worked. I think may there is an issue calling read(Mat mat) from another thread.