Have I done something wrong with this code for edge detection on extreme gradient value
이전 댓글 표시
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
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Object Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!