image segmentation

Started by January 30, 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

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
threshold8;

% 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