Finding pixel location

6 次查看(过去 30 天)
bes
bes 2012-2-24
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

采纳的回答

Andrei Bobrov
Andrei Bobrov 2012-2-24
eg
k = rand(10) > .4
STATS = regionprops(k, 'PixelList','PixelIdxList')
  3 个评论
mohd akmal masud
mohd akmal masud 2020-11-12
may i interupt??
what is k?
Image Analyst
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 个)

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

产品


版本

R2011b

Community Treasure Hunt

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

Start Hunting!

Translated by