在matlab中从二值图像中提取白色像素

在matlab中从二值图像中提取白色像素,matlab,Matlab,我有一个二值图像作为输入,我使用“区域道具”检测到了质心,现在我想在MATLAB中提取质心右侧的白色像素。怎么做?任何帮助都将不胜感激。谢谢。我想你想要这样的东西: % let r_centroid be the centroid's row [r,c] = find( img == 1 ); gt_idx = find( r > r_centroid ); r( gt_idx ) % print the answer 请提供一张照片,和样品图片。

我有一个二值图像作为输入,我使用“区域道具”检测到了质心,现在我想在MATLAB中提取质心右侧的白色像素。怎么做?任何帮助都将不胜感激。谢谢。

我想你想要这样的东西:

% let r_centroid be the centroid's row
[r,c] = find( img == 1 );
gt_idx = find( r > r_centroid );
r( gt_idx ) % print the answer
请提供一张照片,和样品图片。