CN105373798A - A calligraphy character extraction method based on K-nearest neighbor matting and mathematical morphology - Google Patents

A calligraphy character extraction method based on K-nearest neighbor matting and mathematical morphology Download PDF

Info

Publication number
CN105373798A
CN105373798A CN201510810577.3A CN201510810577A CN105373798A CN 105373798 A CN105373798 A CN 105373798A CN 201510810577 A CN201510810577 A CN 201510810577A CN 105373798 A CN105373798 A CN 105373798A
Authority
CN
China
Prior art keywords
image
calligraphy
reference image
edge
information
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
CN201510810577.3A
Other languages
Chinese (zh)
Other versions
CN105373798B (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.)
NORTHWEST UNIVERSITY
Original Assignee
NORTHWEST UNIVERSITY
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 NORTHWEST UNIVERSITY filed Critical NORTHWEST UNIVERSITY
Priority to CN201510810577.3A priority Critical patent/CN105373798B/en
Publication of CN105373798A publication Critical patent/CN105373798A/en
Application granted granted Critical
Publication of CN105373798B publication Critical patent/CN105373798B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/44Local feature extraction by analysis of parts of the pattern, e.g. by detecting edges, contours, loops, corners, strokes or intersections; Connectivity analysis, e.g. of connected components
    • G06V10/443Local feature extraction by analysis of parts of the pattern, e.g. by detecting edges, contours, loops, corners, strokes or intersections; Connectivity analysis, e.g. of connected components by matching or filtering

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Character Input (AREA)

Abstract

本发明公开了一种基于K近邻抠图和数学形态学的书法字提取方法,通过K近邻抠图建立参考图像,根据书法图像墨浓淡变化复杂的特点,利用基于数学形态学的边缘提取方法,分别在字体内部和边缘做不同窗口大小的引导滤波,再利用图像融合技术寻找更多的形质和神采信息。本发明能更准确地提取书法作品本身所具有的书法家的情感和个性的神采信息,特别是针对中国古代书法作品中墨浓淡变化复杂,字体边缘模糊的贴图像能够更准确地提取汉字信息,尤其是对于汉字的神采信息的提取效果显著。

The invention discloses a method for extracting calligraphy characters based on K-nearest neighbor matting and mathematical morphology. A reference image is established through K-nearest neighbor matting. According to the characteristics of complex changes in the ink density of calligraphy images, an edge extraction method based on mathematical morphology is used. Guided filtering of different window sizes is performed on the inside and edge of the font, and then image fusion technology is used to find more information about shape, quality and spirit. The present invention can more accurately extract the calligrapher's emotional and personality information of the calligraphic works themselves, especially for the pasted images with complex ink shades and fuzzy font edges in ancient Chinese calligraphy works, which can more accurately extract Chinese character information, Especially for the extraction of the information of Chinese characters, the effect is remarkable.

Description

一种基于K近邻抠图和数学形态学的书法字提取方法A calligraphy character extraction method based on K-nearest neighbor matting and mathematical morphology

技术领域technical field

本发明属于图像处理技术领域,涉及一种中国书法艺术研究和历史文化遗产保护领域中基于K近邻抠图和数字形态学的书法艺术信息提取方法,用于书法作品图像中汉字的神采信息提取。The invention belongs to the technical field of image processing, and relates to a calligraphy art information extraction method based on K-nearest neighbor matting and digital morphology in the fields of Chinese calligraphy art research and historical and cultural heritage protection, which is used for extracting the spirit information of Chinese characters in calligraphy works images.

背景技术Background technique

在中国书法艺术研究和历史文化遗产保护领域中,为能够从中国古代书法作品中更完整、更准确地提取汉字的形质和神采信息而采用图像预处理和图像分割的方法。目前对汉字信息的提取方法主要是采用将图像去噪、边缘检测和图像分割等相结合的方法以对汉字的形质信息进行提取。In the field of Chinese calligraphy art research and historical and cultural heritage protection, image preprocessing and image segmentation methods are used to extract the shape, quality and spirit information of Chinese characters more completely and accurately from ancient Chinese calligraphy works. At present, the method of extracting Chinese character information mainly adopts the method of combining image denoising, edge detection and image segmentation to extract the shape and quality information of Chinese characters.

北京大学的专利申请“一种图片文字检测的方法”(公开号:CN101122952,授权日:2008年2月13日,申请日:2007年9月21日)中公开了一种图片文字检测的方法。该方法首先合并原图在各个颜色分量上的边缘图,得到累积边缘图;然后把累积边缘图中的边缘点置为其在原图中的相应颜色,根据边缘点颜色的不同,用聚类的方法把累积边缘图分解成若干张子边缘图;最后在每张子边缘图中,多次进行水平和垂直投影,根据投影图进行垂直方向和水平方向的区域分割,定位图片中的文字区域。该方法能够较为准确地获得图像中文字的区域信息以及文字的形质信息,但是该方法中检测文字信息的关键主要依赖于图像的边缘信息,即主要关注文字的形质信息,而没有考虑文字的神采信息,从而导致检测的文字信息不够完整,给后期书法作品的研究工作带来不利影响。Peking University's patent application "a method for detecting text in pictures" (publication number: CN101122952, date of authorization: February 13, 2008, date of application: September 21, 2007) discloses a method for detecting text in pictures . This method first merges the edge maps of the original image on each color component to obtain the cumulative edge map; then sets the edge points in the cumulative edge map to their corresponding colors in the original image, and uses the clustering method according to the color of the edge points. The method decomposes the cumulative edge map into several sub-edge maps; finally, in each sub-edge map, multiple horizontal and vertical projections are performed, and the vertical and horizontal regions are segmented according to the projection map to locate the text area in the picture. This method can accurately obtain the area information of the text in the image and the shape and quality information of the text, but the key to detecting the text information in this method mainly depends on the edge information of the image, that is, it mainly focuses on the shape and quality information of the text, and does not consider the text information. As a result, the detected text information is not complete enough, which has a negative impact on the research work of later calligraphy works.

