gpt4 book ai didi

opencv - 如何从二进制掩码生成 trimap?

转载 作者:太空宇宙 更新时间:2023-11-03 21:10:43 26 4
gpt4 key购买 nike

<分区>

我现在正在尝试实现这篇论文:

Automatic Skin and Hair Masking Using Convolutional Neural Networks

我已经让 FCN 和 CRF 部分正常工作,并且在我拥有 trimap 后找到了生成 alpha 掩码的代码。

Diagram from Paper

不过,我停留在 (c) 和 (d) 之间的部分。

如何在给定二进制掩码的情况下生成 trimap?论文说:

We apply morphological operators on the binary segmentation mask for hair and skin, obtaining a trimap that indicates foreground (hair/skin), background and unknown pixels. In order to deal with segmentation inaccuracies, and to best capture the appearance variance of both foreground and background, we first erode the binary mask with a small kernel, then extract the skeleton pixels as part of foreground constrain pixels. We also erode the binary mask with a larger kernel to get more foreground constrain pixels. The final foreground constrain pixels is the union of the two parts. If we only keep the second part then some thin hair regions will be gone after erosion with a large kernel. If a pixel is outside the dilated mask then we take it as background constrain pixel. All other pixels as marked as unknown, see figure 2 (d).

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com