Ask Your Question

Revision history [back]

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

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

Mat frame = new Mat();
while(videoCapture.read(frame)){
if(frame.empty) break;
list.add(frame.clone());
}

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?

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

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

code:

Mat frame = new Mat();
Mat();<br> while(videoCapture.read(frame)){
while(videoCapture.read(frame)){<br> if(frame.empty) break;
break;<br> list.add(frame.clone());
list.add(frame.clone());<br> }
}

which causes whole machine to freeze and become unresponsive, I've tried constructing new temporary mat object and make deep copy using mat.copyTo() 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? frame?

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

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

Mat frame = new Mat();<br>
Mat(); 
 while(videoCapture.read(frame)){<br>
while(videoCapture.read(frame)){ 
  if(frame.empty) break;<br>
break >
 list.add(frame.clone());<br>
list.add(frame.clone()); 
}

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?