I need to get a binary image of the fist (shown below).
I've tried using graythresh to get the threshold value, tried my own threshold values, used imgradient to get the edges and even used edge detection, but I can't seem to get a clear outline of the fist.
I'm using blob analysis for detecting the fist.
Can someone help me out? Really appreciate it!

답변 (1개)

Anand
Anand 2014년 3월 3일

0 개 추천

Try working in the HSV space. Here's what I got
I = imread('http://www.mathworks.com/matlabcentral/answers/uploaded_files/8923/gest2_7.jpg');
% Convert to HSV
I = rgb2hsv(I);
% Threshold based on hue
mask = I(:,:,1)>=0.023 & I(:,:,1)<=0.082;
% Cleanup mask
...
You'll need to play around with the thresholds some more and do some post-processing on the mask like filling holes and smoothing the boundaries.

댓글 수: 5

Shravanthi
Shravanthi 2014년 3월 3일
편집: Shravanthi 2014년 3월 3일
I'm really sorry, I forgot to mention that the picture is from video from the webcam, whose color space is set to gray scale. Is there any way of doing this without converting to hsv?
Image Analyst
Image Analyst 2014년 3월 3일
Why? Why are you not using color????
Shravanthi
Shravanthi 2014년 3월 3일
편집: Shravanthi 2014년 3월 3일
Um, because I have to detect other gestures, and blob analysis works fine for all of them, except this one. All the other images are in grayscale too. I just can't find a proper threshold value for this one.
Image Analyst
Image Analyst 2014년 3월 3일
Can you get better illumination of the background, so that you don't have such a severe gradient?
Shravanthi
Shravanthi 2014년 3월 4일
This was the best lighting we could get in the room where we have to show the project. The background is black cardboard. Is there something else I can do?

댓글을 달려면 로그인하십시오.

질문:

2014년 3월 3일

댓글:

2014년 3월 4일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by