How to find which pixel's brightness is the highest?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Ali Deniz
el 19 de Dic. de 2021
Respondida: Image Analyst
el 19 de Dic. de 2021
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 comentarios
Respuesta aceptada
Image Analyst
el 19 de Dic. de 2021
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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre 3-D Volumetric Image Processing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!