You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While I was looping through frames of VideoCapture I executed this method to show frames on JavaFX image view:
private Image mat2Image(Mat frame) {
MatOfByte buffer = new MatOfByte();
Imgcodecs.imencode(".png", frame, buffer);
return new Image(new ByteArrayInputStream(buffer.toArray()));
}
for some reason it caused memory leak very rapidly like 5mb/s. After that I switch to opencv library from their official website and same code worked fine without any leaks.
The text was updated successfully, but these errors were encountered:
Everything kept the same after changing opencv library from openpnp to official.
Code given above caused a memory leak. It been a while since I changed the source of that function but it might be an automatic resource management feature in the official library.
As far as I remember, I did expect OpenCV to automatically handle resource management and I didn't free the resources manually. Also I used openpnp with mutli-threading. Was it thread-safe? 🤔
While I was looping through frames of VideoCapture I executed this method to show frames on JavaFX image view:
private Image mat2Image(Mat frame) {
MatOfByte buffer = new MatOfByte();
Imgcodecs.imencode(".png", frame, buffer);
return new Image(new ByteArrayInputStream(buffer.toArray()));
}
for some reason it caused memory leak very rapidly like 5mb/s. After that I switch to opencv library from their official website and same code worked fine without any leaks.
The text was updated successfully, but these errors were encountered: