将图像放入轮廓(OpenCV) [英] Put Image in contour (OpenCV)
问题描述
我教OpenCV,我想写一个小测试应用程序。有一个问题。
你建议用什么算法来填充具有图像的轮廓(接近矩形)?
I teach OpenCV, and I want to write a small test app. And have a question. What algorithm would you advise to fill the contour (close to a rectangle) with image?
非常感谢!
推荐答案
假设你知道矩形的位置,你可以简单地设置一个ROI(感兴趣区域),并对该区域进行一些处理灰度转换),或者甚至将另一图像复制到该位置。我已经演示了如何设置ROI并在该区域上执行一些处理。
Assuming you know the location of the rectangle you would like to fill, you could simply set a ROI (region of interest) and perform some processing on that region (maybe a grayscale conversion), or even copy another image to that location. I've already demonstrated how to set a ROI and perform some processing on that area.
如果您要添加2张图片,建议您检查官方教程,此信息和此演示:魔法发生在 cvSetImageROI()
和 cvAddWeighted()
。
If you want to add 2 images I suggest you check the official tutorial, this post, and this demo: the magic happens through cvSetImageROI()
and cvAddWeighted()
.
这篇关于将图像放入轮廓(OpenCV)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!