How to apply image labeling algorithm using neighborhood values?
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
How do I prodcue an image using neighbourhood 3 x 3, median value ? I cannot see where i am going wrong. Help much appreciated. Peter
Im = imread('Ruben Weg hl.jpg'); % input image
S = size(Im); %size of image X & Y
%NewImage = zeros(size(Im));
%[row,column,depth]=size(Im);
%I need to put something in here
for Tl=1:size(Im,1)
Th=1:size(Im,2)
pixel=Im(Tl,Th);
% p = Im(m) /9
%Im(:,:,1)
V = Im(m)/9; %pixel values of p neighborhood //9 values
m = median(V); %//Median value of V
V = m(:,:,1);
if Im(p) >= Th && Im(p) > m
Bi(p) = 1;
else ifIm(p) >= Th || (Im(p) > Tl && Im(p) > m)
Bi(p) = 2;
else
Bi(p) = 3;
end
end
end
subplot (1,1,1)
imshow(Im);
title('output');
0 comentarios
Respuestas (1)
Image Analyst
el 8 de Jun. de 2020
Well for one, m is not defined when you use it as an index to your image Im.
V = Im(m)/9; %pixel values of p neighborhood //9 values
Also if you're doing it manually, you'd need 2 for loops, not one. And we'd need to know if the image is color or not.
And why not simply use the built-in function medfilt2()???
Also, do you know that you can type control-a, control-i in the MATLAB editor to fix your indenting. Can you do that and edit your post with the fixed indenting so people can read it.
1 comentario
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!