spatial coordinates of BW image
이전 댓글 표시
I have a BW image in which few pixels are white rest all are black.. I want to store the spatial co-ordinates of only white pixels in to 2D matrix having only 2 columns(to represent x y coordinates) and any number of rows.. How do I do that? Pl. help me.
채택된 답변
추가 답변 (1개)
Jan
2013년 11월 6일
Use find()
e.g.
A = randn(100,100) > .5; % example binary image
[row col] = find( A == 1 );
res = [ row col ];
This should give you the locations of the pixels containing a '1' in the matrix res.
댓글 수: 2
Image Analyst
2013년 11월 6일
res =[row col] is not (x,y) with your method - it's (y,x) because row = y and col = x.
카테고리
도움말 센터 및 File Exchange에서 Computer Vision with Simulink에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!