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

3 ビュー (過去 30 日間)
Stephen john
Stephen john 2022 年 8 月 24 日
コメント済み: Aditya 2022 年 8 月 24 日
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 件)

カテゴリ

Help Center および File ExchangeImages についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by