can you help me? i want to show min and max value on RGB image with histogram, but is not work correctly?
5 次查看(过去 30 天)
显示 更早的评论
%this is my code, and error report
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/282739/image.jpeg)
[filename,pathname] = uigetfile({'*.jpg;*.bmp'},'Select an Image');
I = imread([pathname filename]);
imshow(I);
[bw, rgb]=hsvth(I);
figure, imshow(bw);
figure, imshow(rgb);
img1 = imcrop(rgb);
img2 = imcrop(rgb);
%imshow(img1);
%imshow(img2);
%I=imread('autumn.tif');
%Histogram
R=img1(:,:,1);
G=img1(:,:,2);
B=img1(:,:,3);
figure,
subplot(3,1,1)
imhist(R)
subplot(3,1,2)
imhist(G)
subplot(3,1,3)
imhist(B)
%R Value
red_min=min(min(R(:,:,1)))
red_max=max(max(R(:,:,1)))
%G Value
green_min=min(min(G(:,:,2)))
green_max=max(max(G(:,:,2)))
%B Value
blue_min=min(min(B(:,:,3)))
blue_max=max(max(B(:,:,3)))
0 个评论
采纳的回答
KSSV
2020-4-8
%R Value
red_min=min(R(:)) ;
red_max=max(R(:)) ;
%G Value
green_min=min(G(:)) ;
green_max=max(G(:)) ;
%B Value
blue_min=min(B(:)) ;
blue_max=max(B(:)) ;
Note that G, B are 1D matrices. So don't use 2 and 3. You need not to use min twice.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Histograms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!