Finding pixel location
조회 수: 6 (최근 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개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!