How to make image and assign 255 pixel value to specific values in MATLAB
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello every one , I hope you are doing well. I have the dataset attached and the following code gives the output.
The variable rows1 are the new indexes where pixel value of 255 should exist and crop the image based on that min and max value of this new indexes.
for example The rows1 has the first 51 values are 1417 then the 255 exist 51 times on 1417
How can i do it in MATLAB
% Find where image is 255
grayImage=valueestimationimage
mask = grayImage == 255;
% Find indexes
[rows, columns] = find(mask);
% Find max row and column
maxRow = max(rows)
maxCol = max(columns)
maxOfEither = max([maxRow, maxCol]);
% Find mins
minRow = min(rows)
minCol = min(columns)
% Divide indexes by the max and multiply by 1000
rows1 = round(10000 * rows / maxRow) ;
columns1 = round(10000 * columns / maxRow) ;
1 comentario
Aditya
el 24 de Ag. de 2022
Could you elaborate the issue ? Where exactly are you stuck ? It is not clear
Respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!