Have I done something wrong with this code for edge detection on extreme gradient value
Show older comments
I have first translated from RGB to HSV and separated to hue and saturation and intensity component h(i,j),s(i,j),v(i,j)
5*5 boundary detection operator window with original image f(i,j) and the central pixel of the window (i,j) is the boundary pixel to be detected,(x,y) is one of the eight neighborhood pixels of the central pixel
the central pixel's hue saturation and brightness in the direction of theta(0 to 315 with 45 degree spacing each) are defined as:
hθ(i, j)= h(x, y)-h(i, j)
sθ(i, j)= s(x, y-s (i, j)
vθ(i, j)=v(x, y)-v(i, j)
w=[1,1,1,1,1;1,1,1,1,1;1,1,-24,1,1;1,1,1,1,1;1,1,1,1,1];
gradient is
gθ(i, j)= hθ(x, y)+ sθ(i, j)+ vθ(x, y);
code
function g=exgradient(hsv)
hsv=rgb2hsv(rgb);
h=hsv(:,:,1);
s=hsv(:,:,2);
v=hsv(:,:,3);
theta=1:45:315
w=[1,1,1,1,1;1,1,1,1,1;1,1,-24,1,1;1,1,1,1,1;1,1,1,1,1];
for i=1:183
for j=1:276
h(theta)*(i,j)=h(x,y)-h(i,j);
s(theta)*(i,j)=s(x,y)-s(i,j);
v(theta)*(i,j)=v(x,y)-v(i.j);
end
end
Accepted Answer
More Answers (0)
Categories
Find more on Object Analysis in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!