XiaoqingLu等人在文献“XiaoqingLu,ZhiTang,YanLiu,LiangcaiGao,TingWang,ZhipengWang.‘Stroke-basedCharacterSegmentationofLow-qualityImagesonAncientChineseTablet’[C],201312thInternationalConferenceonDocumentAnalysisandRecognition”,2013年中提出了一种基于Stroke的低质量古代碑图像中汉字提取方法。该方法的具体步骤包括:(1)对原始碑图像进行去噪预处理;(2)对去噪后的图像应用基于映射的分割方法得到初始分割结果;(3)利用自适应Otsu方法设置最小强度阈值,以获得Stroke滤波掩模,并使用该掩模对去噪后图像进行滤波处理,以得到Stroke的强度信息;(4)将步骤2中得到的分割结果和步骤3中得到的滤波掩模以选择具有较高Stroke强度的连同成分作为初始种子;(5)基于种子窗口内的引导信息,使用一个迭代的过程,以提取碑图像中含有的汉字信息;(6)迭代结束后,得到的分割结果即为提取的汉字信息。该方法虽然能够较好地处理碑图像中裂痕对汉字提取的影响,并且能够更完整地提取出碑图像中的汉字信息。但是该方法只关注汉字形质信息的提取,难以应用于贴图像中汉字神采信息的提取;并且方法实现过程中,较多的参数是根据经验获得。因此,方法存在较大的局限性。XiaoqingLu et al. In the document "XiaoqingLu, ZhiTang, YanLiu, LiangcaiGao, TingWang, ZhipengWang.'Stroke-basedCharacterSegmentationofLow-qualityImagesonAncientChineseTablet'[C], 201312thInternationalConferenceonDocumentAnalysisandRecognition", in 2013, a Chinese character extraction based on low-quality ancient Chinese tablet images was proposed. method. The specific steps of the method include: (1) denoising and preprocessing the original stele image; (2) applying a mapping-based segmentation method to the denoised image to obtain the initial segmentation result; (3) using the adaptive Otsu method to set the minimum Intensity threshold to obtain the Stroke filter mask, and use the mask to filter the denoised image to obtain the intensity information of the Stroke; (4) combine the segmentation result obtained in step 2 and the filter mask obtained in step 3 Model to select the combined component with higher Stroke strength as the initial seed; (5) Based on the guiding information in the seed window, use an iterative process to extract the Chinese character information contained in the stele image; (6) After the iteration is over, get The segmentation result is the extracted Chinese character information. Although this method can better deal with the influence of the cracks in the stele image on the extraction of Chinese characters, and can extract the Chinese character information in the stele image more completely. However, this method only focuses on the extraction of Chinese character shape and quality information, and it is difficult to apply to the extraction of Chinese character information in pasted images; and in the process of implementing the method, many parameters are obtained based on experience. Therefore, the method has great limitations.

发明内容Contents of the invention

针对上述现有技术中存在的问题,本发明的目的在于,提出一种基于K近邻抠图和数学形态学的书法作品的艺术信息提取方法,以克服现有的书法作品中艺术信息提取技术中所采用的汉字提取方法细节信息缺失严重的缺点,提高书法作品艺术信息提取的准确性和艺术鉴赏价值。In view of the problems existing in the above-mentioned prior art, the purpose of the present invention is to propose a method for extracting artistic information of calligraphy works based on K-nearest neighbor matting and mathematical morphology, so as to overcome the limitations of existing art information extraction techniques in calligraphy works. The adopted Chinese character extraction method has serious shortcomings of lack of detailed information, which improves the accuracy of artistic information extraction and artistic appreciation value of calligraphy works.

为了实现上述任务,本发明采用以下技术方案:In order to achieve the above tasks, the present invention adopts the following technical solutions:

一种基于K近邻抠图和数学形态学的书法字提取方法,包括以下步骤:A method for extracting calligraphy characters based on K-nearest neighbor matting and mathematical morphology, comprising the following steps:

步骤一,在计算机中使用软件读取待处理的彩色图像;Step 1, using software to read the color image to be processed in the computer;

步骤二,将待处理的彩色图像从RGB色彩空间转换到CTE-Lab色彩空间,得到L通道;Step 2, converting the color image to be processed from the RGB color space to the CTE-Lab color space to obtain the L channel;

步骤三,利用K近邻抠图算法提取图像中的汉字信息,得到灰度图像,作为书法字提取的参考图像;Step 3, using the K-nearest neighbor matting algorithm to extract the Chinese character information in the image to obtain a grayscale image, which is used as a reference image for calligraphy character extraction;

步骤四,将参考图像二值化后,再利用数学形态学腐蚀二值化后的参考图像,用步骤三的参考图像减去腐蚀后的参考图像,得到书法字的边缘图像;Step 4, after binarizing the reference image, using mathematical morphology to corrode the binarized reference image, subtracting the corroded reference image from the reference image in step 3, to obtain the edge image of the calligraphy character;

步骤五,对边缘图像进行小窗口的引导滤波处理,并选择合适大小的窗口对书法字内部图像进行引导滤波处理;Step 5, carry out the guided filtering process of the small window to the edge image, and select the window of suitable size to carry out the guided filtering process on the inner image of the calligraphy character;

步骤六,对边缘图像的滤波结果和书法字内部图像的滤波结果进行像素级的图像融合,完成。Step 6, pixel-level image fusion is performed on the filtering result of the edge image and the filtering result of the internal image of the calligraphy character, and the process is completed.

进一步地,所述的步骤三的具体过程包括:Further, the specific process of the third step includes:

步骤S30,利用图像的颜色和位置信息提取特征向量,公式如下:Step S30, using the color and position information of the image to extract a feature vector, the formula is as follows:

X(i)=(cos(h),sin(h),s,v,x,y)i X(i)=(cos(h), sin(h), s, v, x, y) i

上式中,X(i)是特征向量,h,s,v分别是HSV颜色的空间的三个分量,x,y为像素的位置坐标;In the above formula, X(i) is a feature vector, h, s, and v are three components of the HSV color space respectively, and x, y are the position coordinates of the pixel;

骤S31,定义内核函数:Step S31, define the kernel function:

k(i,j)=1-||X(i)-X(j)||/Ck(i,j)=1-||X(i)-X(j)||/C

在上式中,k(i,j)为内核函数,X(i)和X(j)为不同的特征向量,C为权值调节系数,用来保证k(i,j)∈(0,1);In the above formula, k(i,j) is the kernel function, X(i) and X(j) are different feature vectors, and C is the weight adjustment coefficient, which is used to ensure that k(i,j)∈(0, 1);

由内核函数得到拉普拉斯矩阵:Get the Laplacian matrix from the kernel function:

L=D-AL=D-A

上式中,D为对角矩阵,D的对角线上的元素A是相似矩阵;In the above formula, D is a diagonal matrix, and the elements on the diagonal of D A is a similarity matrix;

步骤S32,加入用户约束信息得到封闭解:Step S32, adding user constraint information to obtain a closed solution:

α=(L+λM)-1(λV)α=(L+λM) -1 (λV)

上式中,M为对角矩阵,表示用户对已知像素点的标记,V为向量,表示用户对前景区域的标记,λ为约束系数,L为彩色图像在Lab颜色空间中的亮度;In the above formula, M is a diagonal matrix, which represents the user's marking of known pixels, V is a vector, representing the user's marking of the foreground area, λ is the constraint coefficient, and L is the brightness of the color image in the Lab color space;

步骤S33,将封闭解α的值带入以下公式,得到参考图像:Step S33, put the value of the closed solution α into the following formula to obtain the reference image:

R=αf+(1-α)bR=αf+(1-α)b

上式中,R为参考图像,f未知的前景图层,b为未知的背景图层。In the above formula, R is the reference image, f is the unknown foreground layer, and b is the unknown background layer.

进一步地,所述的步骤四的具体过程包括:Further, the specific process of the fourth step includes:

步骤S40,将参考图像二值化Step S40, binarize the reference image

使用以下公式计算参考图像的平均像素值:Calculate the average pixel value of the reference image using the following formula:

uu == ΣΣ xx == 11 ,, ythe y == 11 xx == Mm ,, ythe y == NN ff (( xx ,, ythe y )) Mm ×× NN

