Sampling nodes equally to cover all the environment
조회 수: 2(최근 30일)
표시 이전 댓글
댓글: mohammed alany 2019년 7월 30일
if i have this binary image, and i would like to distributed nodes in
the white area, which is the best way can distributed nodes to cover all the environments equally?
댓글 수: 4
Walter Roberson 2019년 7월 30일
NC = 50;
map = imread('unifor.png');
BW = im2bw(map);
[y, x] = find(BW);
c = [x, y];
initpos = c(randperm(size(c,1),NC),:);
[idx,cents] = kmeans(c, NC, 'maxiter', 500, 'start', initpos);
ddd = squareform(pdist(cents));
ddd(1:(NC+1):end) = inf;
N = string(1 : NC);
text(cents(:,1), cents(:,2), N);
You might notice some points at the bottom of the image. That white stripe along the bottom is part of the original image, and so distributing equally in the white portion requires placing some points in that white stripe.
댓글 수: 1
Find more on C4ISR in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!