使用OpenCV将光栅图像转换为矢量图形吗? [英] Convert raster images to vector graphics using OpenCV?

查看:190
本文介绍了使用OpenCV将光栅图像转换为矢量图形吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种使用OpenCV将光栅图像转换为矢量数据的可能性.在那里,我发现了一个函数cv::findContours(),它似乎有些原始(很可能我没有完全理解它):

I'm looking for a possibility to convert raster images to vector data using OpenCV. There I found a function cv::findContours() which seems to be a bit primitive (more probably I did not understand it fully):

它似乎仅使用黑白图像(没有灰度和彩色图像),并且似乎不接受任何过滤/错误抑制参数,这些参数可能对嘈杂的图像有所帮助,以避免矢量线很短或避免不均匀多条线,其中一条直线会是更好的结果.

It seems to use b/w images only (no greyscale and no coloured images) and does not seem to accept any filtering/error suppresion parameters that could be helpful in noisy images, to avoid very short vector lines or to avoid uneven polylines where one single, straight line would be the better result.

所以我的问题是:OpenCV是否有可能对彩色光栅图像进行矢量化处理,然后将颜色信息分配给所得的多齿柱?以及如何将降噪和错误抑制应用于这种算法?

So my question: is there a OpenCV possibility to vectorise coloured raster images where the colour-information is assigned to the resulting polylinbes afterwards? And how can I apply noise reduction and error suppression to such a algorithm?

谢谢!

推荐答案

如果要按颜色光栅图像,建议不要将图像聚类到一组颜色上(或对其进行量化),然后提取每种颜色的轮廓并转换为所需的格式. OpenCV中没有现成的矢量化方法.

If you want to raster image by color than I recommend you to clusterize image on some group of colors (or quantalize it) and after this extract contours of each color and convert to needed format. There are no ready vectorizing methods in OpenCV.

这篇关于使用OpenCV将光栅图像转换为矢量图形吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