上式中,u表示L通道的平均像素值,f(x,y)表示图像中坐标为(x,y)处像素的像素值,M和N分别表示图像的长度和宽度;In the above formula, u represents the average pixel value of the L channel, f(x, y) represents the pixel value of the pixel at the coordinates (x, y) in the image, and M and N represent the length and width of the image, respectively;

步骤S41,设对参考图像进行二值化处理的最优阈值为T,则统计L通道中像素值大于T的像素占图像的比例w1以及L通道中像素值小于等于T的像素占图像的比例w2,并计算L通道中像素值大于T的像素的平均像素值u1以及L通道中像素值小于等于T的像素的平均像素值u2Step S41, assuming that the optimal threshold for binarization processing of the reference image is T, then counting the ratio w1 of pixels with pixel values greater than T in the image in the L channel and the proportion of pixels with pixel values less than or equal to T in the image in the L channel. Scale w 2 , and calculate the average pixel value u 1 of the pixels whose pixel value is greater than T in the L channel and the average pixel value u 2 of the pixels whose pixel value is less than or equal to T in the L channel;

步骤S42,遍历T的每一种可能的取值,使用以下公式计算类间差异值:Step S42, traversing through each possible value of T, using the following formula to calculate the inter-class difference value:

G=w1×(u1-u)×(u1-u)+w2×(u2-u)×(u2-u)G=w 1 ×(u 1 -u)×(u 1 -u)+w 2 ×(u 2 -u)×(u 2 -u)

上式中,G表示二值化处理过程中目标部分和背景部分两类之间的差异值,当G达到最大时,即可得到二值化的最佳阈值T,然后再使用下式对参考图像进行二值化处理:In the above formula, G represents the difference between the target part and the background part in the binarization process. When G reaches the maximum, the optimal threshold T of binarization can be obtained, and then use the following formula to compare the reference The image is binarized:

步骤S43,利用结构元素取3*3的矩阵对二值化后的参考图像进行腐蚀,使书法字边缘减少一个像素,再利用参考图像减去腐蚀后的参考图像,便可得到书法字的边缘;其中:Step S43, using a matrix of 3*3 structural elements to corrode the binarized reference image to reduce the edge of the calligraphy character by one pixel, and then subtracting the corroded reference image from the reference image to obtain the edge of the calligraphy character ;in:

腐蚀运算定义为:The erosion operation is defined as:

RΘBs={Z,Bz∈R}RΘB s = {Z,B z ∈ R}

数学形态的边缘提取算子如下:The edge extraction operator of mathematical form is as follows:

ED(R)=R-(RΘB)ED(R)=R-(RΘB)

上面两式中,B是3*3的结构元素,BZ为结构元素平移Z个单位后的结果,BS为结构元素关于原点对称的集合,ED(R)为参考图像R中书法字的边缘。In the above two formulas, B is a 3*3 structural element, B Z is the result of the translation of the structural element by Z units, B S is the set of structural elements symmetrical about the origin, and ED(R) is the calligraphic character in the reference image R edge.

本发明与现有技术相比具有以下优点:Compared with the prior art, the present invention has the following advantages:

1.本发明使用了K近邻抠图和引导滤波器,很好的解决了传统方法缺少灰度细节,难以提取书法字模糊边缘的问题,能够更好地提取书法作品中汉字的形质和神采信息,提高了汉字信息提取的完整性。1. The present invention uses K-nearest neighbor matting and a guided filter, which solves the problem that the traditional method lacks grayscale details and is difficult to extract blurred edges of calligraphy characters, and can better extract the shape, quality and spirit of Chinese characters in calligraphy works information, improving the integrity of Chinese character information extraction.

2.本发明使用了基于数学形态学的边缘提取方法,很好的解决了传统方法不能保持汉字边缘锐利的问题。使书法字保持边缘平滑流畅,提高了汉字信息提取的准确性。2. The present invention uses an edge extraction method based on mathematical morphology, which well solves the problem that traditional methods cannot keep the edges of Chinese characters sharp. Keep the edges of calligraphy characters smooth and smooth, and improve the accuracy of Chinese character information extraction.

3.本发明通过K近邻抠图建立参考图像,根据书法图像墨浓淡变化复杂的特点,利用基于数学形态学的边缘提取方法,分别在字体内部和边缘做不同窗口大小的引导滤波,再利用图像融合技术寻找更多的形质和神采信息,解决了现有的书法作品中艺术信息提取技术中所采用的汉字提取方法细节信息缺失严重的问题,提高了书法作品艺术信息提取的准确性和艺术鉴赏价值。3. The present invention establishes a reference image through K-nearest-neighbor matting, and according to the characteristics of complex changes in the ink intensity of calligraphy images, uses an edge extraction method based on mathematical morphology to perform guided filtering of different window sizes on the inside and edge of the font, and then uses the image Fusion technology seeks more shape, quality and spirit information, solves the problem of serious lack of detail information in the Chinese character extraction method used in the existing calligraphy art information extraction technology, and improves the accuracy and artistic quality of calligraphy art information extraction. Appreciation value.

附图说明Description of drawings

图1为本发明方法的整体流程图;Fig. 1 is the overall flowchart of the inventive method;

图2为书法图像《松风阁诗》的局部图像;Fig. 2 is a partial image of the calligraphy image "Songfengge Poetry";

图3为颜色空间转换和K近邻抠图后的结果,其中图3(a)为原图的L通道,图3(b)为参考图像;Figure 3 is the result of color space conversion and K-nearest neighbor matting, where Figure 3(a) is the L channel of the original image, and Figure 3(b) is the reference image;

图4为对参考图像边缘提取后的结果,其中图4(a)为内部图像,图4(b)为边缘图像;Fig. 4 is the result after extracting the edge of the reference image, wherein Fig. 4 (a) is an internal image, and Fig. 4 (b) is an edge image;

图5对内部图像和边缘图像做不同窗口大小引导滤波的结果,其中图5(a)为内部图像,图5(b)为边缘图像;Fig. 5 is the result of guiding filtering with different window sizes for the inner image and the edge image, where Fig. 5(a) is the inner image and Fig. 5(b) is the edge image;

图6为图像融合的结果图;Fig. 6 is the result figure of image fusion;

图7为仿真实验2中第一组的两幅图像作品实验结果对比图;Fig. 7 is a comparison chart of the experimental results of the first group of two image works in the simulation experiment 2;

图8为仿真实验2中第二组的两幅图像作品实验结果对比图;Fig. 8 is the comparison chart of the experimental results of the two image works of the second group in the simulation experiment 2;

图9为仿真实验2中第三组的两幅图像作品实验结果对比图;Fig. 9 is a comparison chart of the experimental results of two image works of the third group in the simulation experiment 2;

具体实施方式detailed description

一、步骤详解1. Detailed steps

本发明的流程图如图1所示,具体过程如下:Flow chart of the present invention is as shown in Figure 1, and concrete process is as follows:

一种基于K近邻抠图和数学形态学的书法字提取方法,包括以下步骤:A method for extracting calligraphy characters based on K-nearest neighbor matting and mathematical morphology, comprising the following steps:

