From: snehal d on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <bf729fda-9368-4072-8e14-e8ea12c3721f(a)o24g2000vbo.googlegroups.com>...
> Anyway, if you don't have nlfilter or blockproc, just write it
> yourself. The dumb, brute force method is just 4 nested for loops -
> very trivial.


rgb=imread(a.jpg);
gry=rgb2gray(rgb);
can=(gry,'canny');
[m,n]=size(can);
%dilate
for col = 1:n
for row = 1:m
x1 = col - windowSize/2
x2= col + windowSize/2
y1 = row - windowSize/2
y2 = row + windowSize/2
op(row, col) = max(max(can(y1:y2, x1:x2)));
op(row,col)=1;
end
end
From: snehal d on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <bf729fda-9368-4072-8e14-e8ea12c3721f(a)o24g2000vbo.googlegroups.com>...
> Anyway, if you don't have nlfilter or blockproc, just write it
> yourself. The dumb, brute force method is just 4 nested for loops -
> very trivial.

rgb=imread(a.jpg);
gry=rgb2gray(rgb);
can=(gry,'canny');
[m,n]=size(can);
%dilate
for col = 1:n
for row = 1:m
x1 = col - windowSize/2
x2= col + windowSize/2
y1 = row - windowSize/2
y2 = row + windowSize/2
op(row, col) = max(max(can(y1:y2, x1:x2)));
op(row,col)=1;
end
end

the above code is not working... i don no whelther wat i have written is correct or wrong.....
From: ImageAnalyst on
You almost had it but you didn't calculate the starting and ending
rows and columns correctly, and you were setting the value to 1 all
the time for some reason, instead of to the max value like I said.
Here is improved code:

clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear all; % Erase all existing variables.
workspace; % Make sure the workspace panel is showing.
fontSize = 18;

% Read in standard MATLAB color demo image.
rgbImage = imread('onion.png');
[rows columns numberOfColorBands] = size(rgbImage);
subplot(2, 2, 1);
imshow(rgbImage, []);
title('Original color Image');
set(gcf, 'Position', get(0,'Screensize')); % Maximize figure.

grayImage = rgb2gray(rgbImage);
subplot(2, 2, 2);
imshow(grayImage, []);
title('Converted to gray scale');

cannyImage = edge(grayImage,'canny');
subplot(2, 2, 3);
imshow(cannyImage, []);
title('Canny Edge Image');

% Morphological dilation is the local max.
windowSize = 5;
halfWidth = floor(windowSize/2);
dilatedImage = zeros(rows, columns);
for col = (halfWidth+1) : columns - halfWidth
x1 = col - halfWidth;
x2= col + halfWidth;
for row = (halfWidth+1) : rows - halfWidth
y1 = row - halfWidth;
y2 = row + halfWidth;
dilatedImage(row, col) = max(max(cannyImage(y1:y2, x1:x2)));
end
end


subplot(2, 2, 4);
imshow(dilatedImage, []);
caption = sprintf('Canny image dilated with a window size of %d',
windowSize);
title(caption);

From: snehal d on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <29d4f42a-b486-4d2c-9c9b-022b1b0ddb8a(a)u31g2000yqb.googlegroups.com>...
> You almost had it but you didn't calculate the starting and ending
> rows and columns correctly, and you were setting the value to 1 all
> the time for some reason, instead of to the max value like I said.
> Here is improved code:
>
> clc; % Clear the command window.
> close all; % Close all figures (except those of imtool.)
> clear all; % Erase all existing variables.
> workspace; % Make sure the workspace panel is showing.
> fontSize = 18;
>
> % Read in standard MATLAB color demo image.
> rgbImage = imread('onion.png');
> [rows columns numberOfColorBands] = size(rgbImage);
> subplot(2, 2, 1);
> imshow(rgbImage, []);
> title('Original color Image');
> set(gcf, 'Position', get(0,'Screensize')); % Maximize figure.
>
> grayImage = rgb2gray(rgbImage);
> subplot(2, 2, 2);
> imshow(grayImage, []);
> title('Converted to gray scale');
>
> cannyImage = edge(grayImage,'canny');
> subplot(2, 2, 3);
> imshow(cannyImage, []);
> title('Canny Edge Image');
>
> % Morphological dilation is the local max.
> windowSize = 5;
> halfWidth = floor(windowSize/2);
> dilatedImage = zeros(rows, columns);
> for col = (halfWidth+1) : columns - halfWidth
> x1 = col - halfWidth;
> x2= col + halfWidth;
> for row = (halfWidth+1) : rows - halfWidth
> y1 = row - halfWidth;
> y2 = row + halfWidth;
> dilatedImage(row, col) = max(max(cannyImage(y1:y2, x1:x2)));
> end
> end
>
>
> subplot(2, 2, 4);
> imshow(dilatedImage, []);
> caption = sprintf('Canny image dilated with a window size of %d',
> windowSize);
> title(caption);

Thank you...