calling mat.copyto and mat.clone in loop causes machine to freeze in java [closed]

asked 2020-03-06 01:32:11 -0500

kcifsaefas gravatar image

updated 2020-03-06 03:26:55 -0500

supra56 gravatar image

I'm reading frames from video file and store them in queue to process them later with following code:

Mat frame = new Mat(); 
  if(frame.empty) break >

which causes whole machine to freeze and become unresponsive, I've tried constructing new temporary mat object and make deep copy using mat.copyTo() which causes the same problem. I've tried using opencv 3.4.8 as well as 4.2.0 and the results are the same... Am I doing something wrong? Is there other way how to read all frames into data structure than reading frame by frame?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by kcifsaefas
close date 2020-03-06 07:29:28.106936



out of memory ? after how many frames ?

berak gravatar imageberak ( 2020-03-06 02:36:30 -0500 )edit

Yea it was memory issue, after resizing frames to more manageable size it seems to work fine except it uses more than twice the memory equivalent c++ code needs

kcifsaefas gravatar imagekcifsaefas ( 2020-03-06 07:26:44 -0500 )edit