步骤一,在计算机中使用软件读取待处理的彩色图像;计算机中使用的软件可以采用Matlab软件;Step 1, use software in the computer to read the color image to be processed; the software used in the computer can adopt Matlab software;

步骤二,将待处理的彩色图像从RGB色彩空间转换到CTE-Lab色彩空间,得到L通道,具体转换公式如下:Step 2: Convert the color image to be processed from the RGB color space to the CTE-Lab color space to obtain the L channel. The specific conversion formula is as follows:

X=0.412453×R+0.357580×G+0.180423×BX=0.412453×R+0.357580×G+0.180423×B

Y=0.212671×R+0.715160×G+0.072169×BY=0.212671×R+0.715160×G+0.072169×B

Z=0.019334×R+0.119193×G+0.950227×BZ=0.019334×R+0.119193×G+0.950227×B

X1=X/(255×0.950456)X 1 =X/(255×0.950456)

Y1=Y/255Y 1 =Y/255

Z1=Z/(255×1.088754)Z 1 =Z/(255×1.088754)

其中,X,Y,Z分别表示CIE1931标准色度观察者光谱三刺激值,R,G,B分别表示彩色图像在RGB颜色空间中的红、绿、蓝三个通道,X1,Y1,Z1分别表示线性归一化的X,Y,Z的值;Among them, X, Y, Z represent CIE1931 standard chromaticity observer spectral tristimulus value respectively, R, G, B represent the red, green, blue three channels of color image in RGB color space respectively, X 1 , Y 1 , Z 1 represents the values of linearly normalized X, Y, and Z respectively;

如果Y>0.008856,则:If Y>0.008856, then:

f(X1)=X1^(1/3)f(X 1 )=X 1 ^(1/3)

f(Y1)=Y1^(1/3)f(Y 1 )=Y 1 ^(1/3)

f(Z1)=Z1^(1/3)f(Z 1 )=Z 1 ^(1/3)

L=116×f(Y1)-16L=116×f(Y 1 )-16

如果Y<0.008856,则:If Y<0.008856, then:

f(X1)=7.787×X1+16/116f(X 1 )=7.787×X 1 +16/116

f(Y1)=7.787×Y1+16/116f(Y 1 )=7.787×Y 1 +16/116

f(Z1)=7.787×Z1+16/116f(Z 1 )=7.787×Z 1 +16/116

L=903.3×Y1 L=903.3×Y 1

a=500×(f(X1)-f(Y1))+128a=500×(f(X 1 )-f(Y 1 ))+128

b=200×(f(Y1)-f(Z1))+128b=200×(f(Y 1 )-f(Z 1 ))+128

其中,f(·)是校正函数,L表示彩色图像在Lab颜色空间中的亮度,a,b表示彩色图像在Lab颜色空间中的色彩,a的正半轴表示红色,负半轴表示绿色,b的正半轴表示黄色,负半轴表示蓝色。Among them, f( ) is a correction function, L represents the brightness of the color image in the Lab color space, a, b represent the color of the color image in the Lab color space, the positive half axis of a represents red, and the negative half axis represents green, The positive half-axis of b represents yellow, and the negative half-axis represents blue.

步骤三,利用K近邻抠图算法提取图像中的汉字信息,得到灰度图像,作为书法字提取的参考图像;具体过程如下:Step 3, use the K-nearest neighbor matting algorithm to extract the Chinese character information in the image, and obtain a grayscale image as a reference image for calligraphy character extraction; the specific process is as follows:

步骤S30,利用图像的颜色和位置信息提取特征向量,公式如下:Step S30, using the color and position information of the image to extract a feature vector, the formula is as follows:

X(i)=(cos(h),sin(h),s,v,x,y)i X(i)=(cos(h), sin(h), s, v, x, y) i

上式中,X(i)是特征向量,h,s,v分别是HSV颜色的空间的三个分量,x,y为像素的位置坐标;In the above formula, X(i) is a feature vector, h, s, and v are three components of the HSV color space respectively, and x, y are the position coordinates of the pixel;

骤S31,定义内核函数:Step S31, define the kernel function:

k(i,j)=1-||X(i)-X(j)||/Ck(i,j)=1-||X(i)-X(j)||/C

在上式中,k(i,j)为内核函数,X(i)和X(j)为不同的特征向量,C为权值调节系数,用来保证k(i,j)∈(0,1);In the above formula, k(i,j) is the kernel function, X(i) and X(j) are different feature vectors, and C is the weight adjustment coefficient, which is used to ensure that k(i,j)∈(0, 1);

由内核函数得到拉普拉斯矩阵:Get the Laplacian matrix from the kernel function:

L=D-AL=D-A

上式中,D为对角矩阵,D的对角线上的元素A是相似矩阵;In the above formula, D is a diagonal matrix, and the elements on the diagonal of D A is a similarity matrix;

步骤S32,加入用户约束信息得到封闭解:Step S32, adding user constraint information to obtain a closed solution:

α=(L+λM)-1(λV)α=(L+λM) -1 (λV)

上式中,M为对角矩阵,表示用户对已知像素点的标记,V为向量,表示用户对前景区域的标记,λ为约束系数,L为彩色图像在Lab颜色空间中的亮度;In the above formula, M is a diagonal matrix, which represents the user's marking of known pixels, V is a vector, representing the user's marking of the foreground area, λ is the constraint coefficient, and L is the brightness of the color image in the Lab color space;

步骤S33,将封闭解α的值带入以下公式,得到参考图像:Step S33, put the value of the closed solution α into the following formula to obtain the reference image:

R=αf+(1-α)bR=αf+(1-α)b

上式中,R为参考图像,f未知的前景图层,b为未知的背景图层。In the above formula, R is the reference image, f is the unknown foreground layer, and b is the unknown background layer.

步骤四,将参考图像二值化后,再利用数学形态学腐蚀二值化后的参考图像,用步骤三的参考图像减去腐蚀后的参考图像,得到书法字的边缘图像;具体过程如下:Step 4, after binarizing the reference image, use mathematical morphology to corrode the binarized reference image, subtract the corroded reference image from the reference image in step 3, and obtain the edge image of the calligraphy character; the specific process is as follows:

步骤S40,使用OTSU将参考图像二值化Step S40, using OTSU to binarize the reference image

使用以下公式计算参考图像的平均像素值:Calculate the average pixel value of the reference image using the following formula:

uu == &Sigma;&Sigma; xx == 11 ,, ythe y == 11 xx == Mm ,, ythe y == NN ff (( xx ,, ythe y )) Mm &times;&times; NN

上式中,u表示L通道的平均像素值,f(x,y)表示图像中坐标为(x,y)处像素的像素值,M和N分别表示图像的长度和宽度;In the above formula, u represents the average pixel value of the L channel, f(x, y) represents the pixel value of the pixel at the coordinates (x, y) in the image, and M and N represent the length and width of the image, respectively;

