自适应对比度增强(ACE)

时间:2013-03-22 08:48:56

标签: matlab-guide

如何将图像分成三个区域(黑暗,中间,明亮)?任何matlab命令都可用于此?

1 个答案:

答案 0 :(得分:0)

图像处理工具箱有一些基于颜色分割图像的选项。更多信息here。如果您只需要根据强度选择像素,则可以使用布尔运算符。以下是该方法的一个示例:

% 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)