Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue running the file imgCrop = img[y:y+h, x:x+w] #1

Closed
wcqrwtqr opened this issue Feb 24, 2018 · 8 comments
Closed

issue running the file imgCrop = img[y:y+h, x:x+w] #1

wcqrwtqr opened this issue Feb 24, 2018 · 8 comments

Comments

@wcqrwtqr
Copy link

Hi,
I've been trying to run the python files on my mac but every time I face the same error.

File "create_gestures.py", line 64, in store_images
imgCrop = img[y:y+h, x:x+w]

File "fun_util.py", line 53, in recognize
imgCrop = img[y:y+h, x:x+w]
TypeError: 'NoneType' object is not subscriptable

File "recognize_gesture.py", line 96, in recognize
imgCrop = img[y:y+h, x:x+w]
TypeError: 'NoneType' object is not subscriptable

What do you think might be the issue

@wcqrwtqr
Copy link
Author

screen shot 2018-02-24 at 10 50 52 pm

@ghost
Copy link

ghost commented Feb 25, 2018

I believe the issue lie in the function cv2.VideoCapture(1). Have you check your camera driver in Mac was installed properly or did you use the correct device?

@wcqrwtqr
Copy link
Author

Hello pvqthang,

I've been working with openCV library in other projects and cv2.videocapture() was working fine in all of them.

@EvilPort2
Copy link
Owner

Read the docs of the VideoCapture method of OpenCV. You will be able to solve the error.

@ghost
Copy link

ghost commented Feb 26, 2018

Try cv2.videocapture(0), the system will use your default camera on your pc and it should work

@prakharcode
Copy link

@EvilPort2 As a matter of good coding practice you might want to catch exception for hardware dependencies.

@EvilPort2
Copy link
Owner

The bug has been fixed

@adyegora
Copy link

How did you fix the problem? I'm also having the same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants