我有一个图像,然后将其划分为10个扇区。我想获得每个扇区中所有黑色像素的坐标。
% height and width are dimensions of black and white image
[hh,ww] = meshgrid( 1:height , 1:width );
% change to polar coordinates relative to the centroid
[theta, r] = cart2pol(hh - centroid(1), ww - centroid(2));
% make divisions of image into Sectors each of 36 degree
E = 0:36:360;
[~, sectorid] = histc(theta * (180/pi), E);
% count for each sector the number of black pixels
N = zeros(size(E));
N = arrayfun(@(k) nnz(bw(sectorid==k)==0), 1:max(sectorid));
N给出了每个扇区中的黑色像素数。我不了解如何找到所有像素的坐标,然后将它们存储在矩阵中。
任何帮助都会很棒!
谢谢。