CN111857380A - 一种手写原笔迹曲线平滑的实现方法 - Google Patents
一种手写原笔迹曲线平滑的实现方法 Download PDFInfo
- Publication number
- CN111857380A CN111857380A CN202010734109.3A CN202010734109A CN111857380A CN 111857380 A CN111857380 A CN 111857380A CN 202010734109 A CN202010734109 A CN 202010734109A CN 111857380 A CN111857380 A CN 111857380A
- Authority
- CN
- China
- Prior art keywords
- smooth
- points
- pen
- point
- sampling
- 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.)
- Withdrawn
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/01—Input arrangements or combined input and output arrangements for interaction between user and computer
- G06F3/03—Arrangements for converting the position or the displacement of a member into a coded form
- G06F3/033—Pointing devices displaced or positioned by the user, e.g. mice, trackballs, pens or joysticks; Accessories therefor
- G06F3/0354—Pointing devices displaced or positioned by the user, e.g. mice, trackballs, pens or joysticks; Accessories therefor with detection of 2D relative movements between the device, or an operating part thereof, and a plane or surface, e.g. 2D mice, trackballs, pens or pucks
- G06F3/03545—Pens or stylus
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/01—Input arrangements or combined input and output arrangements for interaction between user and computer
- G06F3/03—Arrangements for converting the position or the displacement of a member into a coded form
- G06F3/041—Digitisers, e.g. for touch screens or touch pads, characterised by the transducing means
- G06F3/0412—Digitisers structurally integrated in a display
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/01—Input arrangements or combined input and output arrangements for interaction between user and computer
- G06F3/03—Arrangements for converting the position or the displacement of a member into a coded form
- G06F3/041—Digitisers, e.g. for touch screens or touch pads, characterised by the transducing means
- G06F3/0414—Digitisers, e.g. for touch screens or touch pads, characterised by the transducing means using force sensing means to determine a position
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/01—Input arrangements or combined input and output arrangements for interaction between user and computer
- G06F3/03—Arrangements for converting the position or the displacement of a member into a coded form
- G06F3/041—Digitisers, e.g. for touch screens or touch pads, characterised by the transducing means
- G06F3/0416—Control or interface arrangements specially adapted for digitisers
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T11/00—2D [Two Dimensional] image generation
- G06T11/20—Drawing from basic elements, e.g. lines or circles
- G06T11/203—Drawing of straight lines or curves
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- Image Generation (AREA)
Abstract
本发明公开了一种手写原笔迹曲线平滑的实现方法,获取手写笔的原始采样点坐标和压力值;通过平滑拟合算法对采样点进行拟合,获取笔划轨迹,得到平滑的坐标点;根据采样点压感计算笔宽,即经过采样点需要的笔宽;分别计算过两个采样点连线的垂线段,以采样点为中心,以笔宽为线段长;得到线段的四个关键点坐标;用贝塞尔曲线将四个关键点连接形成一个封闭图形,填充整个图形。本发明保证了每个点都是连接在一起的,宽度的改变是平滑的,放大也是平滑的,不会产生竹节结果。笔迹平滑圆润,笔锋变化均匀,笔锋平滑无竹节现象,书写手感丝滑、流畅、可控。
Description
技术领域
本发明涉及电子绘制技术领域,具体涉及一种手写原笔迹绘制过程中曲线的平滑绘制及笔锋效果的实现方法。
背景技术
现在支持手写笔的屏、平板、手机越来越多,手写输入技术也让原始的笔纸有了替代品,人们希望电子笔迹更符合实际纸上笔迹效果。但是,现有的相关技术还无法使得电子笔迹与实际纸上笔迹近似,还无法满足用户的书写需求。
现有的手写笔迹算法使用的是曲线拟合算法,如贝塞尔,是先将采集到手写笔样点的坐标和压力值存储,然后拟合这些采样点。为了绘制出近似曲线,需要将曲线上的每一个点根据采样点坐标与压力值计算且绘制出来。但是,由于曲线上的点非常多,绘制效率慢,数据存储量大,将数据放大后会出现明显的笔划竹节效果(如图1所示)。
发明内容
本发明提供一种笔迹填充算法,解决笔迹的书写过程中由采样点压力的变化引起笔宽变化引起的不平滑过渡现象,以达到书写过程中更流畅真实的还原笔迹效果,提高用户书写体验。
为实现上述目的,本发明采用以下技术方案。一种手写原笔迹曲线平滑的实现方法,其步骤如下:
1)获取手写笔的原始采样点坐标和压力值;
2)通过平滑拟合算法对采样点进行拟合,获取笔划轨迹,得到平滑的坐标点;
3)根据采样点压感计算笔宽,即经过采样点需要的笔宽;
4)分别计算过两个采样点连线的垂线段,以采样点为中心,以笔宽为线段长,得到线段的四个关键点坐标;
5)用贝塞尔曲线将四个关键点连接形成一个封闭图形,填充整个图形。
本发明保证了每个点都是连接在一起的,宽度的改变是平滑的,放大也是平滑的,不会产生竹节结果。笔迹平滑圆润,笔锋变化均匀,笔锋平滑无竹节现象,书写手感丝滑、流畅、可控。
附图说明
图1是本发明的方法流程图;
图2为手写笔原始采样点示意图;
图中:s1,s2,s3...sn为原始采样点。
图3为原始采样点经过拟合后的平滑采样点示意图;
图中:p1,p2,p3...pn为拟合后的平滑采样点。
图4为本发明实施例中计算平滑采样点p2与p3的中间点p23坐标和压感的示意图;
图5为本发明实施例中计算平滑采样点p1和中间点p23时笔宽w的示意图;
图6为本发明实施例中分别以平滑采样点p1和中间点p23为中点,以笔宽w1和笔宽w23为长度,所作与平滑采样点p1和中间点p23两点间直线示意图;
图中:A、B、C和D为垂直线段的端点。
图7为本发明实施例中计算垂直线段的端点A-B、B-C、C-D和D-A四条边连续三次贝塞尔曲线所需控制点的示意图;
图中: c1、c2、c3、c4、c5、c6、c7和c8为控制点。
图8为本发明实施例中端点A-B、B-C、C-D和D-A四条边绘制塞尔曲线后的轮廓示意图;
图9为本发明实施例中按照端点A-B、B-C、C-D和D-A 四条边绘制塞尔曲线后的填充示意图;
图10是曲线拟合算法笔迹压力变化绘制表现的竹节效果图;
图11是本发明实施例中的笔迹压力变化表现的效果图。
具体实施方式
以下结合附图和实施例对本发明做进一步说明。参见图1至图11,一种手写原笔迹曲线平滑的实现方法,其步骤如下(如图1所示):
1)获取手写笔的原始采样点坐标和压力值;
2)通过平滑拟合算法对采样点进行拟合,获取笔划轨迹,得到平滑的坐标点;
3)根据采样点压感计算笔宽,即经过采样点需要的笔宽;
4)分别计算过两个采样点连线的垂线段,以采样点为中心,以笔宽为线段长,得到线段的四个关键点坐标;
5)用贝塞尔曲线将四个关键点连接形成一个封闭图形,填充整个图形。
实施例:
获取手写笔的原始采样点记为s1,s2,s3...sn,采样点s1表示为s1(x1,y1,q1),x1为当前采样点横坐标,y1为当前采样点纵坐标,q1为当前采样点压力值,以此规律sn表示为sn(xn,yn,qn)(如图2所示)。
1)将s1,s2,s3...sn进行平滑拟合后得到平滑后的拟合点p1,p2,p3...pn,pn表示为(xn,yn,qn) (如图3所示)。
2)根据笔宽计算公式w=kq, w为笔宽,k为预设笔宽常数,q为压力值。通过计算可以得到p1,p2,p3...pn每个拟合点的笔宽w1,w2,w3...wn。
3)计算p2,p3两拟合点的中点p23,x23 = (x2 + x3) / 2, y23 = (y2 + y3) /2,q23 = (q2 + q3) / 2, p23(x23, y23, q23) (如图4所示)。
4)根据第3步的笔宽计算公式,计算出p1的笔宽为w1,p23的笔宽为w23(如图5所示)。
5)根据p1,p23两点坐标确定一条直线,计算以p1,p23两点为中点,长度为w1,w23的关于这条直线的垂直线段,取两线段端点坐标表示为A,B,C,D(如图6所示)。
6)在A到B,C到D画三次贝塞尔曲线,需要计算贝塞尔曲线控制点c1,c2,c5,c6,以p2为中点,长度为w1画关于p1,p23的垂直线段,取两端点坐标计为c1,c5,再以p2为中间,长度为w23画关于p1,p23的垂直线段,取两端点坐标计为c2,c6。A-B贝塞尔曲线关键点A,c1,c2,B,C-D贝塞尔曲线关键点C,c5,c6,D(如图7所示)。
7)在B到C画三次贝塞尔曲线,需要计算贝塞尔曲线控制点c3,c4,沿p1,p23连接的直线将线段B-C平移w23/2个距离,得到控制点坐标c3,c4。B-C贝塞尔曲线的关键点B,c3,c4,C(如图7所示)。
8)在D到A画三次贝塞尔曲线,需要计算贝塞尔曲线控制点c7,c8,沿p1,p23连接的直线将线段D-A平移w1/2个距离,得到控制点坐标c7,c8。D-A贝塞尔曲线的关键点D,c7,c8,A(如图7所示)。
9)将A-B,B-C,C-D,D-A的贝塞尔曲线路径围成的区域填充,如图8展示区域轮廓,图9展示填充后的效果。
本发明在绘制两点宽度渐变时,不需要通过画贝塞曲线上的所有点不停的改变点的直径,再将所有点连接成线;只需要确定几个点坐标,就能将中间的内容一次性填充,不停改变点的直径放大会出现竹节式的宽度变化结果。保证了每个点连接在一起,并且宽度的改变也是平滑的,放大效果也是平滑的,不会产生竹节结果(如图10所示)。笔迹压力变化平滑圆润,笔锋变化均匀(如图11所示),书写手感丝滑、流畅、可控。
Claims (1)
1.一种手写原笔迹曲线平滑的实现方法,其特征在于,其步骤如下:
1)获取手写笔的原始采样点坐标和压力值;
2)通过平滑拟合算法对采样点进行拟合,获取笔划轨迹,得到平滑的坐标点;
3)根据采样点压感计算笔宽,即经过采样点需要的笔宽;
4)分别计算过两个采样点连线的垂线段,以采样点为中心,以笔宽为线段长,得到线段的四个关键点坐标;
5)用贝塞尔曲线将四个关键点连接形成一个封闭图形,填充整个图形。
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010734109.3A CN111857380A (zh) | 2020-07-28 | 2020-07-28 | 一种手写原笔迹曲线平滑的实现方法 |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010734109.3A CN111857380A (zh) | 2020-07-28 | 2020-07-28 | 一种手写原笔迹曲线平滑的实现方法 |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111857380A true CN111857380A (zh) | 2020-10-30 |
Family
ID=72947386
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010734109.3A Withdrawn CN111857380A (zh) | 2020-07-28 | 2020-07-28 | 一种手写原笔迹曲线平滑的实现方法 |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111857380A (zh) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112817465A (zh) * | 2021-02-04 | 2021-05-18 | 深圳市康冠商用科技有限公司 | 屏幕笔画自适应调整方法、装置、显示终端及存储介质 |
CN113760432A (zh) * | 2021-08-30 | 2021-12-07 | 浙江万朋教育科技股份有限公司 | 一种基于H5 Canvas实现还原手写笔迹的涂鸦方法 |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102081803A (zh) * | 2011-01-20 | 2011-06-01 | 周佳 | 一种手写原笔迹的笔锋实现方法 |
CN201904597U (zh) * | 2010-12-17 | 2011-07-20 | 上海市电力公司 | 一种高压直流交联聚乙烯电缆预制型接头 |
TW201237775A (en) * | 2011-01-31 | 2012-09-16 | Beijing Ereneben Inf Tech Co Ltd | Method and device for implementing original handwriting, and electronic device |
CN105225260A (zh) * | 2015-09-25 | 2016-01-06 | 中国电子科技集团公司第三十二研究所 | 一种手写原笔迹实现方法 |
CN107239216A (zh) * | 2016-03-28 | 2017-10-10 | 北大方正集团有限公司 | 基于触摸屏的绘制处理方法和装置 |
CN107526526A (zh) * | 2017-09-19 | 2017-12-29 | 广州视源电子科技股份有限公司 | 确定压感笔迹区域的方法及装置 |
CN108121690A (zh) * | 2016-11-29 | 2018-06-05 | 北大方正集团有限公司 | 字体处理方法和装置 |
CN111223165A (zh) * | 2020-01-03 | 2020-06-02 | 福建升腾资讯有限公司 | 一种生成无锯的签字图片的方法、装置和设备 |
-
2020
- 2020-07-28 CN CN202010734109.3A patent/CN111857380A/zh not_active Withdrawn
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN201904597U (zh) * | 2010-12-17 | 2011-07-20 | 上海市电力公司 | 一种高压直流交联聚乙烯电缆预制型接头 |
CN102081803A (zh) * | 2011-01-20 | 2011-06-01 | 周佳 | 一种手写原笔迹的笔锋实现方法 |
TW201237775A (en) * | 2011-01-31 | 2012-09-16 | Beijing Ereneben Inf Tech Co Ltd | Method and device for implementing original handwriting, and electronic device |
CN105225260A (zh) * | 2015-09-25 | 2016-01-06 | 中国电子科技集团公司第三十二研究所 | 一种手写原笔迹实现方法 |
CN107239216A (zh) * | 2016-03-28 | 2017-10-10 | 北大方正集团有限公司 | 基于触摸屏的绘制处理方法和装置 |
CN108121690A (zh) * | 2016-11-29 | 2018-06-05 | 北大方正集团有限公司 | 字体处理方法和装置 |
CN107526526A (zh) * | 2017-09-19 | 2017-12-29 | 广州视源电子科技股份有限公司 | 确定压感笔迹区域的方法及装置 |
CN111223165A (zh) * | 2020-01-03 | 2020-06-02 | 福建升腾资讯有限公司 | 一种生成无锯的签字图片的方法、装置和设备 |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112817465A (zh) * | 2021-02-04 | 2021-05-18 | 深圳市康冠商用科技有限公司 | 屏幕笔画自适应调整方法、装置、显示终端及存储介质 |
CN112817465B (zh) * | 2021-02-04 | 2023-08-11 | 深圳市康冠商用科技有限公司 | 屏幕笔画自适应调整方法、装置、显示终端及存储介质 |
CN113760432A (zh) * | 2021-08-30 | 2021-12-07 | 浙江万朋教育科技股份有限公司 | 一种基于H5 Canvas实现还原手写笔迹的涂鸦方法 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111857380A (zh) | 一种手写原笔迹曲线平滑的实现方法 | |
US7589720B2 (en) | Mesh editing with gradient field manipulation and user interactive tools for object merging | |
US8994736B2 (en) | Methods and apparatus for freeform deformation of 3-D models | |
CN107526526B (zh) | 确定压感笔迹区域的方法及装置 | |
US9134821B2 (en) | Method and device for implemeting original calligraphy of handwriting | |
EP2488930B1 (en) | Method and apparatus for drawing and erasing calligraphic ink objects on a display surface | |
JP5706001B2 (ja) | 手書き原筆跡の実現方法、実現装置及び電子装置 | |
CN105183316B (zh) | 一种生成颜文字的方法和装置 | |
CN105069104A (zh) | 一种动态漫画的生成方法与系统 | |
CN111815743A (zh) | 一种数字墨水手写笔迹美化的方法 | |
US11069099B2 (en) | Drawing curves in space guided by 3-D objects | |
CN102938157B (zh) | 一种基于圆域b样条曲线的风格化手绘生成方法与系统 | |
CN103838429A (zh) | 触摸屏上毛笔效果的绘制方法及系统 | |
CN103678261A (zh) | 一种快速显示ttf字体的方法、装置及设备 | |
CN104268915A (zh) | 一种手写汉字的实时轮廓美化方法 | |
CN106648395B (zh) | 一种书写笔迹分段平滑方法和系统 | |
CN103336590A (zh) | 一种输入方法及装置 | |
CN112232022B (zh) | 动态调整参数的汉字字形与布局设计方法和系统 | |
CN111223165A (zh) | 一种生成无锯的签字图片的方法、装置和设备 | |
TW202347265A (zh) | 原筆跡手寫筆鋒的生成方法 | |
CN114585992B (zh) | 书写轨迹处理方法、触控设备、书写系统及存储介质 | |
US20080129726A1 (en) | Silhouette rendering apparatus and method using 3d temporal coherence for rigid object | |
Joshi | Curve-based shape modeling a tutorial | |
CN103196455A (zh) | 显示道路名称的方法、装置、服务器和系统 | |
Bujans | A thesis on sketch-based techniques for mesh deformation and editing |
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 | ||
WW01 | Invention patent application withdrawn after publication | ||
WW01 | Invention patent application withdrawn after publication |
Application publication date: 20201030 |