Finding pixel location
2 ビュー (過去 30 日間)
古いコメントを表示
In my binary image line segments are displayed in white. I want to find all the locations (pixel coordinates )which contain pixel value 1 (white)? how can i get those pixel coordinates as an array. Please help me
0 件のコメント
採用された回答
Andrei Bobrov
2012 年 2 月 24 日
eg
k = rand(10) > .4
STATS = regionprops(k, 'PixelList','PixelIdxList')
3 件のコメント
Image Analyst
2020 年 11 月 12 日
k is a binary image. Probably a poor name though. He made a 10x10 image using rand() and then thresholded it at 0.4 to create a binary image. Try this instead:
binaryImage = rand(10) > .4
STATS = regionprops(binaryImage, 'PixelList');
However you don't need regionprops to just find all the locations of white. You can just do
[rows, columns] = find(binaryImage)
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!