Prev: Types of video file formats in Mat lab
Next: mex
From: Image Analyst on 10 Jul 2010 12:33 I believe he's wanting a cropped masked image, or a cropped gray image. In another post he gave the URL of his grayscale hand image, and some binary version of it. Now I think he wants either the grayscale image cropped out of the original, or a masked version of the grayscale image cropped out of the original. Going to binary is the first step (or could be), using whatever method works. Then you can find the bounding box (in code that I gave in his prior post). Then you can get a masked image by multiplying the binary image by the grayscale image: maskedImage = grayImage .* single(binaryImage); Then you can crop out the bounding box from the masked image croppedMaskedImage = imcrop(maskedImage, [row, col, width height]); You can also crop out the orginal (unmasked) grayscale portion if desired: croppedGrayImage = imcrop(grayImage, [row, col, width height]); You can also find the bounding box by summing or taking the mean of the gray image in the two directions and seeing where the intensity crosses some threshold. (Essentially, seeing there a values falls below or exceeds some threshold value is pretty much the same as binarizing the profile of the image.) If I've got it wrong, and you want some third option, then mock up something in Photoshop and post it.
From: Nehal on 10 Jul 2010 15:36 Walter Roberson <roberson(a)hushmail.com> wrote in message <ZI0_n.35320$YX3.13077(a)newsfe18.iad>... > Nehal wrote: > > "Image Analyst" <imageanalyst(a)mailinator.com> wrote in message > > <i19le9$kgv$1(a)fred.mathworks.com>... > >> Find the edges of the hand somehow, for example when the summed > >> profiles pass some threshold. verticalProfile = mean(imageArray, 2); > >> horizontalProfile = mean(imageArray, 1); > >> > >> row1 = find(verticalProfile > thresholdvalue, 1, 'first'); > >> row2 = find(verticalProfile > thresholdvalue, 1, 'last'); > > > Can you suggest some thresholdvalues...? > > Not germaine, as ImageAnalyst's method implicitly converts the image to > binary ('>' returns a binary result) and thus does not satisfy your > requirement that the image must not be converted to binary. Not that I > can think of a good reason why you would impose such a requirement as > long as your _output_ was full color, but I guess you have your reasons. yes.. actually i have converted my the image binary then cropped the object (in my case: hand) with the help of Image Analyst... then i had to do some more operations on that cropped image... finally... the hand was not recognized anymore... somehow i came to an idea that if i could crop the hand out first and then make it binary and then if i do my processing steps... the hand will be recognized... that's why i'm trying this...
From: Nehal on 10 Jul 2010 15:40 "Image Analyst" <imageanalyst(a)mailinator.com> wrote in message <i1a7c0$aih$1(a)fred.mathworks.com>... > I believe he's wanting a cropped masked image, or a cropped gray image. In another post he gave the URL of his grayscale hand image, and some binary version of it. Now I think he wants either the grayscale image cropped out of the original, or a masked version of the grayscale image cropped out of the original. Going to binary is the first step (or could be), using whatever method works. Then you can find the bounding box (in code that I gave in his prior post). Then you can get a masked image by multiplying the binary image by the grayscale image: > maskedImage = grayImage .* single(binaryImage); > Then you can crop out the bounding box from the masked image > croppedMaskedImage = imcrop(maskedImage, [row, col, width height]); > You can also crop out the orginal (unmasked) grayscale portion if desired: > croppedGrayImage = imcrop(grayImage, [row, col, width height]); > > You can also find the bounding box by summing or taking the mean of the gray image in the two directions and seeing where the intensity crosses some threshold. (Essentially, seeing there a values falls below or exceeds some threshold value is pretty much the same as binarizing the profile of the image.) > > If I've got it wrong, and you want some third option, then mock up something in Photoshop and post it. I do not think i am trying to crop a mask image... because mask will create some shades in the image.... i just want to crop the hand from the image i have posted in my first post here... and could you plz explain me how the "thresholdvalue" works here...? because I have managed to find the threshold value of the grayimage... bt i am confused how this works...?
From: Image Analyst on 10 Jul 2010 17:48 "Nehal " <arnab620(a)yahoo.com> wrote in message <i1aib5$4ra$1(a)fred.mathworks.com>... > and could you plz explain me how the "thresholdvalue" works here...? because I have managed to find the threshold value of the grayimage... bt i am confused how this works...? I'm not sure what you mean (again). You said you have managed to find the threshold. So you just threshold like this binaryImage = grayImage > thresholdValue; % or you can use < Then where the image is brighter than the threshold it will be true (1) and where it's less it will be false (0). What about this is confusing you? By the way, it doesn't make any difference if you crop and then binarize or binarize then crop, as long as the threshold value is the same. -ImageAnalyst
From: Nehal on 15 Jul 2010 14:31
"Image Analyst" <imageanalyst(a)mailinator.com> wrote in message <i1apqk$t9a$1(a)fred.mathworks.com>... > "Nehal " <arnab620(a)yahoo.com> wrote in message <i1aib5$4ra$1(a)fred.mathworks.com>... > > and could you plz explain me how the "thresholdvalue" works here...? because I have managed to find the threshold value of the grayimage... bt i am confused how this works...? > > By the way, it doesn't make any difference if you crop and then binarize or binarize then crop, as long as the threshold value is the same. > -ImageAnalyst yes.. it really doesn't make any difference... I was just trying it through a different way... nothing else... finally I have managed to do my work... I was not able to crop the gray image though... I converted the the RGB image to binary using a threshold value... it did work... bt I am not sure how it worked... could your plz make me clear one thing...? what is the difference between: binaryImage = im2bw(I, graythresh(I)); % I is the RGB Image array and binaryImage = grayImage == 255; % grayImage is the GRAY image of I Thanks. |