フィルターのクリア

How to find which pixel's brightness is the highest?

4 ビュー (過去 30 日間)
Ali Deniz
Ali Deniz 2021 年 12 月 19 日
回答済み: Image Analyst 2021 年 12 月 19 日
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 Center および File ExchangeExplore and Edit Images with Image Viewer App についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by