How to find which pixel's brightness is the highest?
3 次查看(过去 30 天)
显示 更早的评论
We have a image which is grayscale. We select a row and we must find the highest brightness level pixel in this row. And after that we must do all row white. How can I do that. Which command should I use? Thank You.
0 个评论
采纳的回答
Image Analyst
2021-12-19
Try this:
% Demo by Image Analyst, December, 2021.
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clearvars;
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 16;
fprintf('Beginning to run %s.m ...\n', mfilename);
grayImage = imread('coins.png');
subplot(1, 2, 2);
imshow(grayImage)
g = gcf;
g.WindowState = 'maximized'
title('Click on this image', 'fontSize', fontSize)
uiwait(helpdlg('Click on a row'));
[x, y] = ginput(1);
row = round(y);
% Extract row
theRowsGrayLevels = grayImage(row, :);
subplot(1, 2, 1);
plot(theRowsGrayLevels, 'b-');
grid on;
caption = sprintf('Intensity of row #%d', row);
title(caption, 'fontSize', fontSize)
xlabel('Column', 'fontSize', fontSize)
ylabel('Gray Level', 'fontSize', fontSize)
% Now set that row to white.
grayImage(row, :) = 255;
subplot(1, 2, 2);
imshow(grayImage)
axis('on', 'image')
caption = sprintf('Row #%d', row);
title(caption, 'fontSize', fontSize)
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 3-D Volumetric Image Processing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!