How to use Usac Parameters in OpenCV for Fundamental Matrix

Issue

first of all I’m new so sorry for any mistake.
im trying to compute a similarity score between two images based on the number of inliers in order to put the most similar one on top. I read about ransac method and I tried the one from skimage library. the problem Is that its too slow, almost 12 second for each query match (1 query and 25 image to be reranked for that query). So I read something new on OpenCV which use something called UsacParam which should be faster and more precise. The question is how do I use it? I tried to do this:

import cv2
_, inliers = cv2.findFundamentalMat(locations_1_to_use,locations_2_to_use,cv2.USAC_FAST)`
inliers = sum(np.ravel(inliers))`

but I have some problem with that cv2.USAC_FAST it tells me it doesn’t exist but according to this link link to evaluation of the usac methods they do. Anyone know more about this? how can I count the inliers?. The code I’m looking for should be in Python and maybe the sac library is available only in cpp? I only know that it is written in cpp

Solution

According to this release cv2.USAC_FAST was made available only in version 4.5.0 of OpenCV.

While cross checking its availability by toggling different versions on this page I can confirm the same.

As of version 4.4.0 only the following three options are available:

  • cv2.LMEDS
  • cv2.RANSAC
  • cv2.RHO

Additional options (all part of the USAC family) are available from version 4.5.0 and above:

  • cv2.USAC_DEFAULT
  • cv.USAC_PARALLEL
  • cv2.USAC_FM_8PTS
  • cv2.USAC_FAST
  • cv2.USAC_ACCURATE
  • cv2.USAC_PROSAC
  • cv2.USAC_MAGSAC

enter image description here

Answered By – Jeru Luke

Answer Checked By – Terry (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.