What you want to do is called segmentation and is a big topic in image processing. Your image is quite nice, so if you have the image processing toolbox this is pretty easy. And even if you don't its still not that hard As Chris mentions, you should convert your image to double before doing anything with it.
If you have the image processing toolbox you can then use the function graythresh to find the best threshold level. Please note that you don't need to use for loops to do thresholding, in MATLAB you can threshold the entire matrix in one line be = im2double(b); %convert to double thresh_level = graythresh(b); %find best threshold level c = be > thresh_level; %do thresholding imshow(c) This gives you a binary image, where your fist has value 1 and the background label 0. To keep the fist as it was, we multiply the binary version with the original version.
Now the background is all zero, and the fist keeps its original values d = im2double(c). *b; %c is binary, so we need to convert it first imshow(d,) If you don't have the image processing toolbox you need to choose the threshold level manually. This can be a bit tricky.
You used 0.06, but graythresh suggests that 0.2980 is the best. I find that a good way to find the threshold value is to look at the histogram of the image hist(b(:),256) We can clearly see from the histogram that we have two clusters of points and that the any value between 2 and 3 would separate the clusters fairly well. So we should use a value in that interval to do thresholding.
What you want to do is called segmentation and is a big topic in image processing. Your image is quite nice, so if you have the image processing toolbox this is pretty easy. And even if you don't its still not that hard.As Chris mentions, you should convert your image to double before doing anything with it.
If you have the image processing toolbox you can then use the function graythresh to find the best threshold level. Please note that you don't need to use for loops to do thresholding, in MATLAB you can threshold the entire matrix in one line.Be = im2double(b); %convert to double thresh_level = graythresh(b); %find best threshold level c = be > thresh_level; %do thresholding imshow(c) This gives you a binary image, where your fist has value 1 and the background label 0. To keep the fist as it was, we multiply the binary version with the original version.
Now the background is all zero, and the fist keeps its original values. D = im2double(c). *b; %c is binary, so we need to convert it first imshow(d,) If you don't have the image processing toolbox you need to choose the threshold level manually.
This can be a bit tricky. You used 0.06, but graythresh suggests that 0.2980 is the best. I find that a good way to find the threshold value is to look at the histogram of the image.
256); We can clearly see from the histogram that we have two clusters of points and that the any value between 2 and 3 would separate the clusters fairly well.So we should use a value in that interval to do thresholding.
Hai even I tried a long code and got a similar image : – khadeejah Apr 23 at 17:57 @khadeejah: I think this answers your question, and you should accept it if it helped you. – d00b Apr 24 at 15:41 @doob ...how to accept the answer? Pls help me?
:( – khadeejah Apr 24 at 17:21.
A couple of problems I see: In your code you use g and f as loop counters, but you always access the be array as b(j,k). As well, the imread reads a uint8, so you can't really compare that to a double (0.06). So convert to a double via: b=im2double(b); Also, not a big deal in this case, but you dynamically grow c each loop iteration.
If the image is large, this will dramatically hinder the performanec of your code. Per allocate it via: c=ones(j,k); After these changes it produces something resembling your fist. However, because the background is not a uniform colour, it doesn't work overly well.
This part is outside my realm of experience...
Bt I want the palm to stay as it is . Here in hwatever you ve said its turned black ..:( So what to do now ..:( – khadeejah Apr 23 at 8:55 That is what your code does. Use Gjaul's answer, it's better.
I have no image analysis experience so all I could do was fix your code so it would "work". – Chris Apr 23 at 22:42 he he @chris ..thanks so much! :D yea ghauls really did the thing ..! :D – khadeejah Apr 24 at 17:24.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.