if you know the answer please help me immediately.i am a student and i am at first step of my research.thanks.
combine Horizontal and vertical edge enhanced images
2 views (last 30 days)
Show older comments
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.
Accepted Answer
Image Analyst
on 16 Sep 2013
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 Comments
Image Analyst
on 16 Sep 2013
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
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!