hey guysI was playing aroudn with matlab and images, trying to make a very simple "edge detection" algorithmbasically.. i have a image of a solid 2D block (square).. I read the image and convert it to gray scale, then i go through each pixel in a loop, comparing each pixel with the one adjacent to it ( horizontally) , and if the difference in the values is greater than a threshold, i set that pixel to BLACK (0) , ELSE i set it to WHITE (255).. as to draw an outline on the sides of the block ( not top and bottom)however, when i try the code, I only get an outline on the RIGHT side of the block....i'm staring at the code and I know its something stupid but i can't seem to identify it ...
Rich (BB code):
clear ;
imagergb = imread('Block.jpg');
imagegray = rgb2gray(imagergb);
size = size(imagegray);
row = size(1);
column = size(2);
for i=1:row
for j=1:column-1
if (abs(imagegray(i,j+1) - imagegray(i,j)) > 100)
imagenew(i,j)= 0;
else
imagenew(i,j) = 255;
end
end
end
imshow(imagergb)
pause(5)
imshow(imagenew)