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