手写汉字的矢量化算法与实现毕业论文
2021-03-13 23:48:45
摘 要
随着人们生活水平的不断提高以及互联网的快速发展,笔记本电脑,手机等越来越普及,大家通过这些设备进行信息交流也越来越频繁。而我们进行交流的方式毫无疑问是汉字,但普通的设备内的汉字并不能满足如签名,水印等操作,这些地方还是用的个人的手写字。因此手写汉字如何进行矢量化并能无失真地显示也成了一个研究课题。本论文研究的课题正是手写汉字的矢量化算法及实现,以满足手机等终端设备对手写字进行旋转缩放等操作而不失真的功能。
本文设计了一种手写汉字矢量化的实现算法,其主要过程分为三步,轮廓提取,曲线拟合以及多边形填充。轮廓提取中首先使用Roberts算子对原始图像进行边缘提取,并且分析了几种算子的优劣。然后使用一种8邻域轮廓跟踪算法,首先找到图像最左上角的轮廓点作为起始点,接着搜寻其8个邻域找到下一轮廓点,重复上一步,直到找回起始点。曲线拟合提出了两种思路,一是分段拟合,即把得到的边界点分为若干段,每一段都用贝塞尔曲线做拟合,并对两种容易产生失真的情况进行了特殊处理,利用贝塞尔曲线相邻端点处可平滑连接的特点,即能得到完整的封闭曲线;二是利用拐点拟合,找出曲率变化较大处作为拐点,然后对相邻拐点用贝塞尔曲线做拟合,最终得到完整封闭曲线。曲线拟合也分析对比了多项式和B样条曲线的效果,并与贝塞尔曲线比较。多边形填充使用的是Alternate模式,该模式填充方式为间隔填充,对汉字有较好效果。最终成功得到矢量化后的汉字,并且对其进行了旋转,放大的操作,均未出现字体失真的情况。
关键词:手写字矢量化;八邻域轮廓跟踪;曲线拟合;贝塞尔曲线
Abstract
With the rising living standards and the rapid development of the Internet, laptops and mobile phones are becoming more and more popular,People are communicating more and more frequently through these devices.And the way we communicate is undoubtedly Chinese ,but the Chinese characters in ordinary equipment cannot satisfy such operations as signatures, watermarks and so on these places are still written by the hand of the individual .So how does a handwritten character make a vectoring and undistorted display become a research subject .This thesis research topic vector quantization algorithm and realization of handwritten Chinese characters, in order to meet the mobile terminal equipment such as opponents rotate zoom operations such as writing and do not break really function.
This paper introduces the implementation algorithm of a stylized Chinese character, which is divided into three steps, the contour extraction, the curve fitting and the polygon filling. In this paper, the original image is extracted by using the Roberts operator, and the advantages and disadvantages of several operators are analyzed. Then use a 8 neighborhood contour tracking algorithm, first find the top left corner of the image the contour points as a starting point, then the eight neighborhood search next contour point, repeat the step above, until I find the starting point. Proposes the two kinds of curve fitting, it is piecewise fitting, namely the boundary points are divided into several segments, each segment with Bessel curve fitting, and the two prone to distortion situation has carried on the special processing, using bezier curve between two adjacent to the characteristics of smooth connection, which can get the full closed curve; Second, using inflection point fitting, find out the curvature change as a turning point, with strong then the adjacent point with bezier curve fitting, finally be complete closed curve. The curve fitting also compares the effect of the polynomial and the B spline curve, and compares it with the Bessel curve. The Alternate mode is filled in by polygons, which is filled in by spacing and has a good effect on Chinese characters. In the end, the characters of the vector were successfully obtained, and the operation was rotated and enlarged, without the distortion of the font.
KeyWords:Hand written vectorization;Eightneighborhood contours;Curve fitting;Beziercurve
目 录
第1章 绪论 1
1.1 课题的研究背景及研究意义 1
1.2 论文研究内容与章节安排 3
第2章 汉字轮廓提取 4
2.1 汉字矢量化原理 4
2.2 轮廓提取 5
2.3 边界坐标点提取 7
第3章 曲线拟合及多边形填充 10
3.1 拐点拟合 10
3.1.1 拐点的获取 10
3.1.2 t值对拐点的影响 12
3.1.3 贝塞尔曲线拐点拟合 13
3.2 分段曲线拟合 13
3.2.1 曲线类型的选择 14
3.2.2 贝塞尔曲线分段拟合 15
3.2.3 其他曲线拟合效果对比 18
3.3 多边形填充 21
3.4 结果展示 23
第4章 总结与展望 25
4.1 工作总结 25
4.2 工作展望 25
参考文献 26
致谢 27
第1章 绪论
1.1 课题的研究背景及研究意义
信息化已经成为新世纪的代名词,随着各种智能手机,平板电脑等智能终端设备的身影出现的越来越多,人们对其使用率也越来越高,俨然已经成为生活中不可分割的一部分。很多人用这些智能终端来与别人交流,这时就会需要用户使用输入法或者直接在终端上手写汉字进行信息传输。因此,就会需要对用户手写汉字进行矢量化处理来适应终端对手写字的缩放旋转等操作[1]。
本文选题来源于现实生活中遇到的问题,设计一种对手写汉字矢量化的算法,来满足各设备对其进行缩放旋转等操作的功能。
在说矢量汉字之前就不得不说一下点阵汉字,点阵汉字也叫位图字体,是早期电脑系统普遍采用的文字,其通过像素点来描述的字体。一般情况下,一个汉字是采用16*16的点阵,即颜色分为前景色和背景色的256个像素点来描述[2]。一个汉字根据其笔划存在点阵中,有笔划经过的点就被填充上前景色,没笔划经过的点就被填充上背景色[3]。由于其原理简单,储存空间小,并且显示速度快,今天仍然是大多数地方使用字体的首选,比如LED广告牌等不需要精细文字的地方。但其缺点也是很明显的,在放大以后会出现失真,产生马赛克形式的锯齿边缘,美观程度大打折扣。因此矢量字就适时出现了。
矢量字体是由点阵字体发展而来的一种字体。矢量字体是通过曲线来描述不同的笔划或线段,最终组合起来变成一个矢量字,目前使用最多的是贝塞尔曲线,一个字里可以用不同的方法提取一些特征点,相邻特征点之间会由一条光滑的曲线或者直线来进行连接,通过拐点坐标可以来唯一确定这条曲线[4]。矢量字的优点就是可以进行任意放大缩小或旋转等操作而不会产生形变。