步骤S41,设对参考图像进行二值化处理的最优阈值为T,则统计L通道中像素值大于T的像素占图像的比例w1以及L通道中像素值小于等于T的像素占图像的比例w2,并计算L通道中像素值大于T的像素的平均像素值u1以及L通道中像素值小于等于T的像素的平均像素值u2;相关公式为:Step S41, assuming that the optimal threshold for binarization processing of the reference image is T, then counting the ratio w1 of pixels with pixel values greater than T in the image in the L channel and the proportion of pixels with pixel values less than or equal to T in the image in the L channel. Ratio w 2 , and calculate the average pixel value u 1 of the pixels whose pixel value is greater than T in the L channel and the average pixel value u 2 of the pixels whose pixel value is less than or equal to T in the L channel; the related formula is:

ww 11 == WW 11 Mm &times;&times; NN

ww 22 == WW 22 Mm &times;&times; NN

uu 11 == &Sigma;&Sigma; ii &times;&times; nno (( ii )) WW 11 ii >> TT

uu 22 == &Sigma;&Sigma; ii &times;&times; nno (( ii )) WW 22 ii &le;&le; TT

其中,W1和W2分别表示L通道中像素值大于T的像素数和像素值小于等于T的像素数,i表示图像中像素的像素值,n(i)表示像素值等于i的像素数;Among them, W 1 and W 2 respectively represent the number of pixels whose pixel value is greater than T and the number of pixels whose pixel value is less than or equal to T in the L channel, i represents the pixel value of the pixel in the image, and n(i) represents the number of pixels whose pixel value is equal to i ;

步骤S42,遍历T的每一种可能的取值,使用以下公式计算类间差异值:Step S42, traversing through each possible value of T, using the following formula to calculate the inter-class difference value:

G=w1×(u1-u)×(u1-u)+w2×(u2-u)×(u2-u)G=w 1 ×(u 1 -u)×(u 1 -u)+w 2 ×(u 2 -u)×(u 2 -u)

上式中,G表示二值化处理过程中目标部分和背景部分两类之间的差异值,当G达到最大时,即可得到二值化的最佳阈值T,然后再使用下式对参考图像进行二值化处理:In the above formula, G represents the difference between the target part and the background part in the binarization process. When G reaches the maximum, the optimal threshold T of binarization can be obtained, and then use the following formula to compare the reference The image is binarized:

步骤S43,在数学形态学运算中,腐蚀具有消除物体边界的作用。利用结构元素取3*3的矩阵对二值化后的参考图像进行腐蚀,使书法字边缘减少一个像素,再利用参考图像减去腐蚀后的参考图像,便可得到书法字的边缘;其中:Step S43, in the mathematical morphology operation, erosion has the function of eliminating the boundary of the object. Use a matrix of 3*3 structural elements to corrode the binarized reference image to reduce the edge of the calligraphy character by one pixel, and then subtract the corroded reference image from the reference image to obtain the edge of the calligraphy character; among them:

腐蚀运算定义为:The erosion operation is defined as:

RΘBs={Z,Bz∈R}RΘB s = {Z,B z ∈ R}

数学形态的边缘提取算子如下:The edge extraction operator of mathematical form is as follows:

ED(R)=R-(RΘB)ED(R)=R-(RΘB)

上面两式中,B是3*3的结构元素,BZ为结构元素平移Z个单位后的结果,BS为结构元素关于原点对称的集合,ED(R)为参考图像R中书法字的边缘。In the above two formulas, B is a 3*3 structural element, B Z is the result of the translation of the structural element by Z units, B S is the set of structural elements symmetrical about the origin, and ED(R) is the calligraphic character in the reference image R edge.

步骤五,对边缘图像进行小窗口的引导滤波处理,并选择合适大小的窗口对书法字内部图像进行引导滤波处理;Step 5, carry out the guided filtering process of the small window to the edge image, and select the window of suitable size to carry out the guided filtering process on the inner image of the calligraphy character;

步骤S50,首先对边缘图像ED进行小窗口的引导滤波处理:Step S50, firstly carry out the guided filtering process of the small window on the edge image ED:

以边缘图像ED为输入图像I,以图像L通道为引导图像Ig,引导滤波器就是对引导图像的一个线性变换,即:Taking the edge image ED as the input image I, and the image L channel as the guide image Ig, the guide filter is a linear transformation of the guide image, namely:

II oo (( xx ,, ythe y )) == aa kk II gg (( xx ,, ythe y )) ++ bb kk ,, &ForAll;&ForAll; (( xx ,, ythe y )) &Element;&Element; &omega;&omega; kk

其中,Io(x,y)是滤波输出图像中坐标位置为处的像素值,ak和bk是线性系数,Ig(x,y)是引导图像中坐标位置(x,y)处的像素值,ωk是以像素点为中心,半径为r的一个局部窗口。在对边缘图像引导滤波处理时,为保持边缘锐利,用小窗口引导滤波器,即使用r=2的局部窗口ω2Among them, I o (x, y) is the pixel value at the coordinate position in the filtered output image, a k and b k are linear coefficients, and I g (x, y) is the coordinate position (x, y) in the guide image The pixel value of , ω k is a local window with the pixel as the center and radius r. When guiding the filtering process to the edge image, in order to keep the edge sharp, use a small window to guide the filter, that is, use the local window ω 2 of r=2 ;

为了使输入图像I和输出图像Io之间的差异最小,即需要在窗口ω2中使以下的函数达到最小化:In order to minimize the difference between the input image I and the output image Io , the following function needs to be minimized in the window ω2 :

E=∑((Io(x,y)-I(x,y))2+εak 2)E=∑((I o (x,y)-I(x,y)) 2 +εa k 2 )

=∑((akIg(x,y)+bk-I(x,y))2+εak 2)=∑((a k I g (x,y)+b k -I(x,y)) 2 +εa k 2 )

其中,I(x,y)是输入图像中坐标位置为(x,y)处的像素值,E是Io(x,y)和I(x,y)之间的差异值,ε是一个防止的值过大的正则化参数。当E达到最小时ak和bk分别为:where I(x,y) is the pixel value at the coordinate position (x,y) in the input image, E is the difference between Io (x,y) and I(x,y), and ε is a A regularization parameter that prevents the value from being too large. When E reaches the minimum, a k and b k are respectively:

aa kk == (( &sigma;&sigma; kk 22 ++ &epsiv;&epsiv; )) -- 11 (( 11 || &omega;&omega; || &Sigma;&Sigma; (( xx ,, ythe y )) &Element;&Element; &omega;&omega; kk II gg (( xx ,, ythe y )) II (( xx ,, ythe y )) -- &mu;&mu; kk II &OverBar;&OverBar; kk ))

bb kk == II &OverBar;&OverBar; kk -- aa kk &mu;&mu; kk

其中,σk 2和μk分别为在窗口ω2内Ig(x,y)的均值和方差,为I(x,y)在窗口ω2内的均值,|ω2|是窗口ω2内像素点的个数。Among them, σ k 2 and μ k are the mean and variance of I g (x, y) in the window ω 2 respectively, is the mean value of I(x,y) in the window ω 2 , |ω 2 | is the number of pixels in the window ω 2 .

由于一个像素可能被多个窗口所覆盖,因此,可以根据计算得到的参数ak和bk,通过以下公式计算得到滤波输出Io(x,y):Since a pixel may be covered by multiple windows, the filtered output I o (x,y) can be calculated by the following formula according to the calculated parameters a k and b k :

