combine Horizontal and vertical edge enhanced images

조회 수: 2 (최근 30일)
mahesh chathuranga
mahesh chathuranga 2013년 9월 16일
I have two images of vertically & horizontally edge enhanced.I have obtained those results from following codes. gray_I=mat2gray(I); V=(-1*diff(gray_I)); H=(-1*(diff(gray_I'))'); H(:,end+1)= H(:,end); V(end+1,:)= V(end,:); H & V images gives the minus values also.I have combined H & V images using imadd(H,V); function.but the out put is not good. I dont know how the images are handle in matlab.my method is o.k or not? is unexpected results were due to minus valus? should any step add to this? please help me.
  댓글 수: 1
mahesh chathuranga
mahesh chathuranga 2013년 9월 16일
if you know the answer please help me immediately.i am a student and i am at first step of my research.thanks.

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

채택된 답변

Image Analyst
Image Analyst 2013년 9월 16일
There are built in functions for that. See imgradient() or conv2(). Write back if you have trouble.
[Gmag,Gdir] = imgradient(grayImage,method);
kernel = [-1,-1,-1;-1,8,-1;-1,-1,-1]/8;
laplacian = conv2(double(grayImage), kernel, 'same');
  댓글 수: 2
mahesh chathuranga
mahesh chathuranga 2013년 9월 16일
thanks mr. i'm trying to do this with out built in functions like imgradient() or conv2.I want to know my method is correct or not.is any step should add to my codes.
Image Analyst
Image Analyst 2013년 9월 16일
No, because it uses diff() - a built-in function. You're going to have to have two nested for loops where you scan every pixel and look at its eight neighbors.
for row = 2 : rows-1
for col = 2 : columns-1
for r = -1:1
for c = -1:1
% Code to calc diff between grayImage(row,column) and grayImage(row+r, col+c)
end
end
end
end

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

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by