Technical discussion about Matlab and issues related to Digital Signal Processing.
Post a new Thread
image segmentation - moon moon - Jan 29 23:12:00 2006
Hello everyone,
Am a beginer with matlab so i do need your help to get
started,
I have a 64x64 image in gray scale, i already
extracted the histogram (nbr of pixels, intecities
(0-255)), I selected some intencities inorder to
segment a specific region ,
I want to know how to create a function inorder to
segment specific intencities and apply the
segmentation to the original image, and finaly show
the original image and the segmented image
Thank you very much for your help
regards
Moon

(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )
Re: image segmentation - Euphoria Stone - Jan 31 1:12:00 2006
Hi,
Because your image is a matrix, you can go through the
entire image, specify a single (or multiple)
intensity, and then threshold your image so that the
desired intensities come out white and the rest of the
image remains black.
Use the following code:
%---------------------------------------------------------
% This will get image dimensions
[m n]=size(img);
% make an empty black image, this will be your
segmented image
im_segment=zeros(m,n);
% Desired intensity-This is just an eg, you can
specify any value
threshold=128;
% Loop through entire image
for i=1:m
for j=1:n
if( img(i,j)>=threshold)
im_segment(i,j)=1;
end
end
end
% To display side by side
figure,subplot(1,2,1); imshow(img); title('Original');
subplot(1,2,2);imshow(im_segment); title('Segmented');
%--------------------------------------------------------------
If you want to get multiple intensities, just add
those in the IF statement.
--- moon moon <moon_ab2000@moon...> wrote:Hi,
> Hello everyone,
> Am a beginer with matlab so i do need your help to
> get
> started,
> I have a 64x64 image in gray scale, i already
> extracted the histogram (nbr of pixels, intecities
> (0-255)), I selected some intencities inorder to
> segment a specific region ,
> I want to know how to create a function inorder to
> segment specific intencities and apply the
> segmentation to the original image, and finaly show
> the original image and the segmented image
>
> Thank you very much for your help
> regards
> Moon

(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )