Thursday, June 23, 2011

The Euclidean Distance/Vector Angle Edge Detector (DRAFT)

This Edge detector makes use of color information to detect edges. Where most edge detectors use only intensity, this edge detector also considers hue and saturation.
Algorithm for Euclidean Distance/Vector Angle Edge Detector:
  • For each pixel in the image, take the 3×3 window of pixels around it.
  • Calculate the saturation-based combination of the Euclidean distance and Vector Angle between the center pixel and each pixel on the ring of the 3×3 window.
  • Assign the largest value obtained to the center pixel.
  • Apply a threshold to the image to eliminate false edges
So here is the result of the edges found by Euclidean distance
We use a vector Gradient edge detector which is a 3×3 mask. Find E_vg the euclidean distance operator

R = double(I1(:,:,1));
G = double(I1(:,:,2));
B = double(I1(:,:,3));
I_size = size(I1(:,:,1));
 
 
E_vg = zeros(I_size(1),I_size(2));
for y=2:(I_size(1)-1),
for x=2:(I_size(2)-1),
for i=-1:1,
for j=-1:1,
ED = sqrt((R(y+i,x+j)-R(y,x))^2 + (G(y+i,x+j)-G(y,x))^2 + (B(y+i,x+j)-B(y,x))^2);
if ED > E_vg(y,x)
E_vg(y,x) = ED;
end
end
end
end
end
 
Run the resulting E_vg through a threshold

ED_thresh = 45.0; //Change for Testing upto 255
ED_edges = zeros(I_size(1),I_size(2));
for y=1:I_size(1),
for x=1:I_size(2),
if E_vg(y,x) > ED_thresh
ED_edges(y,x) = 255;
end
end
end


Threshold of 45


Threshold of 80


Threshold 200