gpt4 book ai didi

c++ - 自由形式的图像选择(最好在 C++ 中)

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:36:26 25 4
gpt4 key购买 nike

我是图像处理的新手。我注意到您可以指定 rectangular region of interest和其他人喜欢 circles等在像opencv这样的图像处理库中。像 ms-paint 这样的基本绘画程序包含自由形式选择,但我似乎找不到关于如何在 opencv 或其他图像处理库中进行自由形式图像选择的功能或教程。关于如何实现这一目标的任何想法?PS:我的首选语言是c/c++。 enter image description here

最佳答案

你可以尝试一件事:

如果选择可以表示为二维 vector 序列,您可以将其视为多边形。分配一个新的 1 channel 图像作为掩码并用 0 填充它。然后使用

void cvFillPoly(CvArr* img, CvPoint** pts, int* npts, int contours, CvScalar color, int lineType=8, int shift=0)

记录在

http://opencv.willowgarage.com/documentation/drawing_functions.html

在蒙版图像上绘制一个非零区域来表示图像的选定部分。

关于c++ - 自由形式的图像选择(最好在 C++ 中),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8192300/

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