CN114461829A - Method for vectorization of traditional culture memory symbol subgraph - Google Patents

Method for vectorization of traditional culture memory symbol subgraph Download PDF

Info

Publication number
CN114461829A
CN114461829A CN202210105751.4A CN202210105751A CN114461829A CN 114461829 A CN114461829 A CN 114461829A CN 202210105751 A CN202210105751 A CN 202210105751A CN 114461829 A CN114461829 A CN 114461829A
Authority
CN
China
Prior art keywords
vectorization
elements
gradient
sub
image
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202210105751.4A
Other languages
Chinese (zh)
Other versions
CN114461829B (en
Inventor
赵海英
李晓彤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
BEIJING INTERNATIONAL STUDIES UNIVERSITY
Beijing University of Posts and Telecommunications
Original Assignee
BEIJING INTERNATIONAL STUDIES UNIVERSITY
Beijing University of Posts and Telecommunications
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by BEIJING INTERNATIONAL STUDIES UNIVERSITY, Beijing University of Posts and Telecommunications filed Critical BEIJING INTERNATIONAL STUDIES UNIVERSITY
Priority to CN202210105751.4A priority Critical patent/CN114461829B/en
Publication of CN114461829A publication Critical patent/CN114461829A/en
Application granted granted Critical
Publication of CN114461829B publication Critical patent/CN114461829B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/50Information retrieval; Database structures therefor; File system structures therefor of still image data
    • G06F16/56Information retrieval; Database structures therefor; File system structures therefor of still image data having vectorial format
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/23Clustering techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/25Fusion techniques
    • G06F18/253Fusion techniques of extracted features

Landscapes

  • Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Artificial Intelligence (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Databases & Information Systems (AREA)
  • Image Analysis (AREA)
  • Image Processing (AREA)

Abstract

本发明公开了一种面向传统文化记忆符号子图矢量化的方法,该方法包括以下步骤:S1、计算图像中的像素点,确定元素轮廓并提取完整的子元素;S2、对所述子元素进行图像处理,并划分成不同区域;S3、对各区域边缘进行近似,转换成光滑矢量区域轮廓;S4、将各区域内数据信息进行整合,获取区域矢量化结果并进行保存,输出子元素的矢量图。通过较少的交互得到精确且完整的子元素,并且通过矢量化技术,实现局部元素矢量化,得到其对应的矢量素材,从而完成了传统文化图像中子元素矢量化的全部流程,获得了图像中局部元素的矢量图;从而快速得到图像中局部的子元素矢量图,提高了素材质量,大大降低了文化素材二次创作的难度。

Figure 202210105751

The invention discloses a method for vectorizing traditional cultural memory symbol sub-images. The method includes the following steps: S1. Calculating pixel points in an image, determining element outlines and extracting complete sub-elements; S2. Calculating the sub-elements Perform image processing and divide it into different areas; S3, approximate the edges of each area, and convert them into smooth vector area contours; S4, integrate the data information in each area, obtain and save the area vectorization results, and output the sub-elements. Vector illustration. Accurate and complete sub-elements are obtained through less interaction, and local elements are vectorized through vectorization technology to obtain their corresponding vector materials, thus completing the entire process of sub-element vectorization in traditional cultural images, and obtaining an image The vector graphics of the local elements in the image can be quickly obtained, which improves the quality of the material and greatly reduces the difficulty of secondary creation of cultural materials.

Figure 202210105751

Description

一种面向传统文化记忆符号子图矢量化的方法A method for vectorization of traditional cultural memory symbol subgraphs

技术领域technical field

本发明涉及计算机图像处理技术领域,具体来说,涉及一种面向传统文 化记忆符号子图矢量化的方法。The present invention relates to the technical field of computer image processing, in particular, to a method for vectorizing traditional cultural memory symbol subgraphs.

背景技术Background technique

当今时代背景下,对文化遗产进行数字化和再利用是一种有效保护并传承 文化的方法,“中华文化素材库”是文化资源数字化催生的一座文化“金矿”, 发掘这座文化“金矿”,对于传承和传播中华文化、变革文化生产方式、发展 文化生产力具有划时代的意义,图像矢量化技术是构建“中华文化素材库”的 核心工具。In the context of today's era, the digitization and reuse of cultural heritage is an effective way to protect and inherit culture. ", has epoch-making significance for inheriting and disseminating Chinese culture, changing cultural production methods, and developing cultural productivity. Image vectorization technology is the core tool for building a "Chinese cultural material library".

矢量图相较于栅格图像来说具有许多优点,如图像质量与分辨率无关,可 任意缩放而不失真;存储紧凑,文件较小,可进行高效存储和传输;支持对几 何图元进行编辑修改。图像矢量化就是将栅格类型的图像转换成矢量格式的图 像。Compared with raster images, vector graphics have many advantages, such as image quality independent of resolution, can be arbitrarily scaled without distortion; compact storage, small files, efficient storage and transmission; support for editing geometric primitives Revise. Image vectorization is the conversion of raster-type images into vector-formatted images.

目前中华文化素材库中的素材仍以整张的矢量图为主,一幅具有文化寓意 的图像中通常会包含一个或多个富有内涵的子元素,这类元素的矢量图在进行 文化创作时就显得尤为重要,通常情况下,用户需要一定的后处理操作,才能 从完整的矢量图中获得局部矢量图,大大降低了素材库中素材的使用效率。此 外,受图像采集环境的影响,图像质量参差不齐,对于效果不理想的图像直接 进行整张图像的矢量化,得到的矢量图的效果也会不理想,无法充分发挥其文 化价值,降低了素材库中素材的使用价值。At present, the materials in the Chinese cultural material library are still mainly vector graphics. An image with cultural meaning usually contains one or more sub-elements with rich connotations. The vector graphics of such elements are used in cultural creation. It is particularly important. Usually, users need certain post-processing operations to obtain partial vector graphics from the complete vector graphics, which greatly reduces the efficiency of using materials in the material library. In addition, due to the influence of the image acquisition environment, the image quality is uneven. If the image with unsatisfactory effect is directly vectorized for the entire image, the effect of the obtained vector illustration will also be unsatisfactory, and its cultural value cannot be fully exerted, reducing the cost of the whole image. The use value of the material in the material library.

针对相关技术中的问题,目前尚未提出有效的解决方案。For the problems in the related technologies, no effective solutions have been proposed so far.

发明内容SUMMARY OF THE INVENTION

针对相关技术中的问题,本发明提出一种面向传统文化记忆符号子图矢 量化的方法,以克服现有相关技术所存在的上述技术问题。In view of the problems in the related art, the present invention proposes a method for vectorizing traditional cultural memory symbol subgraphs to overcome the above-mentioned technical problems existing in the related art.

为此,本发明采用的具体技术方案如下:For this reason, the concrete technical scheme that the present invention adopts is as follows:

一种面向传统文化记忆符号子图矢量化的方法,该方法包括以下步骤:A method for vectorizing traditional cultural memory symbol subgraphs, the method includes the following steps:

S1、计算图像中的像素点,确定元素轮廓并提取完整的子元素;S1, calculate the pixel points in the image, determine the outline of the element and extract the complete sub-element;

S2、对所述子元素进行图像处理,并划分成不同区域;S2, performing image processing on the sub-elements, and dividing them into different regions;

S3、对各区域边缘进行近似,转换成光滑矢量区域轮廓;S3. Approximate the edge of each area and convert it into a smooth vector area outline;

S4、将各区域内数据信息进行整合,获取区域矢量化结果并进行保存, 输出子元素的矢量图。S4. Integrate the data information in each area, obtain and save the area vectorization result, and output the vector diagram of the sub-elements.

进一步的,所述计算图像中的像素点,确定元素轮廓并提取完整的子 元素,包括以下步骤:Further, the pixel point in the described calculation image, determine the outline of the element and extract the complete sub-element, comprising the following steps:

S11、选取代表目标元素边缘的特征分量,并对所述特征分量代价进行 加权求和计算各像素点到相邻像素点的局部代价;S11, select the feature component representing the edge of the target element, and the feature component cost is weighted and summed to calculate the local cost from each pixel to adjacent pixels;

S12、通过融合颜色梯度特征,计算相邻像素点间的通道差异,提高元 素提取轮廓的贴合度;S12. Calculate the channel difference between adjacent pixel points by fusing the color gradient feature to improve the fit of the element extraction contour;

S13、利用迪克斯特拉(Dijkstra)算法查寻最小代价路径,获取完整 封闭的元素轮廓。S13. Use the Dijkstra algorithm to search for the minimum cost path to obtain a complete and closed element contour.

进一步的,所述特征分量包括拉普拉斯零点、梯度大小及梯度方向。Further, the feature components include Laplacian zeros, gradient magnitudes and gradient directions.

进一步的,所述对特征分量代价进行加权求和计算各像素点到相邻像 素点的局部代价的计算公式为:Further, the described calculation formula of the weighted summation of the feature component cost to calculate the local cost from each pixel point to the adjacent pixel point is:

C(p,q)=wG·fG(q)+wZ·fZ(q)+wD·fD(p,q);C(p,q)= wG · fG (q)+ wZ · fZ (q)+wD· fD ( p,q);

其中,C(p,q)表示从像素p到相邻像素q定向链接的局部成本,fZ表 示拉普拉斯零点,fG表示梯度大小,fD表示梯度方向,wG=0.43, wZ=0.43,wD=0.14。where C(p,q) represents the local cost of the directional link from pixel p to adjacent pixel q, fZ represents the Laplacian zero, fG represents the gradient magnitude, fD represents the gradient direction, wG = 0.43, w Z =0.43, w D =0.14.

进一步的,所述通过融合颜色梯度特征,计算相邻像素点间的通道差 异,提高元素提取轮廓的贴合度,包括以下步骤:Further, described by the fusion color gradient feature, calculate the channel difference between adjacent pixels, improve the fit degree of the element extraction contour, comprising the following steps:

S121、融合颜色梯度特征,将图像转换至表色体系(CIE-Lab)空间下, 进行Lab通道分离;S121, fuse the color gradient features, convert the image to a colorimetric system (CIE-Lab) space, and perform Lab channel separation;

S122、计算相邻像素点间L通道和ab融合通道的差异,计算公式如下:S122, calculate the difference between the L channel and the ab fusion channel between adjacent pixels, and the calculation formula is as follows:

fC(q)=(Cr⊙Cl,Ct⊙Cb);f C (q)=(C r ⊙C l , C t ⊙C b );

Figure RE-GDA0003587019560000021
Figure RE-GDA0003587019560000021

其中,fC(q)表示颜色梯度,

Figure RE-RE-GDA0003587019560000031
△Lij=△Li-△Lj,△aij=△ai-△aj,△bij=△bi-△bj,Cr、Cl、Ct及Cb分别为右、左、上、下邻域中像素点在表色体系空间下的加权平均值。where f C (q) represents the color gradient,
Figure RE-RE-GDA0003587019560000031
ΔL ij =ΔL i -ΔL j , Δa ij =Δa i -Δa j , Δb ij =Δb i -Δb j , C r , C l , C t and C b are right , the weighted average of the pixels in the left, upper and lower neighborhoods in the color system space.

S123、将差异值代入所述局部代价的计算过程,提高元素提取轮廓的 贴合度,降低交互次数。S123. Substitute the difference value into the calculation process of the local cost, improve the fit of the element extraction contour, and reduce the number of interactions.

进一步的,所述将差异值代入所述局部代价的计算过程的公式为:Further, the formula for the calculation process of substituting the difference value into the local cost is:

C(p,q)=wG·[βfG(q)+(1-β)fZ(q)]+wZ·fZ(q)+wD·fD(p,q);C(p,q)= wG ·[ βfG (q)+(1-β) fZ (q)]+ wZ · fZ (q)+wD· fD ( p,q);

其中,C(p,q)表示从像素p到相邻像素q定向链接的局部成本,fZ表 示拉普拉斯零点,fG表示梯度大小,fD表示梯度方向,wG=0.43, wZ=0.43,wD=0.14。where C(p,q) represents the local cost of the directional link from pixel p to adjacent pixel q, fZ represents the Laplacian zero, fG represents the gradient magnitude, fD represents the gradient direction, wG = 0.43, w Z =0.43, w D =0.14.

进一步的,所述利用迪克斯特拉(Dijkstra)算法查寻最小代价路径, 获取完整封闭的元素轮廓,包括以下步骤:Further, using the Dijkstra algorithm to search for the minimum cost path to obtain a complete and closed element contour includes the following steps:

S131、选择元素边界上任一点进行扩展,再将该点的局部代价加到其 相邻节点上;S131, select any point on the element boundary to expand, and then add the local cost of the point to its adjacent nodes;

S132、选择具有最小累积代价的相邻节点继续扩展;S132, select the adjacent node with the smallest accumulated cost to continue to expand;

S133、重复进行节点扩展形成序列,直至与初始点重合,获取完整封 闭的元素轮廓。S133, repeat the node expansion to form a sequence until it coincides with the initial point, and obtain a complete and closed element outline.

进一步的,所述对所述子元素进行图像处理,并划分成不同区域,包 括以下步骤:Further, the described sub-elements are subjected to image processing and divided into different regions, including the following steps:

S21、利用聚类算法对图像中的区域进行聚类处理,设置一定的空间距 离与颜色距离大小;S21. Use the clustering algorithm to cluster the regions in the image, and set a certain spatial distance and color distance;

S22、进行多次迭代,将收敛后的像素值替换原有的像素值,并合并局 部相似的像素点,获取不同的颜色区域;S22, performing multiple iterations, replacing the original pixel value with the converged pixel value, and merging locally similar pixel points to obtain different color regions;

S23、对每个区域进行边缘结构的提取,利用多级边缘检测(canny) 算子对区域进行边缘检测,计算图像梯度大小和方向,进行非极大值抑制 以及双阈值筛选,获取区域边缘。S23. Extract the edge structure of each region, use the multi-level edge detection (canny) operator to detect the edge of the region, calculate the size and direction of the image gradient, perform non-maximum suppression and double-threshold screening, and obtain the edge of the region.

进一步的,所述对各区域边缘进行近似,转换成光滑矢量区域轮廓, 包括以下步骤:Further, the described approximation of the edge of each region, converted into a smooth vector region outline, including the following steps:

S31、通过道格拉斯-普克(Douglas-Peucker)算法将获得的边缘曲线 进行简化;S31. Simplify the obtained edge curve by the Douglas-Peucker algorithm;

S32、迭代选取曲线上距离对应直线段最远距离大于设定阈值的点作为 多边形顶点,将其连接获得拟合多边形;S32, iteratively select the point on the curve with the farthest distance from the corresponding straight line segment greater than the set threshold as the polygon vertex, and connect it to obtain a fitted polygon;

S33、利用贝塞尔曲线对所述多边形进行拟合与平滑,转换为准确光滑 的矢量轮廓。S33. Use Bezier curve to fit and smooth the polygon, and convert it into an accurate and smooth vector outline.

进一步的,所述数据信息包括矢量轮廓信息与颜色信息。Further, the data information includes vector outline information and color information.

本发明的有益效果为:通过较少的交互得到精确且完整的子元素,并且通 过矢量化技术,实现局部元素矢量化,得到其对应的矢量素材,从而完成了传 统文化图像中子元素矢量化的全部流程,获得了图像中局部元素的矢量图。相 对于一般的图像提取方法而言,本发明在元素提取时既保证了提取轮廓的贴合 度,又大大降低了交互次数,同时,本发明提出的两阶段的流程使用户能够通 过较少的交互,快速得到图像中局部的子元素矢量图,提高了素材库中素材的 质量,大大降低了文化素材二次创作的难度,使文化素材发挥其最大的创作价 值。The beneficial effects of the invention are as follows: accurate and complete sub-elements are obtained through less interaction, and the vectorization of local elements is realized through the vectorization technology, and the corresponding vector materials are obtained, thereby completing the vectorization of sub-elements in traditional cultural images. The whole process of obtaining a vector diagram of the local elements in the image. Compared with the general image extraction method, the present invention not only ensures the fit of the extracted contour during element extraction, but also greatly reduces the number of interactions. At the same time, the two-stage process proposed by the present invention enables users to pass fewer Interaction, quickly get the local sub-element vector graphics in the image, improve the quality of the materials in the material library, greatly reduce the difficulty of secondary creation of cultural materials, and enable cultural materials to exert their maximum creative value.

附图说明Description of drawings

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施 例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是 本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的 前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the accompanying drawings required in the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some of the present invention. In the embodiments, for those of ordinary skill in the art, other drawings can also be obtained according to these drawings without any creative effort.

图1是根据本发明实施例的一种面向传统文化记忆符号子图矢量化的方 法的流程图。Fig. 1 is a flowchart of a method for vectorizing traditional cultural memory symbol subgraphs according to an embodiment of the present invention.

具体实施方式Detailed ways

根据本发明的实施例,提供了一种面向传统文化记忆符号子图矢量化的 方法。According to an embodiment of the present invention, a method for vectorizing traditional cultural memory symbol subgraphs is provided.

现结合附图和具体实施方式对本发明进一步说明,如图1所示,根据本发 明实施例的面向传统文化记忆符号子图矢量化的方法,该方法包括以下步 骤:The present invention will now be further described in conjunction with the accompanying drawings and the specific embodiments, as shown in Figure 1, according to the method for the vectorization of traditional cultural memory symbol subgraphs according to an embodiment of the present invention, the method comprises the following steps:

S1、计算图像中的像素点,确定元素轮廓并提取完整的子元素;S1, calculate the pixel points in the image, determine the outline of the element and extract the complete sub-element;

此步骤中将寻找元素边缘轮廓问题看作图搜索过程中的最优路径搜寻 问题,最优路径一定是贴合元素边界的一段路径,因此有着强边缘特征的 像素与其他像素点之间的链接应该是具有较低的局部代价。In this step, the problem of finding the edge contour of an element is regarded as the optimal path search problem in the process of graph search. The optimal path must be a path that fits the boundary of the element. Therefore, there are links between pixels with strong edge features and other pixels. should have low local cost.

其中,S1包括以下步骤:Among them, S1 includes the following steps:

S11、选取代表目标元素边缘的特征分量(特征分量包括拉普拉斯零点、 梯度大小及梯度方向),并对所述特征分量代价进行加权求和计算各像素 点到相邻像素点的局部代价,其计算公式为:S11. Select a feature component representing the edge of the target element (the feature component includes Laplacian zero point, gradient size and gradient direction), and perform weighted summation on the feature component cost to calculate the local cost from each pixel to adjacent pixels , its calculation formula is:

C(p,q)=wG·fG(q)+wZ·fZ(q)+wD·fD(p,q);C(p,q)= wG · fG (q)+ wZ · fZ (q)+wD· fD ( p,q);

其中,C(p,q)表示从像素p到相邻像素q定向链接的局部成本,fZ表 示拉普拉斯零点,fG表示梯度大小,fD表示梯度方向,wG=0.43, wZ=0.43,wD=0.14。where C(p,q) represents the local cost of the directional link from pixel p to adjacent pixel q, fZ represents the Laplacian zero, fG represents the gradient magnitude, fD represents the gradient direction, wG = 0.43, w Z =0.43, w D =0.14.

梯度大小代价项主要是对边缘强度的描述,具有强烈边缘强度的位置 应该付出较小的代价。将图像与sobel算子进行卷积得到梯度大小。The gradient size cost term is mainly a description of the edge strength, and the position with strong edge strength should pay a smaller price. Convolve the image with the sobel operator to get the gradient magnitude.

拉普拉斯零点代价项主要是对边界定位的描述,将图像与拉普拉斯算 子进行卷积运算得到OutL,如果OutL(q)=0或者存在一个不同符号的邻居 时,令fZ(q)=0,否则fZ(q)=1。The Laplacian zero-point cost term is mainly a description of the boundary positioning. The image is convolved with the Laplacian operator to obtain Out L . If Out L (q) = 0 or there is a neighbor with a different sign, let f Z (q)=0, otherwise f Z (q)=1.

梯度方向代价项主要是为了对边界方向变化的位置增加平滑约束,对 于方向急剧变化的位置赋予更大的代价。设D(p)是在p点上与梯度方向垂 直的单位向量,则梯度方向代价计算公式如下所示:The gradient direction cost term is mainly to add smooth constraints to the position where the direction of the boundary changes, and to give a larger cost to the position where the direction changes sharply. Let D(p) be a unit vector perpendicular to the gradient direction at point p, then the gradient direction cost calculation formula is as follows:

Figure RE-RE-GDA0003587019560000051
Figure RE-RE-GDA0003587019560000051

dp(p,q)=D(p)·L(p,q); dp (p,q)=D(p)·L(p,q);

dq(p,q)=L(p,q)·D(q);d q (p,q)=L(p,q)·D(q);

Figure RE-RE-GDA0003587019560000052
Figure RE-RE-GDA0003587019560000052

其中L(p,q)表示的是两点之间的链接方向,使得p与最终确定的链接 方向的差值小于90度。当两个像素的梯度方向彼此相似,并且它们之间的 链接方向也相似时,梯度方向特征的代价很低。Where L(p,q) represents the link direction between two points, so that the difference between p and the final link direction is less than 90 degrees. When the gradient directions of two pixels are similar to each other, and the link directions between them are also similar, the cost of gradient direction features is low.

而考虑到图像中存在的灰度与颜色变化不一致区域的问题,进一步优 化灰度梯度惩罚项。给定一个输入图像,首先将其转换成感知上统一的 CIE-Lab色彩空间,再进行下述彩色图像的颜色梯度融合。Considering the inconsistency between gray and color changes in the image, the gray gradient penalty term is further optimized. Given an input image, first convert it to a perceptually unified CIE-Lab color space, and then perform the color gradient fusion of the following color images.

S12、通过融合颜色梯度特征,计算相邻像素点间的通道差异,提高元 素提取轮廓的贴合度;S12. Calculate the channel difference between adjacent pixel points by fusing the color gradient feature to improve the fit of the element extraction contour;

其中,S12包括以下步骤:Wherein, S12 includes the following steps:

S121、融合颜色梯度特征,将图像转换至表色体系(CIE-Lab)空间下, 进行Lab通道分离;S121, fuse the color gradient features, convert the image to a colorimetric system (CIE-Lab) space, and perform Lab channel separation;

S122、计算相邻像素点间L通道和ab融合通道的差异,计算公式如下:S122, calculate the difference between the L channel and the ab fusion channel between adjacent pixels, and the calculation formula is as follows:

fC(q)=(Cr⊙Cl,Ct⊙Cb);f C (q)=(C r ⊙C l , C t ⊙C b );

Figure RE-RE-GDA0003587019560000061
Figure RE-RE-GDA0003587019560000061

其中,fC(q)表示颜色梯度,

Figure RE-RE-GDA0003587019560000062
△Lij=△Li-△Lj,△aij=△ai-△aj,△bij=△bi-△bj,Cr、Cl、Ct及Cb分别为右、左、上、下邻域中像素点在表色体系(CIE-Lab)空间下 的加权平均值,其表达式分别为:where f C (q) represents the color gradient,
Figure RE-RE-GDA0003587019560000062
ΔL ij =ΔL i -ΔL j , Δa ij =Δa i -Δa j , Δb ij =Δb i -Δb j , C r , C l , C t and C b are right , the weighted average of the pixels in the left, upper and lower neighborhoods in the color system (CIE-Lab) space, and their expressions are:

Cr=(2c(x+1,y)+c(x+1,y-1)+c(x+1,y+1))/4;C r =(2c(x+1,y)+c(x+1,y-1)+c(x+1,y+1))/4;

Cl=(2c(x-1,y)+c(x-1,y-1)+c(x-1,y+1))/4;C l =(2c(x-1,y)+c(x-1,y-1)+c(x-1,y+1))/4;

Ct=(2c(x,y+1)+c(x-1,y+1)+c(x+1,y+1))/4;C t =(2c(x,y+1)+c(x-1,y+1)+c(x+1,y+1))/4;

Cd=(2c(x,y-1)+c(x-1,y-1)+c(x+1,y-1))/4;C d =(2c(x,y-1)+c(x-1,y-1)+c(x+1,y-1))/4;

c(x,y)即为图像中(x,y)位置处的CIE-Lab值。c(x,y) is the CIE-Lab value at the (x,y) position in the image.

在搜寻边缘时,颜色梯度变化越大的位置越可能为目标边界,这与灰 度梯度变化是一致的。When searching for edges, the position with the larger color gradient change is more likely to be the target boundary, which is consistent with the gray gradient change.

S123、将差异值代入所述局部代价的计算过程,提高元素提取轮廓的 贴合度,降低交互次数。S123. Substitute the difference value into the calculation process of the local cost, improve the fit of the element extraction contour, and reduce the number of interactions.

其中,所述将差异值代入所述局部代价的计算过程的公式为:Wherein, the formula for the calculation process of substituting the difference value into the local cost is:

C(p,q)=wG·[βfG(q)+(1-β)fZ(q)]+wZ·fZ(q)+wD·fD(p,q);C(p,q)= wG ·[ βfG (q)+(1-β) fZ (q)]+ wZ · fZ (q)+wD· fD ( p,q);

式中,C(p,q)表示从像素p到相邻像素q定向链接的局部成本,fZ表 示拉普拉斯零点,fG表示梯度大小,fD表示梯度方向,wG=0.43, wZ=0.43,wD=0.14。where C(p,q) represents the local cost of the directional link from pixel p to adjacent pixel q, fZ represents the Laplacian zero, fG represents the gradient size, fD represents the gradient direction, wG = 0.43, w Z =0.43, w D =0.14.

S13、利用迪克斯特拉(Dijkstra)算法查寻最小代价路径,获取完整 封闭的元素轮廓。S13. Use the Dijkstra algorithm to search for the minimum cost path to obtain a complete and closed element contour.

其中,S13包括以下步骤:Wherein, S13 includes the following steps:

S131、选择元素边界上任一点进行扩展,再将该点的局部代价加到其 相邻节点上;S131, select any point on the element boundary to expand, and then add the local cost of the point to its adjacent nodes;

S132、选择具有最小累积代价的相邻节点继续扩展;S132, select the adjacent node with the smallest accumulated cost to continue to expand;

S133、重复进行节点扩展形成序列,直至与初始点重合,获取完整封 闭的元素轮廓。S133, repeat the node expansion to form a sequence until it coincides with the initial point, and obtain a complete and closed element outline.

S2、对所述子元素进行图像处理,并划分成不同区域;S2, performing image processing on the sub-elements, and dividing them into different regions;

其中,S2包括以下步骤:Among them, S2 includes the following steps:

S21、利用聚类算法对图像中的区域进行聚类处理,设置一定的空间距 离与颜色距离大小;S21. Use the clustering algorithm to cluster the regions in the image, and set a certain spatial distance and color distance;

S22、进行多次迭代,将收敛后的像素值替换原有的像素值,并合并局 部相似的像素点,获取不同的颜色区域;S22, performing multiple iterations, replacing the original pixel value with the converged pixel value, and merging locally similar pixel points to obtain different color regions;

其中,在对元素进行颜色聚类和边缘检测,以获得元素中不同的区域 的具体步骤为:首先在特征空间中任意选择一个特征点,在特征点周围划 定半径为R的圆形区域,计算中心点到区域内其他特征点的偏移向量,并 且规定离中心点越近的特征点对偏移向量的估计权重越大,计算公式如下:Among them, the specific steps of performing color clustering and edge detection on the elements to obtain different areas in the elements are: first, select a feature point arbitrarily in the feature space, and delimit a circular area with a radius of R around the feature point, Calculate the offset vector from the center point to other feature points in the area, and specify that the feature point closer to the center point has a greater estimated weight on the offset vector. The calculation formula is as follows:

Figure RE-RE-GDA0003587019560000071
Figure RE-RE-GDA0003587019560000071

依据求得的向量对中心点进行移动,然后进行迭代求解,当均值漂移 量满足小于设定的误差时停止移动,获得聚类图像,图像被划分成不同的 颜色区域,各区域的颜色由特征点的颜色代替,并存储各区域的颜色信息, 方便之后的颜色填充。The center point is moved according to the obtained vector, and then the solution is iteratively solved. When the mean shift is less than the set error, the movement is stopped, and a clustered image is obtained. The image is divided into different color areas, and the color of each area is determined by the feature. The color of the point is replaced, and the color information of each area is stored, which is convenient for subsequent color filling.

S23、对每个区域进行边缘结构的提取,利用多级边缘检测(canny) 算子对区域进行边缘检测,计算图像梯度大小和方向,进行非极大值抑制 以及双阈值筛选,获取区域边缘。S23. Extract the edge structure of each region, use the multi-level edge detection (canny) operator to detect the edge of the region, calculate the size and direction of the image gradient, perform non-maximum suppression and double-threshold screening, and obtain the edge of the region.

对于每一段连续的边缘,在曲线首尾两点A、B之间连接一条直线AB, 该直线为曲线的弦,计算得到曲线上离该直线段距离最大的点C,计算其 与AB的距离d。比较该距离与预先给定的阈值threshold的大小,如果小 于threshold,则该直线段作为曲线的近似,该段曲线处理完毕。如果距离 大于阈值,则用C将曲线分为两段AC和BC,并分别对两段曲线在此进行 上述计算。当所有曲线都处理完毕时,依次连接各个分割点形成的折线, 即可以作为曲线的近似。For each continuous edge, connect a straight line AB between the two points A and B at the beginning and end of the curve. The straight line is the chord of the curve. Calculate the point C with the largest distance from the straight line segment on the curve, and calculate its distance d from AB. . Compare the distance with the preset threshold threshold, if it is less than the threshold, the straight line segment is used as an approximation of the curve, and the curve of this segment is processed. If the distance is greater than the threshold, use C to divide the curve into two sections AC and BC, and perform the above calculation on the two sections of the curve respectively. When all the curves are processed, the polylines formed by connecting the dividing points in turn can be used as the approximation of the curve.

S3、对各区域边缘进行近似,转换成光滑矢量区域轮廓;S3. Approximate the edge of each area and convert it into a smooth vector area outline;

其中,S3包括以下步骤:Among them, S3 includes the following steps:

S31、通过道格拉斯-普克(Douglas-Peucker)算法将获得的边缘曲线 进行简化;S31. Simplify the obtained edge curve by the Douglas-Peucker algorithm;

S32、迭代选取曲线上距离对应直线段最远距离大于设定阈值的点作为 多边形顶点,将其连接获得拟合多边形;S32, iteratively select the point on the curve with the farthest distance from the corresponding straight line segment greater than the set threshold as the polygon vertex, and connect it to obtain a fitted polygon;

S33、利用贝塞尔曲线对所述多边形进行拟合与平滑,转换为准确光滑 的矢量轮廓。S33. Use Bezier curve to fit and smooth the polygon, and convert it into an accurate and smooth vector outline.

其中,三次贝塞尔曲线定义如下:Among them, the cubic Bezier curve is defined as follows:

Bn(t)=P0(1-t)3+3P1t(1-t)2+3P2t2(1-t)+P3t3,t∈[0,1];B n (t)=P 0 (1-t) 3 +3P 1 t(1-t) 2 +3P 2 t 2 (1-t)+P 3 t 3 ,t∈[0,1];

其中首位两个点为曲线段的起点和中点,中间的两个点则需要进行计 算所得。设过Pi点的切向方向与Pi-1Pi+1方向相同,且保证该点前面的控制 点与后面的控制点均在这条切线上即可,于是两个控制点的坐标如下:The first two points are the starting point and midpoint of the curve segment, and the two middle points need to be calculated. Set the tangential direction of the point P i to be the same as the direction of P i-1 P i+1 , and ensure that the control point in front of the point and the control point behind the point are all on this tangent line, so the coordinates of the two control points as follows:

Ai(xi+a(xi+1-xi-1),yi+a(yi+1-yi-1));A i (x i +a(x i+1 -x i-1 ),y i +a(y i+1 -y i-1 ));

Bi(xi+1+b(xi+2-xi),yi+1+b(yi+2-yi));B i (x i+1 +b(x i+2 -x i ),y i+1 +b(y i+2 -y i ));

根据多边形每条边的起点与终点以及控制点坐标,完成将多边形转变 为矢量轮廓。Converting the polygon to a vector outline is done based on the start and end points of each edge of the polygon and the coordinates of the control points.

S4、将各区域内数据信息进行整合,获取区域矢量化结果并进行保存, 输出子元素的矢量图。S4. Integrate the data information in each area, obtain and save the area vectorization result, and output the vector diagram of the sub-elements.

其中,所述数据信息包括矢量轮廓信息与颜色信息,且将结果写入svg 格式进行保存。Wherein, the data information includes vector outline information and color information, and the result is written in svg format for saving.

综上所述,借助于本发明的上述技术方案,通过较少的交互得到精确且完 整的子元素,并且通过矢量化技术,实现局部元素矢量化,得到其对应的矢量 素材,从而完成了传统文化图像中子元素矢量化的全部流程,获得了图像中局 部元素的矢量图。相对于一般的图像提取方法而言,本发明在元素提取时既保 证了提取轮廓的贴合度,又大大降低了交互次数,同时,本发明提出的两阶段 的流程使用户能够通过较少的交互,快速得到图像中局部的子元素矢量图,提 高了素材库中素材的质量,大大降低了文化素材二次创作的难度,使文化素材 发挥其最大的创作价值。To sum up, with the help of the above technical solutions of the present invention, accurate and complete sub-elements are obtained through less interaction, and local elements are vectorized through vectorization technology to obtain their corresponding vector materials, thus completing the traditional The whole process of vectorization of sub-elements in cultural images, and the vector diagrams of local elements in the image are obtained. Compared with the general image extraction method, the present invention not only ensures the fit of the extracted contour during element extraction, but also greatly reduces the number of interactions. At the same time, the two-stage process proposed by the present invention enables users to pass fewer Interaction, quickly get the local sub-element vector graphics in the image, improve the quality of the materials in the material library, greatly reduce the difficulty of secondary creation of cultural materials, and enable cultural materials to exert their maximum creative value.

以上所述仅为本发明的较佳实施例而已,并不用以限制本发明,凡在本发 明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发 明的保护范围之内。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the scope of the present invention. within the scope of protection.

Claims (10)

1. A vectorization method for a traditional culture memory symbol subgraph is characterized by comprising the following steps:
s1, calculating pixel points in the image, determining element outlines and extracting complete sub-elements;
s2, performing image processing on the sub-elements, and dividing the sub-elements into different areas;
s3, approximating the edges of each area and converting the edges into smooth vector area outlines;
and S4, integrating the data information in each region, acquiring and storing the regional vectorization result, and outputting the vector diagram of the sub-elements.
2. The method for performing vectorization on a traditionally cultural memory symbol subgraph according to claim 1, wherein the steps of calculating pixel points in an image, determining element outlines and extracting complete sub-elements comprise:
s11, selecting characteristic components representing the edges of the target elements, and carrying out weighted summation on the characteristic component costs to calculate the local costs from each pixel point to the adjacent pixel points;
s12, calculating the channel difference between adjacent pixel points by fusing the color gradient characteristics, and improving the fitting degree of the element extraction contour;
and S13, searching the minimum cost path by using the Dixtera algorithm to obtain the complete closed element outline.
3. The method for vectorization of a traditional culture memory symbol subgraph according to claim 2, wherein the feature components include laplacian zeros, gradient magnitude and gradient direction.
4. The method for performing vectorization on a traditional culture memory symbol subgraph according to claim 3, wherein the calculation formula for performing weighted summation on the feature component cost to calculate the local cost from each pixel point to the adjacent pixel point is as follows:
C(p,q)=wG·fG(q)+wZ·fZ(q)+wD·fD(p,q);
where C (p, q) denotes the local cost of the directed link from pixel p to neighboring pixel q, fZDenotes the Laplace zero, fGDenotes the magnitude of the gradient, fDDenotes the direction of the gradient, wG=0.43,wZ=0.43,wD=0.14。
5. The method for performing vectorization on a traditional culture memory symbol subgraph according to claim 4, wherein the channel difference between adjacent pixel points is calculated by fusing color gradient features, so as to improve the fit degree of element extraction outlines, and the method comprises the following steps:
s121, fusing color gradient characteristics, converting the image into a color system space, and separating Lab channels;
s122, calculating the difference between the L channel and the ab fusion channel between the adjacent pixel points, wherein the calculation formula is as follows:
fC(q)=(Cr⊙Cl,Ct⊙Cb);
Figure RE-FDA0003587019550000021
wherein f isC(q) represents a color gradient and (q),
Figure RE-FDA0003587019550000022
△Lij=△Li-△Lj,△aij=△ai-△aj,△bij=△bi-△bj,Cr、Cl、Ctand CbAnd respectively the weighted average values of the pixel points in the right, left, upper and lower neighborhoods in the space of the color system.
And S123, substituting the difference value into the calculation process of the local cost, improving the fitting degree of the element extraction outline, and reducing the interaction times.
6. The method for vectorization of a traditional culture memory symbol oriented subgraph according to claim 5, wherein the formula for substituting the difference value into the calculation process of the local cost is as follows:
C(p,q)=wG·[βfG(q)+(1-β)fZ(q)]+wZ·fZ(q)+wD·fD(p,q);
where C (p, q) denotes the local cost of the directed link from pixel p to neighboring pixel q, fZDenotes the Laplace zero point, fGDenotes the magnitude of the gradient, fDIndicating the direction of the gradient,wG=0.43,wZ=0.43,wD=0.14。
7. The method for vectorization of a traditional culture memory symbol subgraph according to claim 6, wherein the step of searching the minimum cost path by using the dix-tesla algorithm to obtain the complete closed element contour comprises the following steps:
s131, selecting any point on the element boundary for expansion, and adding the local cost of the point to the adjacent node;
s132, selecting the adjacent node with the minimum accumulated cost to continue expansion;
and S133, repeating the node expansion to form a sequence until the sequence is superposed with the initial point, and acquiring a complete closed element outline.
8. The method for performing traditional culture memory symbol oriented subgraph vectorization according to claim 1, wherein the sub-elements are subjected to image processing and divided into different regions, and the method comprises the following steps:
s21, clustering the areas in the image by using a clustering algorithm, and setting a certain spatial distance and a certain color distance;
s22, carrying out multiple iterations, replacing the original pixel values with the converged pixel values, merging locally similar pixel points, and obtaining different color regions;
s23, extracting the edge structure of each region, performing edge detection on the regions by using a multi-stage edge detection operator, calculating the size and the direction of the image gradient, performing non-maximum suppression and double-threshold screening, and acquiring the region edges.
9. The method for performing vectorization on a traditional culture memory symbol subgraph according to claim 1, wherein the approximating each region edge to a smooth vector region contour comprises the following steps:
s31, simplifying the obtained edge curve through a Douglas-Pock algorithm;
s32, iteratively selecting points on the curve, which are farthest from the corresponding straight-line segment and larger than a set threshold value, as polygon vertexes, and connecting the points to obtain a fitting polygon;
and S33, fitting and smoothing the polygon by using a Bezier curve, and converting the polygon into an accurate and smooth vector contour.
10. The method for performing subpicture vectorization on a traditional culture memory symbol according to claim 1, wherein the data information comprises vector contour information and color information.
CN202210105751.4A 2022-01-28 2022-01-28 A method for vectorization of sub-graphs of traditional cultural memory symbols Active CN114461829B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210105751.4A CN114461829B (en) 2022-01-28 2022-01-28 A method for vectorization of sub-graphs of traditional cultural memory symbols

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210105751.4A CN114461829B (en) 2022-01-28 2022-01-28 A method for vectorization of sub-graphs of traditional cultural memory symbols

Publications (2)

Publication Number Publication Date
CN114461829A true CN114461829A (en) 2022-05-10
CN114461829B CN114461829B (en) 2024-11-26

Family

ID=81411020

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210105751.4A Active CN114461829B (en) 2022-01-28 2022-01-28 A method for vectorization of sub-graphs of traditional cultural memory symbols

Country Status (1)

Country Link
CN (1) CN114461829B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116403211A (en) * 2023-03-24 2023-07-07 无锡市第二人民医院 Segmentation and clustering method and system based on single-cell pathology image cell nuclei

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH10143654A (en) * 1996-11-08 1998-05-29 Sony Corp Outline extracting device and outline extracting method
CN101980317A (en) * 2010-09-03 2011-02-23 浙江大学 Traffic flow prediction method based on road network extraction from remote sensing map based on improved C-V model
CN107273608A (en) * 2017-06-13 2017-10-20 中国石油大学(华东) A kind of reservoir geology profile vectorization method
CN113706648A (en) * 2021-08-04 2021-11-26 武汉理工大学 Down Ka element vectorization method based on diffusion curve
CN113963006A (en) * 2021-11-18 2022-01-21 重庆文理学院 Method and device for constructing retinal vessel vectorization model and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH10143654A (en) * 1996-11-08 1998-05-29 Sony Corp Outline extracting device and outline extracting method
CN101980317A (en) * 2010-09-03 2011-02-23 浙江大学 Traffic flow prediction method based on road network extraction from remote sensing map based on improved C-V model
CN107273608A (en) * 2017-06-13 2017-10-20 中国石油大学(华东) A kind of reservoir geology profile vectorization method
CN113706648A (en) * 2021-08-04 2021-11-26 武汉理工大学 Down Ka element vectorization method based on diffusion curve
CN113963006A (en) * 2021-11-18 2022-01-21 重庆文理学院 Method and device for constructing retinal vessel vectorization model and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
闫博栋;李学明;赵海英;: "应用特征点的彩色图像边缘检测算法", 信号处理, no. 09, 25 September 2015 (2015-09-25) *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116403211A (en) * 2023-03-24 2023-07-07 无锡市第二人民医院 Segmentation and clustering method and system based on single-cell pathology image cell nuclei
CN116403211B (en) * 2023-03-24 2024-04-26 无锡市第二人民医院 Segmentation and clustering method and system based on single-cell pathology image cell nuclei

Also Published As

Publication number Publication date
CN114461829B (en) 2024-11-26

Similar Documents

Publication Publication Date Title
Wei et al. BuildMapper: A fully learnable framework for vectorized building contour extraction
CN113435240A (en) End-to-end table detection and structure identification method and system
US7106330B2 (en) Drawing comparison apparatus
CN102282572B (en) Method and system for representing image patches
JP4726257B2 (en) Image processing method and apparatus
CN106952338B (en) Three-dimensional reconstruction method and system based on deep learning and readable storage medium
JP2011034178A (en) Apparatus and method for image processing, and program
CN102346912A (en) Image processing apparatus, image processing method, and program
CN113673541A (en) Image sample generation method for target detection and application
Franken et al. Rebuilding the cadastral map of The Netherlands, the artificial intelligence solution
Mena Automatic vectorization of segmented road networks by geometrical and topological analysis of high resolution binary images
CN114461829A (en) Method for vectorization of traditional culture memory symbol subgraph
US20220391553A1 (en) Building information modeling systems and methods
JP5566158B2 (en) Image processing method, image processing apparatus, and program
JP2008134791A (en) Image processor and image processing program
CN112419208A (en) Construction drawing review-based vector drawing compiling method and system
CN111435537B (en) Model training method and device and pose optimization method and device based on mosaic
JP4873554B2 (en) Image distribution apparatus and image distribution method
CN114943823A (en) Unmanned aerial vehicle image splicing method and system based on deep learning semantic perception
Xia et al. Vectorizing historical maps with topological consistency: A hybrid approach using transformers and contour-based instance segmentation
JP2000048052A (en) Method and device for verifying layout
JP4313178B2 (en) Method and apparatus for creating vectorized figures
JP3935997B2 (en) How to convert a drawing file to an intermediate format
JPH0461558A (en) Picture processing method
JP4687558B2 (en) Image collation device, image collation method and program

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant