combine Horizontal and vertical edge enhanced images

2 Ansichten (letzte 30 Tage)
mahesh chathuranga
mahesh chathuranga am 16 Sep. 2013
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 Kommentar
mahesh chathuranga
mahesh chathuranga am 16 Sep. 2013
if you know the answer please help me immediately.i am a student and i am at first step of my research.thanks.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Image Analyst
Image Analyst am 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 Kommentare
mahesh chathuranga
mahesh chathuranga am 16 Sep. 2013
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 am 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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by