Converting image to suitable form?

Hi there, I need some help here.
So, this image has to pass through a filter (Gabor Filter), and I figured out that the size of the image does affect the time taken for the process to complete. Thus, I tweaked a little with the dimension of the image prior to the filtering process and came up with 2 sets of output.
  1. Size of image (before passing it through the filter) unchanged. http://www.flickr.com/photos/jokerzy89/5862929339/sizes/l/in/photostream/
  2. Image resized to 256 by 256 (before filtering). http://www.flickr.com/photos/jokerzy89/5863480928/sizes/m/in/photostream/
Next, I intend to calculate the moments of these 2 images, however, I have no idea how to proceed. My guess is that these images have to be converted to that of type logical before I can calculate the respective moments.
Refer to this question that was asked yesterday: http://www.mathworks.com/matlabcentral/answers/10022-creating-2d-geometric-shapes I might need to thin the contour lines of the hand gesture.
To summarize things, I need help with manipulating the output images in such a way that the white edges are preserved. So, the new output would be something like white hand contour lines on a black background. Also, it is best that the contour lines be thinned.
Can anyone please help me? Thanks!

댓글 수: 2

Sean de Wolski
Sean de Wolski 2011년 6월 23일
Moment of whole hand or of fingers?
Jason
Jason 2011년 6월 23일
Hi Sean, it would be the whole hand.

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

 채택된 답변

Sean de Wolski
Sean de Wolski 2011년 6월 23일

1 개 추천

I personally always try to work a logical map of the target. This segments the hand and gives you a logical map and a map edge if you want that too.
%%Your image
I = imread('ans623.jpg');
%Image Map
[M Medge] = shrinkWrap(255-I(:,:,3),'objthresh',4500);
%check?
subplot(121),
imshow(I);
title('Original Image');
subplot(122)
imshow(bsxfun(@times,uint8(M),I));
title('Map applied');
%Do stuff with M.

댓글 수: 11

Jason
Jason 2011년 6월 23일
Sean, I appreciate your work, but may I add something? (I hope I could make myself understood as English is not my first language, I apologize if I am mistaken)
I tried 'doing stuff' with M, which was passing it through the (Gabor) filter, and I got this (call this output A).
http://www.flickr.com/photos/jokerzy89/5863831688/in/photostream
The purpose of using Gabor Filter is to extract the features of the hand, and this includes the lines (is 'lines' the correct word here?) between the fingers. Refer to this link. Call this output B. http://www.flickr.com/photos/jokerzy89/5862929339/sizes/l/in/photostream/
So, the difference is quite evident, for output A, I only got the contour lines of the hand (which is good), while for output B, I got the 'blurry' contour lines, including the desired lines between the fingers. That, in fact, is one of the objectives of using the filter, ie making it possible to detect the extra lines in between. Now, what I need is to transform B so that all the (extra & contour) lines would be appropriate for me to proceed to the next classification stage (I guess I need to convert image B to one of type logical, before the moment calculation comes into picture).
Refer to this link: http://en.wikipedia.org/wiki/File:ABC_pict.png
Note that for gesture M and N, the filtered images could both have contour lines that are quite similar to each other, that is why I am using Gabor Filter, in the hope that when I pass the input images through the filter, I would be able to differentiate the 2 outputs.
Sean de Wolski
Sean de Wolski 2011년 6월 23일
So then use a logical AND on the Map created by my function and the lines between the fingers. That's why I like having Maps!
Jason
Jason 2011년 6월 23일
Sean, can you please show me an example? I am having a hard time understanding all this map thingy.
Jason
Jason 2011년 6월 23일
By the way, may I add, the output of all the images are of type double, I do not know if there is a way to convert them to type logical so as to enhance the features (or lines) of the hand gestures. Maybe like thresholding or something?
Sean de Wolski
Sean de Wolski 2011년 6월 23일
Yes you threshold:
fingerlines = M&Gf_results>0.8; %example require lines to be in the map and on the gabor filter results value greater than 0.8. Remember to use imtool to select a threshold.
Jason
Jason 2011년 6월 23일
Sean, here's the outcome of the thresholding.
http://www.flickr.com/photos/jokerzy89/5864012740/in/photostream
Value of threshold = 0.25, 0.30, 0.35 respectively.
If you don't mind, take the 3rd image as an example, how do we connect the 'broken' contour lines?
Sean de Wolski
Sean de Wolski 2011년 6월 23일
connecting the broken contour lines is a VERY difficult challenge. You're better off coming up with a better way to identify them in the beginning.
Sean de Wolski
Sean de Wolski 2011년 6월 23일
look at imfilter or edge
imtool(edge(I(:,:,1),'sobel'))
Jason
Jason 2011년 6월 23일
Ok, thanks so much! I guess it's probably due to the condition of the input image. One last question for this whole thread (since it's beginning to deviate from the original question), in image pre-processing, what are the things that I should be aware of? Take this input image as an example: http://www.flickr.com/photos/jokerzy89/5862926331/sizes/l/in/photostream/ what do I need to 'clean up'? Any links/keywords will be helpful.
Sean de Wolski
Sean de Wolski 2011년 6월 23일
Depends on what you mean by clean up. My first goal in any image processing project is to make a map. That way further computations need only be applied to the parts I care about.
Jason
Jason 2011년 6월 23일
I don't know but I feel that it's too late to start with this map thingy. Maybe some other time, when my project is over. I am going to learn this. Thanks a ton!

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Convert Image Type에 대해 자세히 알아보기

태그

질문:

2011년 6월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by