2

My primary motive is to detect hand from simple RGB images (images from my webcam ). I found a sample code find_hand_point

    function [result, depth] = find_hand_point(depth_frame)

    % function result = find_hand_point(depth_frame)
    %
    % returns the coordinate of a pixel that we expect to belong to the hand.
    % very simple implementation, we assume that the hand is the closest object
    % to the sensor.

    max_value = max(depth_frame(:));
    current2 = depth_frame;
    current2(depth_frame == 0) = max_value;
    blurred = imfilter(current2, ones(5, 5)/25, 'symmetric', 'same');
    minimum = min(blurred(:));
    [is, js] = find(blurred == minimum);
    result = [is(1), js(1)];
    depth = minimum;

The result variable is the co-ordinate of the nearest thing to the camera (the hand).

A depth image from kinect device was passed to this function and the result is as:

http://img839.imageshack.us/img839/5562/testcs.jpg

the green rectangle shows the closest thing to the camera (the hand).

PROBLEM:

  1. The images that my laptop camera captures are not Depth images but are simple RGB images.
  2. Is there a way to convert my RGB images to those depth images ?
  3. Is there a simple alternative technique to detect hand ?
Peter Fren
  • 93
  • 3
  • 9
Khurram W. Malik
  • 2,660
  • 2
  • 20
  • 27
  • 1
    This [link](http://www.cs.washington.edu/rgbd-dataset/software.html) has too much inform but hope you find some direction. but I do remember we used an inhouse library to convert most cam pics into depths for image processing. I'll post – bonCodigo Nov 24 '12 at 15:15
  • Thanks pal :) It would be great help if I can really create those 24-bit depth images out of my 24-bit RGB images .. Kindly refer me to the library and its functions which can help !! – Khurram W. Malik Nov 24 '12 at 15:22
  • the link u gave is focusing primarily on converting From depth image not To depth images – Khurram W. Malik Nov 24 '12 at 15:24
  • 1
    Sorry just noticed my post was incomplete. hThere is one here in stack on similar basis. [link](http://stackoverflow.com/questions/13296059/kinect-converting-from-rgb-coordinates-to-depth-coordinates) apology I am unable to access the lin files anymore... The above link is on totally different technology all together. But what if you could use some other technology to convert your RGB to depths and then use those in your app – bonCodigo Nov 24 '12 at 15:55
  • It is not that I just posted above without putting any thought of interop ability. +1 it is a good reasonable question you have. – bonCodigo Nov 24 '12 at 16:13
  • check Alex Cohn answer he has given a fair reason and I am inclined to it too :) – Khurram W. Malik Nov 24 '12 at 17:19

3 Answers3

1

A much simpler approach can be found in http://www.andol.info/hci/830.htm

There the author converts the rgb image to hsv, and he just keeps specific ranges of the H, S and V values, that he assumes that are hand-like colors.

In Matlab:

function [hand] = get_hand(rgb_image) 
    hsv_image = rgb2hsv(rgb_image) 
    hand = ( (hsv_image(:,:,1)>= 0) & (hsv_image(:,:,1)< 20) ) & ( (hsv_image(:,:,2)>= 30) & (hsv_image(:,:,2)< 150) ) & ( (hsv_image(:,:,3)>= 80) & (hsv_image(:,:,3)< 255) ) 
end

the hand=... will give you a matrix that will have 1s in the pixels where

0 <= H < 20 AND 30 <= S < 150 AND 80 <= V < 255

etzourid
  • 331
  • 4
  • 18
  • Yeah I have gone through this already :p I m actually using java opencv and matlab already for my app combining in C code would create mess, I would appreciate if you could suggest sumthing accordingly. – Khurram W. Malik Nov 24 '12 at 15:29
  • Woah :p after the conversion of rgb to hsv what are you trying to do.. Please edit your original answer and give a proper formatted code there :) – Khurram W. Malik Nov 24 '12 at 17:17
1

Kinect uses extra sensors to retrieve the depth data. There is not enough information in a single webcam image to reconstruct a 3D picture. But it is possible to make far-reaching estimates based on a series of images. This is the principle behind XTR-3D and similar solutions.

Alex Cohn
  • 56,089
  • 9
  • 113
  • 307
0

A better technique I found to detect hand via skin color :)

http://www.edaboard.com/thread200673.html

Khurram W. Malik
  • 2,660
  • 2
  • 20
  • 27