combine Horizontal and vertical edge enhanced images

2 次查看(过去 30 天)
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