Skip to content

findEssentialMat with USAC returns None since version 4.8.0 for valid input #24482

@shteren1

Description

@shteren1

System Information

OpenCV python version: 4.8.1 build py310hff52083_3 from conda-forge
Operating System / Platform: Ubuntu 18.04
Python version: 3.10.13

Detailed description

Hi, starting with opencv version 4.8.1 from conda-forge cv2.findEssentialMat() returns None for many cases that returned a valid solution with opencv version 4.5.5 and 4.7.0 when using USAC. both versions return a sane output for essential matrix when using the classic RANSAC solver. I think this is related to #23078

Steps to reproduce

import cv2
import numpy as np

points = np.array([[  71.35362447,  -73.48993604,   71.35376603,  -73.59021804],
       [ -88.90364312,  -73.61561921,  -88.90364312,  -73.61561921],
       [-167.59229029, -152.62241114, -167.59229029, -152.62241114],
       [  85.94304076, -162.11201907,   85.94304076, -162.11201907],
       [ 172.05289178, -162.39757996,  172.05289178, -162.39757996],
       [ -82.58191992,  -74.50782902,  -82.58191992,  -74.50782902],
       [-272.6442017 , -271.23413327, -272.6442017 , -271.23413327],
       [ -85.77380211, -273.03948033,  -85.77380211, -273.03948033],
       [ 103.14325005, -274.71871417,  103.24549557, -274.8227237 ],
       [ 294.19549172, -276.49581391,  294.19549172, -276.49581391],
       [-167.81015725, -168.7491632 , -167.70862579, -168.74839359],
       [ -79.41421943, -169.26774438,  -79.31358168, -169.2673819 ],
       [  98.36577158, -170.26210817,   98.36623108, -170.36341088],
       [ -74.05887631,  -77.30305365,  -74.05887631,  -77.30305365],
       [  10.260825  ,  -77.54947512,   10.16076431,  -77.64968961],
       [  64.70994691, -159.00848207,   64.8104607 , -159.00876493],
       [  48.0005312 ,  -71.95875096,   48.00062479,  -72.05898542],
       [  48.02296035, -233.95576851,   48.02296035, -233.95576851],
       [-113.99758728, -153.02210264, -113.99758728, -153.02210264],
       [ 128.95027293, -153.00278013,  128.95027293, -153.00278013],
       [-531.82226296,  193.00149743, -531.80771136,  192.4747974 ],
       [-186.99847614, -123.50523002, -187.10073587, -123.60693988],
       [ 825.53441926, -521.32613133,  825.79691647, -521.35039178],
       [ 463.62302476,  145.67892849,  463.62110312,  145.57512415],
       [ -28.49414672, -420.41603093,  -28.391098  , -420.20116664],
       [  88.09145441,  107.10489058,   88.09092315,  106.90369874],
       [ 292.93675706, -383.43338   ,  293.04229644, -383.4365222 ],
       [ 129.05236356, -477.10686816,  129.05063377, -476.99727052],
       [ -90.58267673,  207.89241318,  -91.58575871,  206.6746328 ],
       [-228.89530246,  173.56976397, -228.27218077,  172.84930809],
       [1065.99119855,  132.21384591, 1066.13767853,  132.21790114],
       [ 318.41220056, -421.45654236,  318.30185375, -421.34411053],
       [-294.17708945,   24.11502293, -294.17772815,   24.41862693],
       [ 502.3126993 ,   98.53781371,  502.09285013,   98.63878911],
       [-128.0704807 , -435.95125478, -128.06893292, -435.84322097],
       [ 129.84221632, -273.09259683,  129.9458877 , -273.30012846],
       [-476.91443292, -386.09419314, -476.69686157, -386.19301364],
       [ 575.52220458, -501.78447164,  575.53034267, -501.89910723],
       [-690.58899158,   47.85699357, -690.34568101,   47.429626  ],
       [-522.11192937, -463.88901488, -522.11192937, -463.88901488],
       [-708.64648858,   70.8426063 , -708.75428266,   69.88293808],
       [-958.54350679,  153.7748682 , -958.40575988,  153.77065468]])

focal = 1914.731689453125
threshold = 3

E, _ = cv2.findEssentialMat(points[:, :2], points[:, 2:], focal=focal, pp=(0, 0), method=cv2.USAC_MAGSAC,
                            threshold=threshold)
assert E is not None, 'unfortunately E is None'

Issue submission checklist

  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files (videos, images, onnx, etc)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions