Possible bug with calcOpticalFlowPyrLK in version 2.4.1

232 views
Skip to first unread message

Rui Marques

unread,
Jun 21, 2012, 12:12:11 PM6/21/12
to android...@googlegroups.com
I wanted to discuss the bug here before i submit it to opencv.

I migrated my android app from 2.4.0 to 2.4.1, it was working properly but with the latter version i get this *runtime* error:

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)


This is the code:

Mat mPreviousFrameROI = some_mat;
Mat mCurrentFrameROI = another_mat;

MatOfByte  status = new MatOfByte();
MatOfFloat err       = new MatOfFloat();          
Size winSize         = new Size(21,21);
MatOfPoint2f mCurrentScenePoints = new MatOfPoint2f();

// Video.calcOpticalFlowPyrLK(mPreviousFrameROI, mCurrentFrameROI, previousPoints, mCurrentScenePoints, status, err); //Same error with this one          
Video.calcOpticalFlowPyrLK(mPreviousFrameROI, mCurrentFrameROI, previousPoints, mCurrentScenePoints, status, err, winSize, 1);


I am trying to figure out what happened.

Andrey Pavlenko

unread,
Jun 22, 2012, 8:52:29 AM6/22/12
to android...@googlegroups.com
Rui, could you provide a complete reproducible test or sample? (Please attach it to the ticket #2075 you created)
The functiuon works in our tests and app-s.

Rui Marques

unread,
Jun 22, 2012, 9:18:52 AM6/22/12
to android...@googlegroups.com
Ok i will try to make a sample to reproduce, as I can't share the whole code.


Rui Marques

unread,
Jul 8, 2012, 6:08:45 PM7/8/12
to android...@googlegroups.com
Somehow the error stopped from happening.
But i have the feeling something changed with optical flow. Did something regarding the window size, or default pyramid levels changed since 2.4.0?
Reply all
Reply to author
Forward
0 new messages