python - 有没有办法用 cv2 分离和克隆图像区域?
问题描述
我知道标题不是很清楚,但它有点复杂的想法,我没有丝毫线索如何解释它。如果你能想到一个更好的标题,请,请,请告诉我,我会编辑标题。
我的问题是这样的:我的一位亲密的程序员朋友要求我重新创建这个图像到图像的翻译示例。不过有一些问题。
- 我不能使用任何预训练的神经网络
- 我必须让它实时运行(使用网络摄像头)
So far I have made it up to having the face swapped but i need to make it go back on to the non webcam image but there is an issue. to do that I have to re-build and warp the whole image around that image including filling the background behind the face that isn't included in the the original source image. I have tried to use impainting but on some occasions it takes part of the hair and neck and merges it into the background just creating a mess of skin and hair colors. I have also tried expanding my mask on the cv2
impainting 功能,但这会导致背景色的大方块看起来也很糟糕。我认为最好的解决方案是使用某种分割算法分割头部周围的最大区域,然后克隆该区域的一部分以保留背景纹理,而不是创建一个新的坏纹理并将该克隆区域放置在蒙版内。这一切都必须实时完成。
最后,我需要将人复制到 中img1
,然后将其删除(部分我卡住了)。然后从中取出面部地标img2
并将这些地标映射到img1
克隆的脸上,然后将重新映射的重新添加img1
到img1
背景上。我知道我无法像我在 8 年级那样有资格的人那样清楚地传达这些想法,所以如果需要任何澄清,请询问。
解决方案
推荐阅读
- docker - kafka docker卡在配置上并且不能在mac上工作
- .net - 为什么在我的 azure 函数应用程序中升级到 dotnet-isolated 后未检测到函数
- python - 如何更有效地为文本着色?
- python-3.x - 如何在 python 中读取 IP 地址(视频)并将其连接到 ROS?
- android-studio - Android Studio:将图像发送到 Whatsapp
- html - Firestore 在 Google App Script Web App 上获取所有文档并显示为 HTML 表格
- go - 如何使用 AWS SDK v2 在 dynamodb 中按键获取项目?
- javascript - 为什么这被绑定在这些箭头调用之一中,而不是另一个?
- node.js - 让一个后端管理 web 应用程序的身份验证并响应本机应用程序
- node.js - 每次用户请求受保护的路由时都可以在数据库中搜索吗?