Find max value on images
古いコメントを表示
How to find the max value of those punch of images




回答 (1 件)
Image Analyst
2021 年 4 月 20 日
What is a "punch" of images? And what is your definition of brightest for a color image? Do you just want to convert to gray scale and find the brightest? Something like (untested)
grayImage = rgb2gray(rgbImage);
maxValue = max(grayImage(:))
maxMap = grayImage == maxValue;
rgb2 = imoverlay(grayImage, maxMap);
imshow(rgb2);
11 件のコメント
Mohamed Elbeialy
2021 年 4 月 20 日
Image Analyst
2021 年 4 月 20 日
OK, then you're all set. Did you try it?
Mohamed Elbeialy
2021 年 4 月 20 日
Walter Roberson
2021 年 4 月 20 日
編集済み: Walter Roberson
2021 年 4 月 20 日
rgbImage = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/591002/image.jpeg');
grayImage = rgb2gray(rgbImage);
maxValue = max(grayImage(:))
maxMap = grayImage == maxValue;
R = grayImage;
G = grayImage;
B = grayImage;
R(maxMap) = 255;
G(maxMap) = 0;
B(maxMap) = 0;
rgb2 = cat(3,R,G,B);
image(rgb2);
nnz(maxMap)
[r,c] = find(maxMap);
[r(1), c(1)]
figure
image(rgb2); hold on
scatter(c, r, 'b*')
hold off
Mohamed Elbeialy
2021 年 4 月 20 日
rgbImage = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/591002/image.jpeg');
grayImage = rgb2gray(rgbImage);
maxValue = max(grayImage(:))
maxMap = grayImage == maxValue;
R = rgbImage(:,:,1);
G = rgbImage(:,:,2);
B = rgbImage(:,:,3);
R(maxMap) = 255;
G(maxMap) = 0;
B(maxMap) = 0;
rgb2 = cat(3,R,G,B);
image(rgb2);
nnz(maxMap)
[r,c] = find(maxMap);
[r(1), c(1)]
figure
image(rgb2); hold on
scatter(c, r, 'b*')
hold off
Mohamed Elbeialy
2021 年 4 月 20 日
Image Analyst
2021 年 4 月 21 日
If you use imoverlay, and the max occurs only at a few isolated pixels, then it won't be very visible will it? You can put hold on and use a marker like s cross or spot to make it more visibile. Control the size of the spot with the 'MarkerSize' option
hold on
plot(c, r, 'r.', 'MarkerSize', 15); % Or whatever size you want.
Mohamed Elbeialy
2021 年 4 月 21 日
Walter Roberson
2021 年 4 月 21 日
Classification by shape is a totally different topic. You asked that question in https://www.mathworks.com/matlabcentral/answers/808630-how-to-classify-images-depending-on-the-shape-of-each-image-s-object?s_tid=prof_contriblnk
Image Analyst
2021 年 4 月 21 日
@Mohamed Elbeialy, I'll take a look at that when/if I get time. But did this answer solve this problem? If so, please accept it.
カテゴリ
ヘルプ センター および File Exchange で Display 2-D Images についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!





