Coder Social home page Coder Social logo

opencv-python's Introduction

opencv-python

Curso de introducción a OpenCV y Python.

opencv-python's People

Contributors

rcrespocano avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

opencv-python's Issues

Knearest compatibility error (OpenCV 3.1)

Again, some errors due to a series of refactoring operations made in the latest versions:

Ejemplo 22, line 25,26 and 27 crash:

knn = cv2.KNearest() # error
knn.train(trainData, responses)  # error
ret, results, neighbours, dist = knn.find_nearest(newcomer, k)  # error


---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-8-cfe065aacd5a> in <module>()
     23 # Classification
     24 k = 5
---> 25 knn = cv2.KNearest()
     26 knn.train(trainData, responses)
     27 ret, results, neighbours, dist = knn.find_nearest(newcomer, k)

AttributeError: module 'cv2' has no attribute 'KNearest'

This version works:

knn = cv2.ml.KNearest_create()
knn.train(trainData,cv2.ml.ROW_SAMPLE,responses)
ret, results, neighbours, dist = knn.findNearest(newcomer, k)

+info:
http://stackoverflow.com/a/30950853
http://stackoverflow.com/a/32990528
http://stackoverflow.com/a/34247966

kmeans argument missing

Website with documentation is wrong.

kmeans requires 6 arguments and not 5:

print(cv2.kmeans.__doc__)
# kmeans(data, K, bestLabels, criteria, attempts, flags[, centers]) -> retval, bestLabels, centers

Thus, ejemplo 23, line 22:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-13-af223fb327d3> in <module>()
     20 
     21 # Apply kmeans
---> 22 ret, label, center = cv2.kmeans(Z, K, criteria, attempts, cv2.KMEANS_RANDOM_CENTERS)
     23 
     24 # Now separate the data, Note the flatten()

TypeError: Required argument 'flags' (pos 6) not found

This will work:

ret, label, center = cv2.kmeans(Z, K, None, criteria, attempts, cv2.KMEANS_RANDOM_CENTERS)

Compatibilty Issue ORB

Ejemplo 21, line 83:

# Initiate ORB detector
orb = cv2.ORB()


---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-6-63fa69861ef0> in <module>()
     81 
     82 # Initiate ORB detector
---> 83 orb = cv2.ORB()
     84 
     85 # Find the keypoints and descriptors with ORB

AttributeError: module 'cv2' has no attribute 'ORB'

In OpenCV 3.x, this method has been renamed to:

orb = cv2.ORB_create()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.