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.

采纳的回答

Image Analyst
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 个)

类别

Help CenterFile 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!

Translated by