How to make image and assign 255 pixel value to specific values in MATLAB
2 次查看(过去 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 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrices and Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!