transform - OpenCV RANSAC returns the same transformation everytime -
i confused how use opencv findhomography
method compute optimal transformation.
the way use follows:
cv::mat h = cv::findhomography(src, dst, cv_ransac, 5.f);
no matter how many times run it, same transformation matrix. thought ransac supposed randomly select subset of points fitting, why return same transformation matrix everytime? related random number initialization? how can make behaviour random?
secondly, how can tune number of ransac iterations in setup? number of iterations based on inlier ratios , things that.
findhomography give optimal transformation. real question meaning of optimal.
for example, ransac
you'll have model minimum reprojection error, while lmeds
you'll have model minimum median error.
you can modify default behavior by:
- changing number of iteration of
ransac
settingmaxiters
(max number allowed 2000) - decreasing (increasing)
ransacreprojthreshold
used validate inliers , outliers (usually between 1 , 10).
regarding questions.
no matter how many times run it, same transformation matrix.
probably points enough find optimal model.
i thought ransac supposed randomly select subset of points fitting
ransac (random sample consensus) first selects random subset, checks if model built these points enough. if not, selects random subset.
how can make behaviour random?
i can't imagine scenario useful, can randomly select 4 couples of points src
, dst
, , use getperspectivetransform. unless points perfect, you'll different matrix each subset.
Comments
Post a Comment