From: deep_inside Banco on
Hello!
I have a problem about an image's segmentation
I must recognize in an image if the hand is a rock, a paper or a scissors
At this link you can download images
http://www.megaupload.com/?d=CU4CZ67N
I have two cases: the first in which hands are over the table (look the image 'sassoforbicedifficile.png'), and the second in which the hands are over a black mousepad (look the image 'manifacile.png').
For each case i have an image of background without hands ('sfondodifficile.png' and sfondofacile.png').
In the first case i obtain an excellent segmentation (look the image 'segmenta.jpg'): i have convert the image from rgb to hsv e i make the difference between foreground and background ON ONLY the hue channel. After i make a treshold to obtain precious white regions.
My problem is this way isn't efficient with the second case!
Translating the image from rgb to hsv is worse!
I need a generic solution for two cases.
Can anybody help me ?

I'm sorry for my awful english!!
Thank you for your help!

Bye Bye
From: ImageAnalyst on
You make it too hard. I don't want to download some zip, specify some
folder to save it to, open the zip file to extract the images inside,
then open another application to view the image files, just to give an
opinion. Why can't you just upload the individual photos, say to
http://drop.io???

Anyway, I can't download it even if I wanted to because your web site
says "The file you are trying to access is temporarily unavailable."

So it's impossible at the moment for me to help you with meaningful
suggestions. Please try again.
From: deep_inside on
Ok, no problem :)
Thank you for your specification
I load images here http://img337.imageshack.us/gal.php?g=sfondofacile.png
Is it ok now? Do you see 5 images?

thank you for your interesting
bye bye
From: ImageAnalyst on
Yes I can see the images . . . but not your code. Post that if you
want anyone to try to improve it.
From: deep_inside on
This is the part of code that implements the first case

mani=imread('sassoforbicedifficile.png');
sfondo=imread('sfondodifficile.png');
sfondohsv=rgb2hsv(sfondo);
manihsv=rgb2hsv(mani);
diffhsv=abs(manihsv(:,:,1)-sfondohsv(:,:,1));
diffhsv=im2bw(diffhsv,0.1);
%result
% http://img30.imageshack.us/img30/6919/dopodiffhsv.jpg

closingMak=[1 1 1 1 1; 1 1 1 1 1; 1 1 1 1 1];
dilation=[0 1 1 0;1 1 1 1;0 1 1 0];
close=imclose(diffhsv,closingMak);
dil=imdilate(close,dilation);
close=imclose(dil,closingMak);
dil=close;

%result
% http://img697.imageshack.us/i/dilation.jpg/

L = bwlabel(dil);
%valore = elabframe(dil);
[B,L,N,A] = bwboundaries(dil);
sizeL=size(L);
for i = 1:N
hold on;
bordi = B{i};
%disegno bordi rossi della mano
plot(bordi(:,2), bordi(:,1),'r');
hold off;
end

%result
% http://img195.imageshack.us/img195/6987/regioni.jpg

this results, for me, are excellent.
The problem is that with the second case (using the same technique)

mani=imread('sassoforbicefacile.png');
sfondo=imread('sfondofacile.png');
sfondohsv=rgb2hsv(sfondo);
manihsv=rgb2hsv(mani);
diffhsv=abs(manihsv(:,:,1)-sfondohsv(:,:,1));
diffhsv=im2bw(diffhsv,0.1);
%result
% http://img684.imageshack.us/img684/3200/dopodiffhsvfacile.jpg

You can see that this method is awful for the second case.
I need a generic segmentation's method to using for both of them.
I try to using another color space, but i don't obtain better results.
For the second case I obtain an acceptable result using canny's algorith for edge's detection. It is the only method that mantain the arm in the second case, but the first case's result is terrible!
Do you suggest me a generic method for my 2 cases?
Thank you for your replay ;)

Bye Bye