Possible bug with calcOpticalFlowPyrLK in version 2.4.1 (Bug #2075)
Description
I have changed the opencv version from an android app from 2.4.0 to 2.4.1.
A previously working app, now has the following runtime exception:
06-21 17:04:06.732: E/AndroidRuntime(10162): FATAL EXCEPTION: Thread-10
06-21 17:04:06.732: E/AndroidRuntime(10162): java.lang.Exception: Unknown exception in JNI code {video::calcOpticalFlowPyrLK_11()}
06-21 17:04:06.732: E/AndroidRuntime(10162): at org.opencv.video.Video.calcOpticalFlowPyrLK_1(Native Method)
06-21 17:04:06.732: E/AndroidRuntime(10162): at org.opencv.video.Video.calcOpticalFlowPyrLK(Video.java:406)
06-21 17:04:06.732: E/AndroidRuntime(10162): at pt.rmarques.app.DemoView.objectDetection(DemoView.java:658)
06-21 17:04:06.732: E/AndroidRuntime(10162): at pt.rmarques.app.DemoView.processFrame(DemoView.java:339)
06-21 17:04:06.732: E/AndroidRuntime(10162): at pt.rmarques.app.DemoViewBase.run(DemoViewBase.java:240)
06-21 17:04:06.732: E/AndroidRuntime(10162): at java.lang.Thread.run(Thread.java:1020)
Revision <a href="http://code.opencv.org/projects/opencv/repository/revisions/8362">8362</a> might have broken calcOpticalFlowPyrLK JNI wrapper.
Associated revisions
Add test for issue #2075
Allow input of calcOpticalFlowPyrLK be submats of different size images
This fixes bug #2075
Merge pull request #2075 from ilya-lavrenov:tapi_mixchannels
History
Updated by Andrey Pavlenko over 12 years ago
Could you attach a reproducing test or sample please?
Updated by Andrey Kamaev over 12 years ago
Closing as not reproducible.
- Status changed from Open to Cancelled
- Target version set to 2.4.3
Updated by Rui Marques over 12 years ago
I was able to find the source of the problem, the error occurs in my particular case, when the second parameter is a submat.
So something about the matrix being a submat or the fact that it is a non-continuous matrix produces that error.
I haven't tested with placing a submat on the first parameter or on both first and second, but be aware of it.
This crashes:
MatOfByte status = new MatOfByte(); MatOfFloat err = new MatOfFloat(); MatOfPoint2f currentPoints = new MatOfPoint2f(); // previousPoints is a non-empty MatOfPoint2f with some points // someMat and someSubmat have same type/size. Video.calcOpticalFlowPyrLK(someMat, someSubmat, previousPoints, currentPoints, status, err);
With this work-around, it does not crash:
Mat testMat = someSubmat.clone(); // now testMat is not a submat and is continous Video.calcOpticalFlowPyrLK(someMat, testMat, previousPoints, currentPoints, status, err);
Updated by Andrey Kamaev over 12 years ago
Could you post your image size, submat size and submat offset? It might be helpful for debugging.
- Status changed from Cancelled to Open
Updated by Rui Marques over 12 years ago
Sure, I think this is what you are asking:
someSubmat.locateROI(wholeSize, ofs); Log.d(TAG, "debug: "+someMat.size()+" "+someSubmat.size()+" / "+wholeSize.toString()+" / "+ofs.toString()); // Outputs: // debug: 640x360 640x360 / 720x480 / {40.0, 60.0}
Updated by Kirill Kornyakov over 12 years ago
- Target version deleted (
2.4.3) - Assignee deleted (
Andrey Pavlenko)
Updated by Andrey Kamaev over 12 years ago
- Assignee set to Andrey Kamaev
Updated by Andrey Kamaev over 12 years ago
- Assignee deleted (
Andrey Kamaev)
Updated by Kirill Kornyakov over 12 years ago
- Target version set to Next Hackathon
Updated by Andrey Kamaev about 12 years ago
- Affected version set to 2.4.1
- Target version deleted (
Next Hackathon)
Updated by Andrey Kamaev about 12 years ago
- Pull request set to https://github.com/Itseez/opencv/pull/375
- Assignee set to Andrey Kamaev
Updated by Kirill Kornyakov about 12 years ago
- Target version set to 2.4.4