2020-03-19 00:38:58 -0600 | received badge | ● Popular Question (source) |
2014-01-11 11:51:18 -0600 | commented question | Java: Memory leak from iterating OpenCV frames First of all, doing it in a loop instead of an iterator won't help too much. I could simply use the second version of the iterator, and just copy the frames away, which I need for later. And of course, I just posted a minimized example here. The original iterator is way more complex. E.g. it starts a new thread to retreive the pictures simultaneously to processing the old, "interesting" pictures found so far. |
2014-01-11 07:02:51 -0600 | asked a question | Java: Memory leak from iterating OpenCV frames I am using the java wrapper of OpenCV. I tried to write an Iterator over frames of a film. My problem is that the iterator is a huge memory leak. It fills a GByte within seconds. Here is a very simplified version of the iterator, which has this leak: When I Iterate over this code using e.g. this loop: memory consumption will increase linear. I see that the problem is the first line in the next()-Method. It always creates a new Mat. But speaking of java alone, this Mat will run out of scope as soon as the it.next() statement is over. I could overcome the problem, by not using a new Mat every time, but overwriting always the same Mat-Object, like this: But now the last frame which was given by the iterator will always be overwritten by the current frame. Thus, I cannot hold it outside for later use, if I am interested in this single frame. I could copy it, of course, but that would also be expensive. To illustrate the problem with the last approach, imagin this code using the iterator: With the second version of the iterator, 10.png, and 30.png will be different images. But that's obviously not what was intended. I assume that the problem is that the garbage collector will not destroy the Mat objects, because it does not recognize the memory consumption, since it is not java heap space. Calling mat.release() in the loop will help, but of course in real code this means I will have no garbage collection for my Mat objects. Anybody has an idea how to do it? Edit: I expermiented now a while with it, and came to the following solution: If I call the garbage collector on a regular basis, it will delete all the unreferenced Mat objects, and together with them the RAM allocated from C. Well, that's probably a problem you have to face when mixing ... (more) |
2014-01-09 08:00:53 -0600 | commented answer | Unable to open some avi files in OpenCV-Python -- Why? I found the solution for me: I set the OPENCV_DIR to the x86 directory of the libs. But in fact I used a x64 java. Changing the OPENCV_DIR solved the problem for me. |
2014-01-05 04:49:48 -0600 | commented question | I cannot build java in 3.0.0 Cool, it worked. Thanks a lot! If this would have been an answer, I would have accepted it. ;-) |
2014-01-05 03:17:12 -0600 | asked a question | I cannot build java in 3.0.0 Hi all, I try to configure CMake to build OpenCV with java support. Everything is fine, but it will not build java. The configure output even says so: (more) |
2013-12-21 07:19:28 -0600 | answered a question | Unable to open some avi files in OpenCV-Python -- Why? I still cannot answer the question why, but I found a workaround which helps at least for now: Download mplayer. This package contains also the program mencoder. Now take a video file (in.avi), and run this command: out.avi will have no sound. If you need it, you can omit -nosound, but you will probably have to give another command line argument. out.avi will be very large, but at least you can open it with OpenCV on Windows. |
2013-12-21 02:51:38 -0600 | commented question | Unable to open some avi files in OpenCV-Python -- Why? Unfortuantely I have not an answer here, but it seems that it is not a problem of python. I have the same problem with java, and C++. I can read none of the video files I tried in various formats. The author of this questoin kindly sent me the file julius.avi, and I can read this one. With java, and with C++. |
2013-12-21 02:47:35 -0600 | answered a question | Java: I don't get VideoCapture.open(String) to work Can anybody close my quesion, since it is just a duplicate of this one? My problem has nothing to do with java at all. I asked the author of the linked question for his file julius.avi. I can read this one with java, but no other file. |
2013-12-20 11:37:36 -0600 | received badge | ● Supporter (source) |
2013-12-20 11:23:24 -0600 | commented question | Help to Open Video File I have exactly the same problem, and no clue what causes the problem. Recompiling OpenCV might not be the point, because I didn't compile it in first place. I just used the compiled libs from the homepage. |
2013-12-20 11:19:30 -0600 | commented question | Java: I don't get VideoCapture.open(String) to work Ok, after some work I got a C++ program to compile (not so easy, if you never build C++ programs :-). I wrote basically the same program in C++. It also prints false. So, it can probably be ruled out that it is a bug in the java wrapper. Still, I have no idea what exactly the problem is. So, I am grateful for every hint. |
2013-12-16 11:03:24 -0600 | received badge | ● Editor (source) |
2013-12-16 11:02:36 -0600 | asked a question | Java: I don't get VideoCapture.open(String) to work Hi all, I try to get the following java code to work: Unfortuantely, it prints "false", thus it will not open the file. The system is a Windows 7. I have no additional codecs installed. The file is definitely at this place. I can watch it with Windows Media Player. You can find the file attached to this bug report as m.avi. Thanks for your help! |