after if condition the value is not assigning, the default value 255 is coming
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Datti Nagadhara Harini
el 9 de En. de 2014
Comentada: Datti Nagadhara Harini
el 2 de Abr. de 2014
% seeded region growing algorithm %
clear all; clc;
I = imread('7.jpg');
Is = imresize(I,[256 256]);
Ig = rgb2gray(Is);
impixelinfo(imshow(Ig));
% determine how many clusters for an image %
c1 = 300; c2 = 500; c3 = 600;
%determine how many seed points u reqire%
p1 = 228;
p2 = 198;
p3 = 100;
%difference of pixel values of seed point to neighbouring pixels%
for i =1:256
for j =1:256
if abs(p1 - Ig(i,j)) <= 5
Ig(i,j) = 300;
elseif abs(p2 -Ig(i,j)) <= 5
Ig(i,j) = 600;
else
Ig(i,j) = 700;
end
end
end
0 comentarios
Respuesta aceptada
Image Analyst
el 9 de En. de 2014
This is not seed growing - nothing is growing. You are quantizing, which you can do like this without a loop
outputImage = 700 * ones(256,256, 'uint32'); % Initialize to all 700.
binaryImage = Ig >= (p1-5) & Ig <= (p1+5);
outputImage(binaryImage) = 300;
binaryImage = Ig >= (p2-5) & Ig <= (p2+5);
outputImage(binaryImage) = 600;
I have no idea where 255 is coming from - you don't even have a 255 in your code at all!
Más respuestas (0)
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!