II oo (( xx ,, ythe y )) == aa &OverBar;&OverBar; xx ythe y II gg (( xx ,, ythe y )) ++ bb &OverBar;&OverBar; xx ythe y

其中,是覆盖像素(x,y)的所有窗口系数的均值。in, and is the mean of all window coefficients covering pixel (x,y).

由Io(x,y)得到边缘图像ED的引导滤波结果ED′。The guided filtering result ED' of the edge image ED is obtained from I o (x, y).

步骤S51,对书法字内部图像进行引导滤波处理:Step S51, performing guided filtering processing on the inner image of the calligraphy character:

以内部图像IE为输入图像I,以图像L通道为引导图像Ig,为提取更多的灰度信息,使用较大的滤波窗口,即使用r=8的局部窗口ω8;其他过程均与步骤S50相同,得到内部图像的引导滤波结果IE′。Taking the internal image IE as the input image I, taking the image L channel as the guide image Ig, in order to extract more grayscale information, use a larger filter window, that is, use the local window ω 8 of r=8; other processes are all the same as the steps S50 is the same, and the guided filtering result IE' of the internal image is obtained.

步骤六,对边缘图像的滤波结果和书法字内部图像的滤波结果进行像素级的图像融合,完成。Step 6, pixel-level image fusion is performed on the filtering result of the edge image and the filtering result of the internal image of the calligraphy character, and the process is completed.

为了使最终的提取结果,同时包含丰富书法字内部丰富的灰度信息,和笔画锐利的边缘,将ED′和IE′进行图像融合,得到完整准确的书法字的形质和神韵。In order to make the final extraction result contain both the rich grayscale information inside the calligraphy characters and the sharp edges of the strokes, the images of ED′ and IE′ are fused to obtain the complete and accurate shape, quality and charm of the calligraphy characters.

对ED′和IE′在(x,y)处的像素值取最小,即:Take the minimum pixel value of ED' and IE' at (x, y), that is:

g(x,y)=min(ED′(x,y),IE′(x,y))g(x,y)=min(ED'(x,y),IE'(x,y))

其中ED′(x,y)是ED′在坐标(x,y)处的像素值,IE′(x,y)是IE′在坐标(x,y)处的像素值,g(x,y)是图像融合结果在坐标(x,y)处的像素值,min(·)是取最小值。Among them, ED′(x, y) is the pixel value of ED′ at coordinates (x, y), IE′(x, y) is the pixel value of IE′ at coordinates (x, y), g(x, y ) is the pixel value of the image fusion result at coordinates (x, y), and min(·) is the minimum value.

二、仿真实验2. Simulation experiment

仿真实验1:对本发明中书法图像中汉字形质和神采信息提取方法的仿真。Simulation experiment 1: Simulation of the method for extracting the shape, quality and spirit information of Chinese characters in calligraphy images in the present invention.

仿真1的仿真条件是在MATLABR2013a软件下进行,引导滤波的参数ε=0.110,K近邻抠图算法的参数lambda=100,level=0.5,l=1。The simulation conditions of simulation 1 are carried out under MATLABR2013a software, the parameters of guided filtering ε=0.1 10 , the parameters of K-nearest neighbor matting algorithm lambda=100, level=0.5, l=1.

参照图2至图6,对书法图像黄庭坚的《松风阁诗》局部进行仿真实验。该书法图像保存较为完好,参考图像中包含了汉字的主要形质信息,然后对参考图像进行边缘提取,得到内部图像和边缘图像,分别用不同窗口大小的引导滤波器进行滤波处理,即可获得灰度细节和锐利的边缘,对滤波结果再进行图像融合,即可提取出了完整的神采信息,并且能够真实反映笔墨浓度变化和笔锋的走势,准确还原书法字边缘情况。在结果图像中,书法家在书写汉字时笔画的虚实以及笔锋的突变和渐变都能够较好地展示。Referring to Fig. 2 to Fig. 6, a simulation experiment is performed on part of the calligraphy image "Songfengge Poem" by Huang Tingjian. The calligraphy image is relatively well preserved, and the reference image contains the main shape and quality information of Chinese characters. Then, edge extraction is performed on the reference image to obtain the internal image and the edge image, which are filtered by guiding filters with different window sizes respectively to obtain For grayscale details and sharp edges, image fusion can be performed on the filtering results to extract complete information of the spirit, and can truly reflect the changes in ink density and the trend of strokes, and accurately restore the edge of calligraphy characters. In the resulting image, the calligrapher's strokes can be well displayed when writing Chinese characters, as well as the sudden change and gradual change of the stroke.

仿真实验2,对本发明方法进行对比分析的仿真。Simulation experiment 2 is a simulation for comparative analysis of the method of the present invention.

仿真实验2的仿真条件是在MATLABR2013a软件下进行,引导滤波的参数ε=0.110,K近邻抠图算法的参数lambda=100,level=0.5,l=1。本发明方法主要与OTSU,FastFuzzyC-means(FFCM)以及MultiChannelsandGuidedFilters(MCGF)进行对比分析,以证明出本发明方法在书法作品中对汉字的神采信息的提取方面具有显著优势。实验结果的对比与分析描述如下:The simulation conditions of the simulation experiment 2 are carried out under the software MATLABR2013a, the parameters of the guided filter ε=0.1 10 , the parameters of the K-nearest neighbor matting algorithm lambda=100, level=0.5, l=1. The method of the present invention is mainly compared and analyzed with OTSU, FastFuzzyC-means (FFCM) and MultiChannels and Guided Filters (MCGF) to prove that the method of the present invention has significant advantages in extracting the information of Chinese characters in calligraphy works. The comparison and analysis of the experimental results are described as follows:

参照图7,图8和图9(每一组选择两幅书法图像作品),对于书法图像,需要同时提取出完整准确的形质和神采信息。首先,对于汉字的形质信息提取方面,所有的方法都比较准确的提取汉字的形质信息。但是本发明方法提取结果形质信息更加完整,如图7和图9中所示。在汉字的神采信息的提取中,对于书法字中边缘模糊的区域,Otsu,FFCM和MCGF提取结果对细节损失较大,如图8和图9所示。对于枯笔所写笔画,提取难度很大,OTSU,FFCM和MCGF损失大部分信息,如图7,图8和图9所示。然而与之形成对比的是,本发明方法在形质信息和神采信息的提取方面具有较高的准确性,无论对于飞白区域还是枯笔笔画都能保留了丰富的灰度细节,并且笔画的边缘清晰完整。Referring to Fig. 7, Fig. 8 and Fig. 9 (two calligraphy image works are selected for each group), for calligraphy images, it is necessary to extract complete and accurate shape, quality and expression information at the same time. First of all, for the extraction of the shape and quality information of Chinese characters, all the methods can extract the shape and quality information of Chinese characters relatively accurately. However, the shape and quality information extracted by the method of the present invention is more complete, as shown in FIG. 7 and FIG. 9 . In the extraction of the spirit information of Chinese characters, for the areas with blurred edges in calligraphy characters, the extraction results of Otsu, FFCM and MCGF have a large loss of details, as shown in Figure 8 and Figure 9. It is very difficult to extract the strokes written with a dry brush, and OTSU, FFCM and MCGF lose most of the information, as shown in Figure 7, Figure 8 and Figure 9. However, in contrast, the method of the present invention has high accuracy in the extraction of shape information and spirit information, and can retain rich grayscale details for both the white area and the dry strokes, and the edges of the strokes Clear and complete.

