Giter VIP home page Giter VIP logo

Comments (5)

himanshu3897 avatar himanshu3897 commented on June 5, 2024

gesture folder are made but cant save any image over that

from emojinator.

mM-009 avatar mM-009 commented on June 5, 2024

The problem related to not being able to run CreateGest.py is due different versions of OpenCV as cv2.findContours() has varying return signatures in OpenCV 3.4.X, OpenCV 2.X and 4.1.X.

using the code below

contours = cv2.findContours(thresh.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE)
 contours = contours[0] if len(contours) == 2 else contours[1]

instead of

contours = cv2.findContours(thresh.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE) [1]

runs CreateGest.py and saves 1200 images in the folder. However, the images are still not generating good hand contours.

I am using opencv-contrib-python==4.1.1.26

@akshaybahadur21 which opencv version did you use in this project ?

from emojinator.

mM-009 avatar mM-009 commented on June 5, 2024

anyway, the above method in opencv == 4.1.1.26 had contour problem as it was finding black object from white background. This is incorrect because in OpenCV, object to be found should be white and background should be black. So the image needs to be inverted using THRESH_BINARY_INV as shown below:

ret, thresh = cv2.threshold(opening, 30, 255, cv2.THRESH_BINARY_INV)

instead of :

ret, thresh = cv2.threshold(opening, 30, 255, cv2.THRESH_BINARY)

so the code after all changes is :

      # ret, thresh = cv2.threshold(opening, 30, 255, cv2.THRESH_BINARY)
        ret, thresh = cv2.threshold(opening, 30, 255, cv2.THRESH_BINARY_INV)
        thresh = thresh[y:y + h, x:x + w]
        #contours = cv2.findContours(thresh.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE)[1]
        contours = cv2.findContours(thresh.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE)
        contours = contours[0] if len(contours) == 2 else contours[1]

CreateGest.py runs correctly using above changes in code for opencv version 4.1.1.26

from emojinator.

pradeep42375 avatar pradeep42375 commented on June 5, 2024

It is still not creating the gestures

from emojinator.

sohanatarafder99 avatar sohanatarafder99 commented on June 5, 2024

my create gesture file is completely working but it is not saving the images

from emojinator.

Related Issues (20)

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.