From: Alex Jin on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <f81083ce-09e9-4bb9-9d8b-03df61595641(a)30g2000yqi.googlegroups.com>...
> Well if you want to find the first and last rows (or columns) that
> have a 1 in them, don't you need to check which rows have a 1 in
> them? Think about it. How would you do it? If you can't figure it
> out then study the demo below:
>
> clc;
> % Read in standard MATLAB grayscale demo image.
> grayImage = double(imread('moon.tif'));
> subplot(2, 2, 1);
> imshow(grayImage, []);
> title('Original Grayscale Image');
> set(gcf, 'Position', get(0,'Screensize')); % Maximize figure.
>
> binaryImage = grayImage > 100;
> subplot(2, 2, 2);
> imshow(binaryImage, []);
> title('Binary Image');
> col1 = find(any(binaryImage, 1), 1, 'first')
> col2 = find(any(binaryImage, 1), 1, 'last')
> row1 = find(any(binaryImage, 2), 1, 'first')
> row2 = find(any(binaryImage, 2), 1, 'last')
> boxX = [col1 col2 col2 col1 col1];
> boxY = [row1 row1 row2 row2 row1];
> hold on
> plot(boxX, boxY, 'r-', 'LineWidth', 2);
>
> croppedImage1 = imcrop(grayImage, [col1, row1, (col2-col1+1) (row2-
> row1+1)]);
> subplot(2, 2, 3);
> imshow(croppedImage1, []);
> title('Cropped Gray Image');
>
> croppedImage2 = imcrop(binaryImage, [col1, row1, (col2-col1+1) (row2-
> row1+1)]);
> subplot(2, 2, 4);
> imshow(croppedImage2, []);
> title('Cropped Binary Image');

Thank you so much.. i understand more.. but by using this way i cant really crop out the wanted area of my image..
This link shows an example image i would like crop. the area i want is in red:
http://www.postimage.org/image.php?v=TskFOOJ

As i can see, the area i wanted to crop has a rougher surface, anyway i can use this to crop out the image? thanks
From: Alex Jin on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <d4a50311-409e-4328-a719-6eae29475f2b(a)y3g2000vbg.googlegroups.com>...
> Cropping is not your problem. You aren't even close to segmenting
> your region of interest. That is too complicated an image to do
> simple thresholding on. You need to figure out how to get that first,
> before you start thinking about cropping.


Get the values across the middle of the image and high pass or band pass it..? Do u have any example code for band pass and thresholding operation? thanks
From: Alex Jin on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <d4a50311-409e-4328-a719-6eae29475f2b(a)y3g2000vbg.googlegroups.com>...
> Cropping is not your problem. You aren't even close to segmenting
> your region of interest. That is too complicated an image to do
> simple thresholding on. You need to figure out how to get that first,
> before you start thinking about cropping.

i had covert the image to greyscale and then

plot(Image(200,:))

gives a graph.. i would like to use a high pass filter.. any example codes for that? thanks