opencv-python icon indicating copy to clipboard operation
opencv-python copied to clipboard

cv2.findEssentialMat w/ USAC_ACCURATE throws LAPACK/Eigen error from pypi wheel

Open johnwlambert opened this issue 3 years ago • 15 comments

Expected behaviour

I expect the library not to crash or throw an error:

Actual behaviour

error: OpenCV(4.5.3) /tmp/pip-req-build-l1r0y34w/opencv/modules/calib3d/src/usac/essential_solver.cpp:197: error: (-213:The function/feature is not implemented) To use essential matrix solver LAPACK or Eigen has to be installed! in function 'estimate'

but I installed this from the pypi wheel. I would expect auditwheel or delocate to have provided the Eigen dependencies

Steps to reproduce

  • example code
!pip install opencv_python==4.5.3.56

then

            i2Ei1, inlier_mask = cv2.findEssentialMat(
                uv_norm_i1[match_indices[:, 0]],
                uv_norm_i2[match_indices[:, 1]],
                K,
                method=cv2.USAC_ACCURATE,
                threshold=self._estimation_threshold_px / fx,
                prob=RANSAC_SUCCESS_PROB,
            )
  • operating system + architecture (e.g. x86)
uname -a
Linux 9f3c72e6a869 5.4.104+ #1 SMP Sat Jun 5 09:50:34 PDT 2021 x86_64 x86_64 x86_64 GNU/Linux
  • opencv-python version
import cv2
cv2.__version__
4.5.3
Issue submission checklist
  • [X] This is not a generic OpenCV usage question (looking for help for coding, other usage questions, homework etc.)
  • [X] I have read the README of this repository and understand that this repository provides only an automated build toolchain for OpenCV Python packages (there is no actual OpenCV code here)
  • [X] The issue is related to the build scripts in this repository, to the pre-built binaries or is a feature request (such as "please enable this additional dependency")
  • [X] I'm using the latest version of opencv-python

johnwlambert avatar Sep 01 '21 00:09 johnwlambert

Eigen is header-only library, it's not visible in list of shared libraries or dependencies. The issue is our CI miss-configuration. I'll check scripts and come back with the issue resolution.

asmorkalov avatar Sep 10 '21 08:09 asmorkalov

Thanks!

johnwlambert avatar Sep 10 '21 13:09 johnwlambert

Hi @asmorkalov, just wanted to check back with you about this.

I noticed that in the 4.5.0 opencv distribution, eigen/lapack are properly packaged.

But in other later versions, such as 4.5.3, the packaging is broken. Was there a major change in the packaging between those versions?

johnwlambert avatar Sep 27 '21 17:09 johnwlambert

@johnwlambert The dependency is broken by mistake. We are working on infrastructure fix for the next release.

asmorkalov avatar Sep 28 '21 04:09 asmorkalov

Hi @johnwlambert, the issue was fixed in https://github.com/opencv/opencv-python/pull/547 and merged into master. The next release of packages will upload fixed wheels.

asenyaev avatar Oct 08 '21 09:10 asenyaev

Very nice, thanks @asenyaev for the patch. Do you know when the next release will be published?

johnwlambert avatar Oct 08 '21 14:10 johnwlambert

OpenCV 4.5.4 is already published in core repository: https://github.com/opencv/opencv/releases/tag/4.5.4. Python packages will be ready in a week or so.

asmorkalov avatar Oct 11 '21 04:10 asmorkalov

OpenCV-Python 4.5.4 packages just released to Pypi. LAPACK is enabled for all Linux configurations, MacOS (accelerate framework), but not Windows. The team will work on Windows support for the next release.

asmorkalov avatar Oct 21 '21 06:10 asmorkalov

Thank you! Confirmed on my end that the issue is resolved.

johnwlambert avatar Oct 21 '21 17:10 johnwlambert

Sounds great!. I reopen the issue as Windows configuration is not ready.

asmorkalov avatar Oct 22 '21 08:10 asmorkalov

hello @asmorkalov

With WIN 10 I have the same problem and I am getting the error

error: OpenCV(4.5.5) D:\a\opencv-python\opencv-python\opencv\modules\calib3d\src\usac\essential_solver.cpp:197: error: (-213:The function/feature is not implemented) To use essential matrix solver LAPACK or Eigen has to be installed! in function 'cv::usac::EssentialMinimalSolverStewenius5ptsImpl::estimate'

cv.version Out[8]: '4.5.5'

I have installed LAPACK and Eigen using conda with

conda install -c conda-forge lapack conda install -c conda-forge eigen

mfatih7 avatar May 16 '22 17:05 mfatih7

Then I downgraded to version 4.5.1.48. But this generated other errors related to Camera Calibration and 3D Reconstriction functions

mfatih7 avatar May 16 '22 17:05 mfatih7

Yes. Windows packages does not contain LAPACK and the function is available on Linux and Mac for now. We are looking for good enough LAPACK implementation for Windows to cover all platforms.

asmorkalov avatar May 16 '22 17:05 asmorkalov

hello @asmorkalov

Do you have any updates for USAC OpenCV implementation for windows?

In my study, I want to use both RANSAC and USAC implementations.

best regards

mfatih7 avatar Sep 23 '22 17:09 mfatih7

Hello @mfatih7 We have some build issues with LAPACK and binaries distribution for now. Unfortunately I cannot guarantee that it'll be fixed before the next release.

asmorkalov avatar Sep 25 '22 10:09 asmorkalov