Do they belong to you? Claim these comments.
Jhon
Is this you? Claim Profile »
9 months ago
in Fun with Python, OpenCV and face detection on In Traction
I figured it out how to properly use cvWaitKey.
In your code you are waiting just 10 ms for a key, and only after the image was processed.
So, if you wait a little bit longer(maybe 100ms, but this will slow down a lot the fps) you will be able to catch the keys.
However, there is also another problem cvWaitKey returns -1 when no key was pressed, but return a string(char) holding the key pressed, so you need to do the following:
if k!=-1 and ord(k) == 0x1b: # ESC
print 'ESC pressed. Exiting ...'
break
In your code you are waiting just 10 ms for a key, and only after the image was processed.
So, if you wait a little bit longer(maybe 100ms, but this will slow down a lot the fps) you will be able to catch the keys.
However, there is also another problem cvWaitKey returns -1 when no key was pressed, but return a string(char) holding the key pressed, so you need to do the following:
if k!=-1 and ord(k) == 0x1b: # ESC
print 'ESC pressed. Exiting ...'
break
1 reply
Jo Vermeulen
Ah thanks, that's very helpful!
9 months ago
in Small update on face detection post on In Traction
Could you upload your sources, I really want to learn DBUS and py-notify?
Besides, it looks really nice your software, I would like to have a copy.
Besides, it looks really nice your software, I would like to have a copy.
1 reply
Jo Vermeulen
When I find some time to do so, I surely will. For learning D-Bus, you can already have a look at the source code for PydgetRFID.