Find out the first while pixel from right side ?
5 ビュー (過去 30 日間)
古いコメントを表示
I have done few process on my image and got stuck here. So far,this is the result that i got For now, all i need is to find the first white pixel in that image at every column from right side and display only that pixel rest all pixel in same row to be black .
0 件のコメント
採用された回答
Matt J
2018 年 6 月 11 日
[m,n]=size(yourImage);
[~,idx]=max(fliplr(yourImage),[],2);
newImage= ( (n+1-idx)==(1:n) );
その他の回答 (1 件)
Guillaume
2018 年 6 月 11 日
The index of the maximum of each row of a binary image is also the index of the first white pixel of each row, thus:
newimage = false(size(yourimage)); %create blank binary image.
[~, col] = max(yourimage, [], 2); %find coordinate of 1st pixel of each row
newimage(ind2sub(size(newimage), (1:size(newimage, 1))', col)) = true;
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!