【问题标题】:Selecting mask of irregular shape in matlab在matlab中选择不规则形状的掩码
【发布时间】:2012-11-04 06:03:50
【问题描述】:

如何在 Matlab 中不使用 imfreehand 而自动选择图像中不规则形状的蒙版?图像的背景是黑色的,我想选择整个图像作为没有黑色背景的蒙版(没有黑色背景的所有内容)。

【问题讨论】:

    标签: image matlab image-processing masking


    【解决方案1】:

    试试这个:

    threshold=0; % or a different value if needed
    mask=image>threshold;
    

    假设背景是真正的黑色,即像素值为 0,则将阈值设置为零。否则,选择一个捕获背景的值(有一些方法可以自动完成)

    【讨论】:

    • 那么,我应该怎么做才能显示那个面具(黑色背景上的白色面具)?这样我只是隔离了不是黑色的像素,对吧?
    • 只是imagesc(mask); colormap(gray)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-02
    • 1970-01-01
    相关资源
    最近更新 更多