Quantcast
Channel: OpenCV Q&A Forum - Latest question feed
Viewing all articles
Browse latest Browse all 19555

OpenCV Error: Assertion failed (prevPyr[level * lvlStep1].size() == nextPyr[level * lvlStep2].size()) in void cv::calcOpticalFlowPyrLK

$
0
0
I am working on 2 images, on the first one i found goodFeaturesToTrack and draw it then on it, i am trying to to tracking with that to the second image but the line of calling calcOpticalFlowPyrLK gets an error: error(): OpenCV Error: Assertion failed (prevPyr[level * lvlStep1].size() == nextPyr[level * lvlStep2].size()) in void cv::calcOpticalFlowPyrLK(InputArray, InputArray, InputArray, InputOutputArray, OutputArray, OutputArray, Size, int, cv::TermCriteria, int, double), file /hdd2/buildbot/slaves/slave_ardbeg1/50-SDK/opencv/modules/video/src/lkpyramid.cpp, line 979 And i do not understand what the proble, is. MatOfPoint2f prevPts = new MatOfPoint2f(); MatOfPoint2f nextPts = new MatOfPoint2f(); MatOfByte status = new MatOfByte(); MatOfFloat err = new MatOfFloat(); //when to stop TermCriteria optical_flow_termination_criteria=new TermCriteria(); optical_flow_termination_criteria.epsilon=0.3; optical_flow_termination_criteria.maxCount =20; int maxlevel = 2; Size s = new Size( 21, 21); MatOfPoint corners = new MatOfPoint(); Imgproc.goodFeaturesToTrack(tmp,corners,maxCorners,qualityLevel,minDistance,newMat(),blockSize, useHarrisDetector,k); org.opencv.core.Point[] points = corners.toArray(); for (org.opencv.core.Point p : points) { Core.circle(tmp2, p, 8, circleColor); } corners.convertTo(prevPts, CvType.CV_32FC2); Video.calcOpticalFlowPyrLK(tmp, secondtmp, prevPts, nextPts, status, err,s,maxlevel,optical_flow_termination_criteria,2,1); Thank in advance!!

Viewing all articles
Browse latest Browse all 19555

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>