필터 지우기
필터 지우기

Have I done something wrong with this code for edge detection on extreme gradient value

조회 수: 1 (최근 30일)
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

채택된 답변

Image Analyst
Image Analyst 2013년 2월 13일
Looks like 3x3 to me, not 5x5. Just have your kernel be
kernel = [-1 -1 -1;-1 8 -1;-1 -1 -1] / 9; % Average pixel difference.
edgeImage = conv2(double(grayImage), kernel, 'same'); % the filter.
  댓글 수: 1
Poonam
Poonam 2013년 2월 21일
Thanks,I have edited and have posted some code related to the question please help me out whether i am correct with my code

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by