find foreground pixels in each segments in grid
2 次查看(过去 30 天)
显示 更早的评论
i want to find the foreground pixels in each segments in grid after finding the foreground pixel i want to find center of mass in each segments and i want to add nodes based on center of mass.
0 个评论
回答(1 个)
Image Analyst
2017-2-22
Like we've told you in some of your prior posts, extract each tile/block. Then use find() to get the rows and columns, then take the mean of those numbers to get the centroid.
[y, x] = find(yourImage(row1:row2, col1:col2));
centroidX = mean(x);
centroidY = mean(y);
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!