How to make image and assign 255 pixel value to specific values in MATLAB

조회 수: 11(최근 30일)
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
Aditya
Aditya 2022년 8월 24일
Could you elaborate the issue ? Where exactly are you stuck ? It is not clear

댓글을 달려면 로그인하십시오.

답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by