-1

How can i separate the image as a three region(dark, mid, bright)?any matlab commands are available for that?

1 Answers1

0

The image processing toolbox has some options for segmenting images based on color. More information here. If you only need to select pixels based on intensity you can use Boolean operators. Here's an example of that approach:

% create an example image with three regions of intensity
im = ones(100,100);
im(1:25, 1:30) = 256;
im(75:end, 7:end) = 128;
% add some random noise
im = im + 10*rand(size(im));

% display image
figure
subplot(2,2,1)
image(im)
colormap gray

% segment image based on intensity
bottomThird = 256/3;
topThird = 2*256/3;
index1 = find(im < bottomThird);
index2 = find(and((im > bottomThird),(im <topThird)));
index3 = find(im > topThird);

%create images for each segmented region
im1 = ones(size(im));
im2 = ones(size(im));
im3 = ones(size(im));
im1(index1) = 0;
im2(index2) = 0;
im3(index3) = 0;

%display sub-regions
subplot(2,2,2)
imagesc(im1)
subplot(2,2,3)
imagesc(im2)
subplot(2,2,4)
imagesc(im3)
Molly
  • 13,240
  • 4
  • 44
  • 45