Claims (3)

1.一种基于K近邻抠图和数学形态学的书法字提取方法,其特征在于,包括以下步骤:1. A calligraphy word extraction method based on K nearest neighbor matting and mathematical morphology, is characterized in that, comprises the following steps: 步骤一,在计算机中使用软件读取待处理的彩色图像;Step 1, using software to read the color image to be processed in the computer; 步骤二,将待处理的彩色图像从RGB色彩空间转换到CTE-Lab色彩空间,得到L通道;Step 2, converting the color image to be processed from the RGB color space to the CTE-Lab color space to obtain the L channel; 步骤三,利用K近邻抠图算法提取图像中的汉字信息,得到灰度图像,作为书法字提取的参考图像;Step 3, using the K-nearest neighbor matting algorithm to extract the Chinese character information in the image to obtain a grayscale image, which is used as a reference image for calligraphy character extraction; 步骤四,将参考图像二值化后,再利用数学形态学腐蚀二值化后的参考图像,用步骤三的参考图像减去腐蚀后的参考图像,得到书法字的边缘图像;Step 4, after binarizing the reference image, using mathematical morphology to corrode the binarized reference image, subtracting the corroded reference image from the reference image in step 3, to obtain the edge image of the calligraphy character; 步骤五,对边缘图像进行小窗口的引导滤波处理,并选择合适大小的窗口对书法字内部图像进行引导滤波处理;Step 5, carry out the guided filtering process of the small window to the edge image, and select the window of suitable size to carry out the guided filtering process on the inner image of the calligraphy character; 步骤六,对边缘图像的滤波结果和书法字内部图像的滤波结果进行像素级的图像融合,完成。Step 6, pixel-level image fusion is performed on the filtering result of the edge image and the filtering result of the internal image of the calligraphy character, and the process is completed. 2.如权利要求1所述的基于K近邻抠图和数学形态学的书法字提取方法,其特征在于,所述的步骤三的具体过程包括:2. the calligraphy word extraction method based on K nearest neighbor matting and mathematical morphology as claimed in claim 1, is characterized in that, the concrete process of described step 3 comprises: 步骤S30,利用图像的颜色和位置信息提取特征向量,公式如下:Step S30, using the color and position information of the image to extract a feature vector, the formula is as follows: X(i)=(cos(h),sin(h),s,v,x,y)i X(i)=(cos(h), sin(h), s, v, x, y) i 上式中,X(i)是特征向量,h,s,v分别是HSV颜色的空间的三个分量,x,y为像素的位置坐标;In the above formula, X(i) is a feature vector, h, s, and v are three components of the HSV color space respectively, and x, y are the position coordinates of the pixel; 骤S31,定义内核函数:Step S31, define the kernel function: k(i,j)=1-||X(i)-X(j)||/Ck(i,j)=1-||X(i)-X(j)||/C 在上式中,k(i,j)为内核函数,X(i)和X(j)为不同的特征向量,C为权值调节系数,用来保证k(i,j)∈(0,1);In the above formula, k(i,j) is the kernel function, X(i) and X(j) are different feature vectors, and C is the weight adjustment coefficient, which is used to ensure that k(i,j)∈(0, 1); 由内核函数得到拉普拉斯矩阵:Get the Laplacian matrix from the kernel function: L=D-AL=D-A 上式中,D为对角矩阵,D的对角线上的元素A是相似矩阵;In the above formula, D is a diagonal matrix, and the elements on the diagonal of D A is a similarity matrix; 步骤S32,加入用户约束信息得到封闭解:Step S32, adding user constraint information to obtain a closed solution: α=(L+λM)-1(λV)α=(L+λM) -1 (λV) 上式中,M为对角矩阵,表示用户对已知像素点的标记,V为向量,表示用户对前景区域的标记,λ为约束系数,L为彩色图像在Lab颜色空间中的亮度;In the above formula, M is a diagonal matrix, which represents the user's marking of known pixels, V is a vector, representing the user's marking of the foreground area, λ is the constraint coefficient, and L is the brightness of the color image in the Lab color space; 步骤S33,将封闭解α的值带入以下公式,得到参考图像:Step S33, put the value of the closed solution α into the following formula to obtain the reference image: R=αf+(1-α)bR=αf+(1-α)b 上式中,R为参考图像,f未知的前景图层,b为未知的背景图层。。In the above formula, R is the reference image, f is the unknown foreground layer, and b is the unknown background layer. . 3.如权利要求1所述的的基于K近邻抠图和数学形态学的书法字提取方法,其特征在于,所述的步骤四的具体过程包括:3. the calligraphy word extraction method based on K nearest neighbor matting and mathematical morphology as claimed in claim 1, is characterized in that, the concrete process of described step 4 comprises: 步骤S40,将参考图像二值化Step S40, binarize the reference image 使用以下公式计算参考图像的平均像素值:Calculate the average pixel value of the reference image using the following formula: uu == &Sigma;&Sigma; xx == 11 ,, ythe y == 11 xx == Mm ,, ythe y == NN ff (( xx ,, ythe y )) Mm &times;&times; NN 上式中,u表示L通道的平均像素值,f(x,y)表示图像中坐标为(x,y)处像素的像素值,M和N分别表示图像的长度和宽度;In the above formula, u represents the average pixel value of the L channel, f(x, y) represents the pixel value of the pixel at the coordinates (x, y) in the image, and M and N represent the length and width of the image, respectively; 步骤S41,设对参考图像进行二值化处理的最优阈值为T,则统计L通道中像素值大于T的像素占图像的比例w1以及L通道中像素值小于等于T的像素占图像的比例w2,并计算L通道中像素值大于T的像素的平均像素值u1以及L通道中像素值小于等于T的像素的平均像素值u2Step S41, assuming that the optimal threshold for binarization processing of the reference image is T, then counting the ratio w1 of pixels with pixel values greater than T in the image in the L channel and the proportion of pixels with pixel values less than or equal to T in the image in the L channel. Scale w 2 , and calculate the average pixel value u 1 of the pixels whose pixel value is greater than T in the L channel and the average pixel value u 2 of the pixels whose pixel value is less than or equal to T in the L channel; 步骤S42,遍历T的每一种可能的取值,使用以下公式计算类间差异值:Step S42, traversing through each possible value of T, using the following formula to calculate the inter-class difference value: G=w1×(u1-u)×(u1-u)+w2×(u2-u)×(u2-u)G=w 1 ×(u 1 -u)×(u 1 -u)+w 2 ×(u 2 -u)×(u 2 -u) 上式中,G表示二值化处理过程中目标部分和背景部分两类之间的差异值,当G达到最大时,即可得到二值化的最佳阈值T,然后再使用下式对参考图像进行二值化处理:In the above formula, G represents the difference between the target part and the background part in the binarization process. When G reaches the maximum, the optimal threshold T of binarization can be obtained, and then use the following formula to compare the reference The image is binarized: 步骤S43,利用结构元素取3*3的矩阵对二值化后的参考图像进行腐蚀,使书法字边缘减少一个像素,再利用参考图像减去腐蚀后的参考图像,便可得到书法字的边缘;其中:Step S43, using a matrix of 3*3 structural elements to corrode the binarized reference image to reduce the edge of the calligraphy character by one pixel, and then subtracting the corroded reference image from the reference image to obtain the edge of the calligraphy character ;in: 腐蚀运算定义为:The erosion operation is defined as: RΘBs={Z,Bz∈R}RΘB s = {Z,B z ∈ R} 数学形态的边缘提取算子如下:The edge extraction operator of mathematical form is as follows: ED(R)=R-(RΘB)ED(R)=R-(RΘB) 上面两式中,B是3*3的结构元素,BZ为结构元素平移Z个单位后的结果,BS为结构元素关于原点对称的集合,ED(R)为参考图像R中书法字的边缘。In the above two formulas, B is a 3*3 structural element, B Z is the result of the translation of the structural element by Z units, B S is the set of structural elements symmetrical about the origin, and ED(R) is the calligraphic character in the reference image R edge.
CN201510810577.3A 2015-11-20 2015-11-20 One kind scratching figure and the morphologic writing brush word extracting method of mathematics based on k nearest neighbor Expired - Fee Related CN105373798B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510810577.3A CN105373798B (en) 2015-11-20 2015-11-20 One kind scratching figure and the morphologic writing brush word extracting method of mathematics based on k nearest neighbor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510810577.3A CN105373798B (en) 2015-11-20 2015-11-20 One kind scratching figure and the morphologic writing brush word extracting method of mathematics based on k nearest neighbor

