logo
down
shadow

How to build OpenCV 3.0.0 for Python with non-free modules?


How to build OpenCV 3.0.0 for Python with non-free modules?

By : user2949591
Date : November 17 2020, 01:00 AM
I wish did fix the issue. with opencv3.0, sift and surf have been moved to a opencv_contrib repo, also, you will need to build the whole thing from src. so:
fork/clone/download that. take your time with the readme there.
code :
>>> import cv2
>>> help(cv2.xfeatures2d)   # additional namespace !
Help on module cv2.xfeatures2d in cv2:

NAME
    cv2.xfeatures2d

FILE
    (built-in)

FUNCTIONS
    SIFT_create(...)
        SIFT_create([, nfeatures[, nOctaveLayers[, contrastThreshold[, edgeThreshold[, sigma]]]]]) -> retval

    SURF_create(...)
        SURF_create([, hessianThreshold[, nOctaves[, nOctaveLayers[, extended[,upright]]]]]) -> retval


>>> sift = cv2.xfeatures2d.SIFT_create()
>>> sift.detect(...)


Share : facebook icon twitter icon
Python-OpenCV cv2 OpenCV Error: Assertion failed (scn == 3 || scn == 4) in unknown function, file ..\..\..\modules\imgpr

Python-OpenCV cv2 OpenCV Error: Assertion failed (scn == 3 || scn == 4) in unknown function, file ..\..\..\modules\imgpr


By : Radha Krishna B
Date : March 29 2020, 07:55 AM
should help you out It says your input image should have 3 or 4 channels before applying the function cv2.cvtColor.
so check your image shape before applying the function by print im.shape. if the result is None type (most of the times, this is the problem), your image is not loaded correctly, most probably because your path is not correct.
Build specific modules OpenCV

Build specific modules OpenCV


By : TheLemon200
Date : March 29 2020, 07:55 AM
I wish did fix the issue. I'd like to ask how can I specify OpenCV modules to build by cmake ex. I'd like to build only core, highgui and improc. , you can toggle each module by specifying it to cmake:
code :
-DBUILD_opencv_xxxx=OFF # where xxxx is the module in question, and ON or OFF is your requested state
PyCharm: Installation of non-free OpenCV modules for operations like SIFT, SURF

PyCharm: Installation of non-free OpenCV modules for operations like SIFT, SURF


By : dc_vc
Date : March 29 2020, 07:55 AM
To fix this issue With OpenCV 3, the non-free modules, namely SIFT and SURF, which are patented by their respective creators, were moved out of the default OpenCV install and into the opencv_contrib package. The implementations in opencv_contrib are not installed by default and you need to explicitly enable them when compiling and installing OpenCV to obtain access to them.
To get access to the original SIFT and SURF implementations found in OpenCV 2.4.X (versions with these implementations installed by default), you will need to pull down both the opencv and the opencv_contrib repositories from GitHub and then compile and install OpenCV3 from source.
Build OpenCV with contrib modules and Java wrapper

Build OpenCV with contrib modules and Java wrapper


By : Hung Nguyen
Date : March 29 2020, 07:55 AM
I hope this helps you . i've the same problem and i resolved in this way. I imagine that you had downloaded from contrib repo the specific version match with the opencv version if you want to build. So go in directory and enter, for example, face module directory; in this directory there is a file called CMakeLists.txt that you have to edit. This file should be like this:
Getting an error OpenCV(3.4.1) C:\projects\opencv-python\opencv\modules\imgproc\src\thresh.cpp:1406: error: (-215)

Getting an error OpenCV(3.4.1) C:\projects\opencv-python\opencv\modules\imgproc\src\thresh.cpp:1406: error: (-215)


By : RaviKrishna Rayudu
Date : March 29 2020, 07:55 AM
Hope this helps You will be able to resolve your error with following way.
First check whether your input image has only single channel. You can check it by running print img.shape. If the result is like (height, width, 3), then the image is not single channel. You can convert the image into a single channel one by:
code :
img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
img = img.astype('uint8')
 ret3,th3 = cv2.threshold(blur,0,255,cv2.THRESH_BINARY | cv2.THRESH_OTSU)
img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
img = img.astype('uint8')
blur = cv2.GaussianBlur(img,(5,5),0)
ret3,th3 = cv2.threshold(blur,0,255,cv2.THRESH_BINARY | cv2.THRESH_OTSU)
image = numpy.invert(th3)
cv2.show('image_out', image)
cv2.waitKey(0)
cv2.destroyAllWindows() 
Related Posts Related Posts :
  • Appending a column in .csv with Python/Pandas
  • How to change my result directory in Robot framework using RIDE?
  • problem with using pandas to manipulate a big text file in python
  • python-magic module' object has no attribute 'open'
  • Where goes wrong for this High Pass Filter in Python?
  • Why inserting keys in order into a python dict is faster than doint it unordered
  • flann index saving in python
  • Create new instance of list or dictionary without class
  • How can I easily convert FORTRAN code to Python code (real code, not wrappers)
  • Address of lambda function in python
  • Python adding space between characters in string. Most efficient way
  • python http server, multiple simultaneous requests
  • Disguising username & password on distributed python scripts
  • Post GraphQL mutation with Python Requests
  • Why doesnt pandas create an excel file?
  • Rolling comparison between a value and a past window, with percentile/quantile
  • How to avoid repetitive code when defining a new type in python with signature verification
  • How to configure uWSGI in order to debug with pdb (--honour-stdin configuration issue)
  • In Python, how do you execute objects that are functions from a list?
  • Python- Variable Won't Subtract?
  • Processing Power In Python
  • Python 2.7.2 - Cannot import name _random or random from sys
  • Why doesn't the Python sorted function take keyword order instead of reverse?
  • Make a function redirect to other functions depending on a variable
  • get_absolute_url in django-categories
  • Monitoring non-Celery background task with New Relic in Python
  • Feature selection with LinearSVC
  • LSTM - Predicting the same constant values after a while
  • Test the length of elements in a list
  • Django: render radiobutton with 3 columns, cost column must change according to size & quantity selected
  • Python class attributes vs global variable
  • sys.stdout.writelines("hello") and sys.stdout.write("hello")
  • is ndarray faster than recarray access?
  • Python - search through directory trees, rename certain files
  • GAE: How to build a query where a string begins with a value
  • TypeError: __init__() takes at least 2 arguments (1 given)
  • Overriding and customizing "django.contrib.auth.views.login"
  • Django : Redirect to a particular page after login
  • Python search and copy files in directory
  • pretty printing numpy ndarrays using unicode characters
  • Frequent pattern mining in Python
  • How can I make a set of functions that can be used synchronously as well as asynchronously?
  • Convert one dice roll to two dice roll
  • count occourrence in a list
  • Writing an If condition to filter out the first word
  • to read file and compare column in python
  • Install python-numpy in the Virtualenv environment
  • `.select_by_visible_text()` is failed to select element?
  • Unable to send data multiple requests in a single connection — socket error
  • Pandas HDFStore unload dataframe from memory
  • Creating a custom admin view
  • How do you get the user role of the currently logged in user in Ckan?
  • Speed up Numpy Meshgrid Command
  • Python error - name lengths
  • appending text to a global variable
  • Python Mistake - Number of letters in name
  • Searching for a sequence in a text
  • Testing logging output with pytest
  • How do I change my default working directory for Python (Anaconda) on VSCode?
  • .lower() for x in list, not working, but works in another scenario
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org