uscauv-legacy / old-uscauv-ros-pkg

ROS software used on robots made by the USC AUV Team.
4 stars 6 forks source link

Optical Flow Crashes Occasionally #47

Closed canondetortugas closed 10 years ago

canondetortugas commented 11 years ago

Seems like it's related to the number of input features.

With error:

OpenCV Error: Assertion failed ((npoints = prevPtsMat.checkVector(2, CV_32F, true)) >= 0) in calcOpticalFlowPyrLK, file /tmp/buildd/ros-groovy-opencv2-2.4.5-2precise-20130519-1747/modules/video/src/lkpyramid.cpp, line 593
terminate called after throwing an instance of 'cv::Exception'
  what():  /tmp/buildd/ros-groovy-opencv2-2.4.5-2precise-20130519-1747/modules/video/src/lkpyramid.cpp:593: error: (-215) (npoints = prevPtsMat.checkVector(2, CV_32F, true)) >= 0 in function calcOpticalFlowPyrLK
lccrubik commented 10 years ago

hey there, we have the same problem, please help us!!!!!

canondetortugas commented 10 years ago

Right this happens if you call the calcOpticalFlowPyrLK function and your vector of old features is empty. So in our case we just added to check so that if the vector is empty, we don't run optical flow and instead just save our vector of new features. It was fixed in this commit: 994c57520f1e8531734aba23135b713a6b16f7c7