after if condition the value is not assigning, the default value 255 is coming
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Datti Nagadhara Harini
il 9 Gen 2014
Commentato: Datti Nagadhara Harini
il 2 Apr 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 Commenti
Risposta accettata
Image Analyst
il 9 Gen 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!
Più risposte (0)
Vedere anche
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!