Effacer les filtres
Effacer les filtres

Finding pixel location

6 vues (au cours des 30 derniers jours)
bes
bes le 24 Fév 2012
Commenté : Image Analyst le 12 Nov 2020
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

Réponse acceptée

Andrei Bobrov
Andrei Bobrov le 24 Fév 2012
eg
k = rand(10) > .4
STATS = regionprops(k, 'PixelList','PixelIdxList')
  3 commentaires
mohd akmal masud
mohd akmal masud le 12 Nov 2020
may i interupt??
what is k?
Image Analyst
Image Analyst le 12 Nov 2020
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)

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Image Processing Toolbox dans Help Center et File Exchange

Produits


Version

R2011b

Community Treasure Hunt

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

Start Hunting!

Translated by