How can I use lorentzian norm in 2D gray scale image segmentation?
Show older comments
I'm working on 2D image segmentation & I want to refine the image with lorentz as a preprocessing operation.
lorentzian norm equation is:
f(x)= sum(log(1+0.5(x/T))), where "x" is a distance.
my problem is how can I calculate the distance "x".
is it the distance between center pixel and just one neighbor?
or it's the distance between this pixel and its 8-neighbors?
"or is it the maximum or minimum distance"?
thanks
Accepted Answer
More Answers (1)
Image Analyst
on 7 Sep 2013
0 votes
I have no idea. If you don't either, then why are you so sure you want to do it?
17 Comments
Rasha
on 7 Sep 2013
Image Analyst
on 7 Sep 2013
That didn't answer the question. So WHY do you think you need it? I guess that you're trying to follow some paper that uses it. If so, then doesn't the paper tell you what x and T are? And tell you why this operation is needed, and what you're supposed to do with f(x) once you've constructed it?
Rasha
on 7 Sep 2013
Image Analyst
on 7 Sep 2013
Sorry I can't help you http://matlab.wikia.com/wiki/FAQ#Can_you_program_up_the_algorithm_in_this_article_for_me_and_explain_it_to_me.3F. Perhaps the authors will help.
Image Analyst
on 7 Sep 2013
Edited: Image Analyst
on 7 Sep 2013
grayImage = imread('cameraman.tif');
grayImage = im2double(grayImage);
J = zeros(size(grayImage)); % Output
[rows, columns] = size(grayImage);
f = zeros(1,8);
T = 50;
for i = 2 : rows-1
for j = 2 : columns-1
cp=grayImage(i,j);
np=grayImage(i-1,j);
sp=grayImage(i+1,j);
wp=grayImage(i,j-1);
ep=grayImage(i,j+1);
nwp=grayImage(i-1,j-1);
nep=grayImage(i-1,j+1);
swp=grayImage(i+1,j-1);
sep=grayImage(i+1,j+1);
x(1) = (np-cp) ;
x(2) = (nwp-cp)/1.4;
x(3) = (nep-cp)/1.4 ;
x(4) = (sp-cp);
x(5) = (swp-cp)/1.4;
x(6) = (sep-cp)/1.4;
x(7) = (wp-cp);
x(8) = (ep-cp);
f = abs(log(1+0.5*(x/T) .^ 2));
J(i,j) = sum(f(:));
end
end
imshow(J, [])
% Enlarge figure to full screen.
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);
Rasha
on 7 Sep 2013
Image Analyst
on 7 Sep 2013
What does it do though? It looks like an edge detector. Is that what you wanted? You could probably speed it up even more though clever use of the conv2() function.
Rasha
on 7 Sep 2013
Image Analyst
on 8 Sep 2013
Please accept my answer since I finally got it working for you.
Image Analyst
on 8 Sep 2013
They don't have that functionality (yet), though many have been asking for it.
Youssef Khmou
on 8 Sep 2013
rasha, the problem is solved, if you posted the code at the first time it would easier to make suggestions. Unaccept my response and accept the other answer ,
good luck
Image Analyst
on 8 Sep 2013
Rasha
on 8 Sep 2013
Edited: Image Analyst
on 8 Sep 2013
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!