Publications (2)

Publication Number Publication Date
CN105373798A true CN105373798A (en) 2016-03-02
CN105373798B CN105373798B (en) 2018-08-28

Family

ID=55375980

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510810577.3A Expired - Fee Related CN105373798B (en) 2015-11-20 2015-11-20 One kind scratching figure and the morphologic writing brush word extracting method of mathematics based on k nearest neighbor

Country Status (1)

Country Link
CN (1) CN105373798B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106340027A (en) * 2016-08-26 2017-01-18 西北大学 Calligraphy background reconstruction method based on image super resolution
CN107403405A (en) * 2016-05-20 2017-11-28 富士通株式会社 Image processing apparatus, image processing method and information processor
CN109460735A (en) * 2018-11-09 2019-03-12 中国科学院自动化研究所 Document binary processing method, system, device based on figure semi-supervised learning
CN112396581A (en) * 2020-11-13 2021-02-23 国网天津市电力公司营销服务中心 Method for detecting and repairing scratches on upper cover of disassembled and reused electrical information acquisition terminal

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1885317A (en) * 2006-07-06 2006-12-27 上海交通大学 Adaptive edge detection method based on morphology and information entropy
CN101930597A (en) * 2010-08-10 2010-12-29 浙江大学 A Method of Image Edge Detection Based on Mathematical Morphology
CN103020917A (en) * 2012-12-29 2013-04-03 中南大学 Method for restoring ancient Chinese calligraphy and painting images on basis of conspicuousness detection
CN104834890A (en) * 2015-02-13 2015-08-12 浙江大学 Method for extracting expression information of characters in calligraphy work

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1885317A (en) * 2006-07-06 2006-12-27 上海交通大学 Adaptive edge detection method based on morphology and information entropy
CN101930597A (en) * 2010-08-10 2010-12-29 浙江大学 A Method of Image Edge Detection Based on Mathematical Morphology
CN103020917A (en) * 2012-12-29 2013-04-03 中南大学 Method for restoring ancient Chinese calligraphy and painting images on basis of conspicuousness detection
CN104834890A (en) * 2015-02-13 2015-08-12 浙江大学 Method for extracting expression information of characters in calligraphy work

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107403405A (en) * 2016-05-20 2017-11-28 富士通株式会社 Image processing apparatus, image processing method and information processor
CN106340027A (en) * 2016-08-26 2017-01-18 西北大学 Calligraphy background reconstruction method based on image super resolution
CN106340027B (en) * 2016-08-26 2019-02-01 西北大学 A kind of calligraphy Background Rebuilding Method based on image super-resolution
CN109460735A (en) * 2018-11-09 2019-03-12 中国科学院自动化研究所 Document binary processing method, system, device based on figure semi-supervised learning
CN112396581A (en) * 2020-11-13 2021-02-23 国网天津市电力公司营销服务中心 Method for detecting and repairing scratches on upper cover of disassembled and reused electrical information acquisition terminal

Also Published As

Publication number Publication date
CN105373798B (en) 2018-08-28

Similar Documents

Publication Publication Date Title
CN107316077B (en) An automatic fat cell counting method based on image segmentation and edge detection
CN103020917B (en) Method for restoring ancient Chinese calligraphy and painting images on basis of conspicuousness detection
CN101533517B (en) Structure feature based on Chinese painting and calligraphy seal image automatic extracting method
CN105069788B (en) A kind of ancient architecture wall topic note is got dirty writing brush character image cluster segmentation method
CN111539409B (en) Ancient tomb question and character recognition method based on hyperspectral remote sensing technology
CN104834890B (en) A kind of extracting method to word expression information in calligraphy work
CN108830857B (en) An Adaptive Binarization Segmentation Method for Chinese Inscriptions on Inscriptions
CN106446952A (en) Method and apparatus for recognizing score image
CN105513105A (en) Image background blurring method based on saliency map
CN107256547A (en) A kind of face crack recognition methods detected based on conspicuousness
CN105373798B (en) One kind scratching figure and the morphologic writing brush word extracting method of mathematics based on k nearest neighbor
CN109961416B (en) A business license information extraction method based on multi-scale fusion of morphological gradients
CN113298809B (en) Composite material ultrasonic image defect detection method based on deep learning and superpixel segmentation
CN104504383A (en) Human face detecting method based on skin colors and AdaBoost algorithm
CN106340027A (en) Calligraphy background reconstruction method based on image super resolution
CN104021566A (en) GrabCut algorithm-based automatic segmentation method of tongue diagnosis image
CN106933579A (en) Image rapid defogging method based on CPU+FPGA
CN111738931B (en) Shadow Removal Algorithm for Photovoltaic Array UAV Aerial Imagery
CN101866422A (en) A method of extracting image attention based on image multi-feature fusion
CN112070684B (en) Method for repairing characters of a bone inscription based on morphological prior features
CN106446920A (en) Stroke width transformation method based on gradient amplitude constraint
CN104809733A (en) Ancient building wall polluted inscription character image edge extraction method
CN105335746B (en) A Calligraphy Character Extraction Method Based on Shear Transform and Guided Filter
CN104063851A (en) Industrial transparent film package test method based on Retinex
CN105469369B (en) Digital picture filtering method and system based on segmentation figure

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20180828

Termination date: 20201120