Stefan Florea
Stefan Florea

Reputation: 11

Detect Hand using OpenCV

I want to use openCV to detect when a person raises or lowers a hand or both hands. I have looked through the tutorials provided by python opencv and none of them seem to do the job. There is a camera that sits in front of the 2 persons, about 50cm away from them(so you see them from the waist up). The person is able to raise or lower each arm, or both of the arms and I have to detect when they do that.(the camera is mounted on the bars of the rollercoaster; this implies that the background is always changing)

How can I detect this in the fastest time possible? It does not have to be real time detection but it does not have to be more than 0.5seconds. The whole image is 640x480. Now, since the hands can appear only in the top of the image, this would reduce the search area by half => 640x240. This would reduce to the problem of searching a certain object(the hands) in a constantly changing background.

Thank you, Stefan F.

Upvotes: 1

Views: 3727

Answers (1)

OpenI
OpenI

Reputation: 45

You can try the very basic but so effective and fast solution: on the upper half of the image:

  1. canny edge detection
  2. morphologyEx with adequate Structuring element(also simple combination of erode/dilate may be enough)
  3. convert to BW using adaptive threshold
  4. Xor the result with a mask representing the expected covered area.
  5. The number of ones returned by xor in each area of the mask is the index that you should use.

This is extremely fast, you can make more than one iteration within the 0.5 sec and use the average. also you may detect faces and use them to adapt the position of your mask, but this will be more expensive :)

hope that helps

Upvotes: 1

Related Questions