Finding high intensity region by multiple histograms?

1 次查看(过去 30 天)
Dear Readers,
I have splitted an image into 4 parts, and calculated histograms for each image channel seprately, then drew it on single plotting figure. Is there any way to compare these multiple histograms and select the more intense region automatically from the input color image.Thqnks
clear all;
close all;
I=imread('trees.jpg');
subplot 331
imshow(I);
[r c p]= size(I);%r-rows,c-columns,p-planes
A=I(1:r/2,1:c/2,:);
B=I(1:r/2,c/2+1:c,:);
C=I(r/2+1:r,1:c/2,:);
D=I(r/2+1:r,c/2+1:c,:);
tic
subplot 332
imshow(A);
title('A');
subplot 333
imshow(B);
title('B');
subplot 334
imshow(C);
title('C');
subplot 335
imshow(D);
title('D');
subplot 336
Red = A(:,:,1);
Green = A(:,:,2);
Blue = A(:,:,3);
%Get histValues for each channel
[yRed, x] = imhist(Red);
[yGreen, x] = imhist(Green);
[yBlue, x] = imhist(Blue);
%Plot them together in one plot
plot(x, yRed, 'Red', x, yGreen, 'Green', x, yBlue, 'Blue');
title('Histogram of A ', 'FontSize', 8);
subplot 337
Red = B(:,:,1);
Green = B(:,:,2);
Blue = B(:,:,3);
%Get histValues for each channel
[yRed, x] = imhist(Red);
[yGreen, x] = imhist(Green);
[yBlue, x] = imhist(Blue);
%Plot them together in one plot
plot(x, yRed, 'Red', x, yGreen, 'Green', x, yBlue, 'Blue');
title('Histogram of Cover B ', 'FontSize', 8);
subplot 338
Red = C(:,:,1);
Green = C(:,:,2);
Blue = C(:,:,3);
%Get histValues for each channel
[yRed, x] = imhist(Red);
[yGreen, x] = imhist(Green);
[yBlue, x] = imhist(Blue);
%Plot them together in one plot
plot(x, yRed, 'Red', x, yGreen, 'Green', x, yBlue, 'Blue');
title('Histogram of Cover C ', 'FontSize', 8);
subplot 339
Red = D(:,:,1);
Green = D(:,:,2);
Blue = D(:,:,3);
%Get histValues for each channel
[yRed, x] = imhist(Red);
[yGreen, x] = imhist(Green);
[yBlue, x] = imhist(Blue);
%Plot them together in one plot
plot(x, yRed, 'Red', x, yGreen, 'Green', x, yBlue, 'Blue');
title('Histogram of Cover D ', 'FontSize', 8);
toc;
8.jpg

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Histograms 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by