【问题标题】:how to save the segmented region as a separate image?如何将分割区域保存为单独的图像?
【发布时间】:2017-10-29 17:09:13
【问题描述】:

我用了网上找的代码,把一张图片分成了几段

我想从图像中提取绿色部分并存储它们。我可以用这样的黑色蒙版分别显示分段图像

但我只想将绿色小分段区域显示并保存为单独的图像(如在本例中为 9 个单独的 .jpg 绿色图像),没有黑色区域。

这是我在网上找到的代码

segmented_images = cell(1,max(max(L)));
rgb_label = repmat(L,[1 1 3]);
for k = 1:max(max(L)) %L-label matrix
    color = I;%im-Color img
    color(rgb_label ~= k) = 0;
    segmented_images{k} = color; 
end

【问题讨论】:

    标签: matlab image-processing superpixels


    【解决方案1】:

    根据 Matlab 中图像的表示,(每个数组元素一个像素),您可以根据绿色值对(分割的)图像进行分段或使用标记(您在网上找到的代码类似于标记)。

    我建议你看看Image Analyst's Demo

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-07-30
      • 2011-05-18
      • 2023-03-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-27
      • 2021-12-31
      相关资源
      最近更新 更多