Skip to content

Solve Issue 19761#19762

Merged
alalek merged 3 commits intoopencv:masterfrom
lukasalexanderweber:master
Mar 24, 2021
Merged

Solve Issue 19761#19762
alalek merged 3 commits intoopencv:masterfrom
lukasalexanderweber:master

Conversation

@lukasalexanderweber
Copy link
Copy Markdown
Contributor

@lukasalexanderweber lukasalexanderweber commented Mar 22, 2021

resolves #19761

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or other license that is incompatible with OpenCV
  • The PR is proposed to proper branch
  • There is reference to original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

This is a Pull Request for the Issue 19761

In OpenCV 4.5.1

import cv2 as cv
cv.xfeatures2d_SURF.create

will not create an AttributeError, even if the function is excluded (no nonfree option)

In Line 305 (now 306) however, if surf is passed to the parameter features

finder = FEATURES_FIND_CHOICES[args.features]()
aka
cv.xfeatures2d_SURF.create()

will raise an

error: OpenCV(4.5.1) ..\opencv_contrib\modules\xfeatures2d\src\surf.cpp:1029: error: (-213:The function/feature is not implemented) This algorithm is patented and is excluded in this configuration; Set OPENCV_ENABLE_NONFREE CMake option and rebuild the library in function 'cv::xfeatures2d::SURF::create'

So we should check with cv.xfeatures2d_SURF.create() correctly if SURF is available

In OpenCV 4.5.1 

import cv2 as cv
cv.xfeatures2d_SURF.create

will not create an AttributeError, even if the function is excluded (no nonfree option)

In Line 305 (now 306) however ´finder = FEATURES_FIND_CHOICES[args.features]()´ will raise an 

error: OpenCV(4.5.1) ..\opencv_contrib\modules\xfeatures2d\src\surf.cpp:1029: error: (-213:The function/feature is not implemented) This algorithm is patented and is excluded in this configuration; Set OPENCV_ENABLE_NONFREE CMake option and rebuild the library in function 'cv::xfeatures2d::SURF::create'

So we should check with cv.xfeatures2d_SURF.create() correctly if SURF is available
When the user works with his own data, this throws an error.
@lukasalexanderweber
Copy link
Copy Markdown
Contributor Author

Please forgive me if I'm not fulfilling all requirements on your pull requests. To be honest this is the first one I've ever done in any popular Repo. Please give any information on how I can improve them

is_compose_scale_set = False
for name in img_names:
full_img = cv.imread(cv.samples.findFile(name))
full_img = cv.imread(name)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is wrong

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, sorry I updated the file

My mistake, it works also with images not being in a samples folder
@alalek alalek merged commit 7c4b873 into opencv:master Mar 24, 2021
@alalek alalek mentioned this pull request Apr 9, 2021
a-sajjad72 pushed a commit to a-sajjad72/opencv that referenced this pull request Mar 30, 2023
* Error Message for SURF if not implemented

In OpenCV 4.5.1 

import cv2 as cv
cv.xfeatures2d_SURF.create

will not create an AttributeError, even if the function is excluded (no nonfree option)

In Line 305 (now 306) however ´finder = FEATURES_FIND_CHOICES[args.features]()´ will raise an 

error: OpenCV(4.5.1) ..\opencv_contrib\modules\xfeatures2d\src\surf.cpp:1029: error: (-213:The function/feature is not implemented) This algorithm is patented and is excluded in this configuration; Set OPENCV_ENABLE_NONFREE CMake option and rebuild the library in function 'cv::xfeatures2d::SURF::create'

So we should check with cv.xfeatures2d_SURF.create() correctly if SURF is available
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Two minor bugs in stitching_detailed.py

2 participants