CN104834890B - A kind of extracting method to word expression information in calligraphy work - Google Patents
A kind of extracting method to word expression information in calligraphy work Download PDFInfo
- Publication number
- CN104834890B CN104834890B CN201510080291.4A CN201510080291A CN104834890B CN 104834890 B CN104834890 B CN 104834890B CN 201510080291 A CN201510080291 A CN 201510080291A CN 104834890 B CN104834890 B CN 104834890B
- Authority
- CN
- China
- Prior art keywords
- image
- processed
- converted
- calligraphy
- template
- 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.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 72
- 238000012545 processing Methods 0.000 claims abstract description 33
- 239000004575 stone Substances 0.000 abstract description 8
- 238000006243 chemical reaction Methods 0.000 abstract description 4
- 230000007547 defect Effects 0.000 abstract description 3
- 238000001514 detection method Methods 0.000 abstract description 3
- 238000011160 research Methods 0.000 abstract description 3
- 230000004069 differentiation Effects 0.000 abstract 1
- 238000000605 extraction Methods 0.000 description 18
- 230000008569 process Effects 0.000 description 15
- 239000003550 marker Substances 0.000 description 10
- 238000010586 diagram Methods 0.000 description 9
- 238000004088 simulation Methods 0.000 description 9
- 230000000694 effects Effects 0.000 description 7
- 230000009466 transformation Effects 0.000 description 5
- 230000008859 change Effects 0.000 description 4
- 238000001914 filtration Methods 0.000 description 4
- 238000010606 normalization Methods 0.000 description 4
- 230000003044 adaptive effect Effects 0.000 description 3
- 230000008901 benefit Effects 0.000 description 3
- 238000009499 grossing Methods 0.000 description 3
- 230000000877 morphologic effect Effects 0.000 description 3
- 238000004458 analytical method Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 2
- 238000004422 calculation algorithm Methods 0.000 description 2
- 239000003086 colorant Substances 0.000 description 2
- 238000010835 comparative analysis Methods 0.000 description 2
- 238000003708 edge detection Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 238000005259 measurement Methods 0.000 description 2
- 238000012360 testing method Methods 0.000 description 2
- 230000002411 adverse Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 230000000052 comparative effect Effects 0.000 description 1
- 238000002474 experimental method Methods 0.000 description 1
- 238000003709 image segmentation Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000005457 optimization Methods 0.000 description 1
- 239000002245 particle Substances 0.000 description 1
- 238000012805 post-processing Methods 0.000 description 1
- 230000002265 prevention Effects 0.000 description 1
- 230000011218 segmentation Effects 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Landscapes
- Image Processing (AREA)
- Controls And Circuits For Display Device (AREA)
Abstract
The invention discloses a kind of extracting method to word expression information in calligraphy work, belong to image processing field.The present invention is by the way that the color space in pending calligraphy work is changed, the type of the pending calligraphy work after conversion is made a distinction according to first passage threshold value afterwards, according to after differentiation being that upright stone tablet image or note image are respectively processed, to obtain the image and note image Chinese font matter of upright stone tablet image Chinese font matter information, expression information and seal form quality, the image of expression information.The defects of text information caused by only relying on rim detection in the prior art is sufficiently complete is avoided, the details performance of the text information detected is added, improves the convenience to calligraphy work research.
Description
Technical Field
The invention relates to the field of image processing, in particular to a method for extracting expression information of characters in calligraphy works.
Background
The Chinese culture has a long source, and in a long culture river, the calligraphy can be called as a pearl in the long river. From ancient times to the present, countless calligraphy artists written countless artistic magnifications, leaving countless cultural heritages for us. When the calligraphy works are distinguished, the calligraphy needs to be highly understood, so that the calligraphy distinguishing needs to be carried out manually.
With the progress of the technology, the existing image recognition technology based on a computer is gradually improved, the edge of the character is processed after the inscription is converted into the image, the processed image is projected, the character in the calligraphy work is positioned according to the projected image, and then the extraction of the character is realized.
In the process of implementing the invention, the inventor finds that the prior art has at least the following problems:
in the process of carrying out character advancing according to the prior art, the detection of characters mainly depends on the edge information of images, namely the detection mainly focuses on the shape and quality information of the characters such as stroke shapes and the like, and does not consider the spiritual information of contents such as colors, stamps and the like, so that the detected character information is incomplete, and inconvenience is brought to the study work of calligraphy works in the later period.
Disclosure of Invention
In order to solve the problems in the prior art, the invention provides a method for extracting the expression information of characters in calligraphy works, which comprises the following steps:
acquiring a calligraphy work to be processed, and converting the color space of the calligraphy work to be processed into a preset color space to obtain the converted calligraphy work to be processed;
extracting a first channel numerical value in the converted calligraphy works to be processed, and distinguishing the types of the converted calligraphy works to be processed according to a first threshold value;
if the converted calligraphy works to be processed are the tombstone images, processing the converted calligraphy works to be processed through a guide filter to obtain images containing the word, shape and quality information of the tombstone images;
and if the converted calligraphy work to be processed is a signature image, processing the converted calligraphy work to be processed through the guide filter to obtain an image containing character shape and quality, expression information, seal shape and quality and expression information in the signature image.
Optionally, the extracting a first channel value in the converted calligraphy work to be processed, and distinguishing the type of the calligraphy work to be processed according to a first threshold includes:
processing the converted calligraphy works to be processed, and determining a first channel numerical value in the converted calligraphy works to be processed;
determining a first threshold value for distinguishing the foreground and the background in the converted calligraphy work to be processed according to the first channel numerical value;
if the first channel value is larger than or equal to a first threshold value, the converted calligraphy work to be processed is a post image;
and if the first channel value is smaller than the first threshold value, the converted calligraphy work to be processed is a tombstone image.
Optionally, if the converted calligraphy work to be processed is a stone tablet image, the stone tablet image is processed through a guiding filter to obtain an image containing character, shape and quality information of the stone tablet image, and the method includes:
performing binarization processing on the converted calligraphy work to be processed according to the second channel number to obtain a binarized first template;
denoising the converted calligraphy works to be processed by using a guide filter to obtain a denoised smooth template;
and according to the first template and the denoised smooth template, extracting the shape and quality information of the characters in the tombstone image through the guide filter to obtain the image containing the character shape and quality information of the tombstone image.
Optionally, the denoising processing is performed on the converted calligraphy work to be processed by using the guided filter, so as to obtain a denoised smooth template, which specifically includes:
denoising the converted calligraphy works to be processed according to a first formula to obtain a denoised smooth template, wherein the first formula is
Wherein, IO(x, y) is the pixel value at the coordinate position (x, y) in the filtered and transformed image, akAnd bkIs a linear coefficient, Ig(x, y) is a pixel value at which the coordinate position in the guide image is (x, y), ωkA local window centered around pixel (x, y) and having a radius r.
Optionally, the method further includes:
carrying out secondary denoising treatment on the smooth template by using a second formula to obtain a secondarily denoised smooth template, wherein the second formula is
Wherein σnIs the variance of the calculated noise, W and H represent the width and height, respectively, of the image I, and N is the mask operator.
Optionally, if the converted calligraphy work to be processed is a signature image, the converted calligraphy work to be processed is processed through the guiding filter to obtain an image containing character shape and character, expression information, seal shape and character and expression information in the signature image, including:
performing binarization processing on the converted calligraphy work to be processed according to a second channel number to obtain a binarized second template;
according to the inverted numerical value of the third channel in the converted calligraphy work to be processed, combining with a preset second threshold value, obtaining a third template after binarization of the converted calligraphy work to be processed;
and combining the second template and the third template to obtain a combined template, extracting the shape and quality information and the expression information of the characters and the seal in the post image through a guide filter by combining the converted image to be processed, and obtaining an image containing the shape and quality information, the expression information and the expression information of the seal in the post image.
Optionally, the combining the second template and the third template to obtain a combined template includes:
obtaining a combined template according to a third formula
Wherein CS (x, y) is a pixel value at a coordinate (x, y) in the obtained combined template, C (x, y) is a pixel value at a coordinate (x, y) in the second template of the character in the post image, and S (x, y) is a pixel value at a coordinate (x, y) in the third template of the stamp in the post image.
The technical scheme provided by the invention has the beneficial effects that:
the method comprises the steps of converting the color space in the calligraphy works to be processed, distinguishing the types of the converted calligraphy works to be processed according to the first channel threshold value, and processing the calligraphy works to be processed respectively according to the distinguished tablet image or signature image so as to obtain the image of character shape and quality information in the tablet image, the image of characters in the signature image, the shape and quality of a seal and expression information, and the image of expression information, so that the defect that the character information is incomplete due to the fact that only edge detection is relied on in the prior art is overcome, the detailed expression of the detected character information is increased, and the convenience of calligraphy work research is improved.
Drawings
In order to more clearly illustrate the technical solution of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on the drawings without creative efforts.
FIG. 1 is a flow chart of a method for extracting expression information of characters in a calligraphy work according to the present invention;
FIG. 2 is a schematic diagram of a partial flow chart of a method for extracting the expression information of the characters in the calligraphy works, provided by the invention;
FIG. 3 is a schematic diagram of a part of a flow chart of a method for extracting the expression information of the characters in the calligraphy works, which is provided by the invention;
FIG. 4 is a schematic diagram of a part of a flow chart of a method for extracting the expression information of the characters in the calligraphy works, which is provided by the invention;
FIG. 5 is a schematic diagram illustrating the extraction result of the character, shape and quality information in the tablet image according to the present invention;
FIG. 6 is a schematic diagram of the extraction results of character form and character expression and expression information and seal form and character expression and expression information in a post image provided by the present invention;
FIG. 7 is a schematic diagram illustrating the shape and quality information of the text extracted by different methods in the marker image according to the present invention;
FIG. 8 is a schematic diagram of the shape, texture and expression information of characters and stamps extracted by different methods in a post image provided by the present invention;
FIG. 9 is a schematic diagram of the shape, texture and expression information of characters and stamps extracted by different methods in a post image provided by the present invention;
fig. 10 is a standard schematic diagram of an image containing literal shape and quality information manually extracted by a professional according to the present invention.
Detailed Description
To make the structure and advantages of the present invention clearer, the structure of the present invention will be further described with reference to the accompanying drawings.
Example one
A method for extracting expression information of a character in a calligraphy work, as shown in fig. 1, the method comprising:
101. and acquiring the calligraphy works to be processed, and converting the color space of the calligraphy works to be processed into a preset color space to obtain the converted calligraphy works to be processed.
102. And extracting a first channel numerical value in the converted calligraphy works to be processed, and distinguishing the types of the converted calligraphy works to be processed according to a first threshold value.
103. And if the converted calligraphy works to be processed are the tombstone images, processing the converted calligraphy works to be processed through a guide filter to obtain images containing the word, shape and quality information of the tombstone images.
104. And if the converted calligraphy work to be processed is a signature image, processing the converted calligraphy work to be processed through the guide filter to obtain an image containing character shape and quality, expression information, seal shape and quality and expression information in the signature image.
In practice, common calligraphy works are mainly divided into a stone tablet image and a book image, as the name suggests, the stone tablet image is mainly an image of collected characters engraved on a stone tablet and usually has the characteristics of beautiful writing points and powerful Qiuqin, and the book image is an image of collected characters written on paper and often has parts such as a seal and the like on the book image. Because the inscription image and the signature image have different characteristics, when acquiring the character expression information in the calligraphy work, the calligraphy work needs to be processed respectively according to different objects.
The conversion of the color space involved is actually from the conventional color space RGB to the predetermined color space CIE-Lab, where CIE L a b (CIE-Lab) is the most complete color model conventionally used to describe all colors visible to the human eye. It is proposed by the Commission Internationale de eclairage (CIE) for this particular purpose. The three basic coordinates represent the brightness of the color (L, L ═ 0 creates black and L ═ 100 indicates white), its position between red/magenta and green (negative values a indicate green and positive values indicate magenta) and its position between yellow and blue (negative values b indicate blue and positive values indicate yellow). The reason why the original RGB color space is replaced by the Lab color space is that the Lab color space has higher color saturation, which is beneficial to the post-processing of the image.
Therefore, after the calligraphy works to be processed are subjected to color space conversion, whether the calligraphy works to be processed after conversion are tombstone images or signature images is distinguished according to the numerical value of a first channel in the CIE-Lab color space, and after the distinguishing is finished, the character, shape and quality information images and the magical information images are extracted through the guide filter respectively.
The form and quality information mainly refers to stroke information of the character in the tombstone image at the starting and the receiving junction, and the magic information refers to information such as the color of the character in the tombstone image and a seal.
After the calligraphy works to be processed are processed by the method, the calligraphy works to be processed can be classified, and follow-up processing can be performed according to the specific classified types, so that the character property information images and the expression information images can be extracted from the classified calligraphy works, the anti-noise capability in extracting the artistic information of the calligraphy works is improved, the problems of high calculation complexity and serious loss of detail information are solved, and the accuracy of extracting the artistic information of the calligraphy works is improved.
Optionally, as shown in fig. 2, step 102 specifically includes:
201. and processing the converted calligraphy works to be processed, and determining a first channel numerical value in the converted calligraphy works to be processed.
In implementation, in the converted CIE-Lab color space, there are three color channels, L channel, a channel, and b channel, where the first channel value refers to the value of the b channel.
202. And determining a first threshold value for distinguishing the foreground and the background in the converted calligraphy work to be processed according to the first channel numerical value.
In implementation, an optimal threshold k for distinguishing the foreground and background of an image is calculated for the b-channel in the Lab color space of the image to be processed using the Otsu (name of the inventor of the algorithm) method, which uses a threshold to divide the original image into two images, foreground and background.
Wherein:
and (3) prospect: the information of points, quality moments, average gray scale and the like of the foreground under the current threshold value is represented;
background: the method is used for representing the information of the point number, the mass moment, the average gray level and the like of the background under the current threshold value.
When taking the best threshold, the background should have the largest difference from the foreground, and in the otsu algorithm this measure of difference is the maximum between-class variance.
In order to determine a first threshold value for distinguishing a foreground from a background in the converted calligraphy work to be processed, the specific implementation steps are as follows:
step one, normalizing the pixel value of the b channel from [0,255] to [0,1] by using a formula (1):
where b (x, y) and b' (x, y) represent the pixel values of the b channel before and after normalization at coordinates (x, y), respectively.
Step two, calculating the average pixel value of a b' channel by using a formula (2);
wherein u isbRepresents the average pixel value of the b-channel after normalization, b' (x, y) represents the pixel value of the b-channel after normalization at the coordinate (x, y), and M and N represent the length and width of the image, respectively.
Assuming that the found optimal threshold for distinguishing the foreground from the background is k, the ratio w of the pixels with pixel values larger than k in the b channel to the image after statistical normalization by formula (3)b,1And the proportion w of pixels with pixel values less than or equal to k in the normalized b channel to the imageb,2And calculating the average pixel value u of the normalized pixels with the pixel values larger than k in the channel bb,1And the average pixel value u of the pixels with the pixel values less than or equal to k in the normalized b channelb,2;
Wherein, Wb,1And Wb,2Respectively representing the pixel number of the pixel value larger than k and the pixel number of the pixel value smaller than or equal to k in the normalized b channel, i represents the pixel value of the pixel in the image, and n (i) represents the pixel number of the pixel value equal to i.
Step three, traversing each possible value of k, and calculating the difference value between classes by using a formula (4)
Gb=wb,1×(ub,1-ub)2+wb,2×(ub,2-ub)2(4)
Wherein G isbRepresenting the difference between the foreground and background parts in the binarization process, when G isbWhen the maximum value is reached, the optimal threshold value of the binarization can be obtained.
The obtained optimal threshold k is used as a first threshold to distinguish the types of the converted calligraphic works to be processed.
203. And if the first threshold value is greater than or equal to a preset threshold value, the converted calligraphy works to be processed are the post images.
In implementation, for example, the preset threshold is set to 0.55, if the first threshold k is greater than or equal to 0.55, the converted calligraphic work to be processed is determined to be a signature image.
204. And if the first threshold value is smaller than the preset threshold value, the converted calligraphy works to be processed are tombstone images.
In implementation, for example, the preset threshold is set to 0.55, if the first threshold k is less than 0.55, the converted calligraphy work to be processed is determined to be the tombstone image.
Through the steps, the converted calligraphy works to be processed can be distinguished in types, so that subsequent targeted extraction of form and quality information and expression information is facilitated.
Optionally, as shown in fig. 3, step 103 includes:
301. and carrying out binarization processing on the converted calligraphy work to be processed according to the second channel number to obtain a binarized first template.
In implementation, the step 301 specifically includes:
calculating an average pixel value of an L channel by using a formula (5), wherein the average pixel value of the L channel is a second channel numerical value;
wherein u isLRepresents the average pixel value of the L channel, L (x, y) represents the pixel value of the L channel pixel at the coordinate (x, y), and M and N represent the length and width of the image, respectively.
Step two, assuming that the optimal threshold value for carrying out binarization processing on the L channel of the marker image is T, calculating the proportion w of pixels with pixel values larger than T in the L channel to the image through a formula (6)L,1And the proportion w of pixels with pixel values less than or equal to T in the L channel to the imageL,2And calculating the average pixel value u of the pixels with the pixel values larger than T in the L channelL,1And an average pixel value u of pixels having a pixel value of T or less in the L channelL,2;
Wherein, WL,1And WL,2Respectively representing the number of pixels in the L channel whose pixel value is greater than T and the number of pixels whose pixel value is equal to or less than T, i representing the pixel value of a pixel in the image, and n (i) representing the number of pixels whose pixel value is equal to i.
Step three, traversing each possible value of the T, and calculating the difference value between classes by using a formula (7)
GL=wL,1×(uL,1-uL)2+wL,2×(uL,2-uL)2(7)
Wherein G isLRepresenting the difference between the target part and the background part during the binarization process, when G isLWhen the maximum threshold value is reached, the optimal threshold value T of binarization can be obtained, and then the following formula is used for carrying out binarization processing on the L channel.
According to the steps, the image after the binarization processing is the first template.
302. And denoising the converted calligraphy works to be processed by using a guide filter to obtain a denoised smooth template.
In implementation, the guiding filter is a linear transformation performed on the converted calligraphy work to be processed according to a preset rule, and the linear transformation can keep the minimum difference value of the images before and after transformation, so that the consistency with the original image can be kept as much as possible when the transformed image is subjected to denoising processing.
The specific processes of the linear transformation and the denoising process included in this step are described later.
303. And according to the first template and the denoised smooth template, extracting the shape and quality information of the characters in the tombstone image through the guide filter to obtain the image containing the character shape and quality information of the tombstone image.
In the implementation, in the process of extracting the character, shape and quality information of the tombstone image, the shape and quality template II of the characters in the tombstone image is used as an input image, and the smooth image EE is used as a guide image. In the process, the shape and quality template obtained by binarization is filtered (information such as scattered point noise, non-character connected components, fuzzy edges and the like in the shape and quality template is removed) by using the content information of the smoothed image EE (a plurality of kinds of noise are removed), so that the shape and quality contour of the characters is reserved, and the shape and quality information of the characters is obtained.
The basic principle of the guide filter is to filter the input image with information in the guide image to obtain the required information. The input image and the guide image used are therefore different for different objects.
Optionally, the denoising processing is performed on the converted calligraphy work to be processed by using the guided filter, so as to obtain a denoised smooth template, which specifically includes:
denoising the converted calligraphy works to be processed according to a first formula to obtain a denoised smooth template, wherein the first formula is
Wherein, IO(x, y) is the pixel value at the coordinate position (x, y) in the filtered and transformed image, akAnd bkIs a linear coefficient, Ig(x, y) is a pixel value at which the coordinate position in the guide image is (x, y), ωkIs centered on pixel point (x, y) and has radiusA partial window of r.
In implementation, the input image is smoothed by a guide filter according to the content in the guide image. For example: with IiFor inputting an image, use IgTo guide the image, the guide filter is a linear transformation of the guide image. Namely:
wherein, IO(x, y) is the pixel value at the coordinate position (x, y) in the filtered and transformed image, akAnd bkIs a linear coefficient, Ig(x, y) is a pixel value at which the coordinate position in the guide image is (x, y), ωkA local window centered around pixel (x, y) and having a radius r.
In order to minimize the difference between the input image and the output image, i.e. in the window ω, it is necessarykTo minimize the function of:
E=Σ((IO(x,y)-Ii(x,y))2+εak 2)=Σ((akIg(x,y)+bk-Ii(x,y))2+εak 2),
where E is the input image IiAnd output image IOThe difference between, epsilon is a prevention akToo large a value of regularization parameter. When E reaches the minimum akAnd bkRespectively as follows:
wherein σk 2And mukRespectively at the local window omegakInner IgThe mean and variance of (x, y),is Ii(x, y) in the window ωkInner mean, | ω | is the window ω |kThe number of internal pixel points.
Since a pixel may be covered by multiple local windows, the parameter a can be calculated according tokAnd bkThe filtered output image I is calculated by the following formulaO(x,y)。
Wherein,andis the average of all window coefficients covering pixel (x, y).
The output image at this time is the smooth template obtained in the denoising process.
In the smoothing process of the marker image, both the input image and the output image used are the second channel of the marker image. Therefore, the process is to filter itself according to the information of the second channel, i.e. the L-channel image, (calculate the key parameters affecting the filtering effect, i.e. the radius of the local window and the regularization parameter, according to the information of the image itself, and then use these parameters to filter itself), so as to obtain the smoothed image.
Optionally, the method further includes:
carrying out secondary denoising treatment on the smooth template by using a second formula to obtain a secondarily denoised smooth template, wherein the second formula is
Wherein σnIs the variance of the calculated noise, W and H represent the width and height, respectively, of the image I, and N is the mask operator.
In implementation, in order to perform automatic smoothing processing on image noise by using a guide filter, the invention designs an adaptive guide filter. Wherein the local window omegakIs a key factor affecting the filtering effect. While the values of ε and r are determined by the severity of the noise in the image, the severity of the noise can be quickly estimated using the following method.
To accurately determine the values of ε and r, the variance of the noise is first calculated using the following formula:
wherein σnIs the calculated variance of the noise, W and H represent the width and height, respectively, of image I, I (x, y) represents each pixel in image I, and N is a mask operator of the form:
due to the variance σ of the noisenAnd window omegakHas a radius r ═ a σn+ b, and therefore the noise variance σ, can be determined fromnAnd determining the radius r.
R and sigma can be obtained by substituting preset parameters a and b into the formulanIs that r is 0.2 sigman,
And due to rAnd σnIs a non-zero even number, so further simplification can result in:
in order to simplify the relationship between epsilon and r, the relationship between epsilon and r is finally determined to be
Under the relation, the effect of the smoothing processing of the adaptive filter can be determined according to the obtained regularization parameter epsilon and the window radius r.
Optionally, as shown in fig. 4, step 104 specifically includes:
401. and performing binarization processing on the converted calligraphy work to be processed according to the second channel number to obtain a binarized second template.
In the implementation, the first and second channel values are the average pixel value of the L channel;
wherein u isLRepresents the average pixel value of the L channel, L (x, y) represents the pixel value of the L channel pixel at the coordinate (x, y), and M and N represent the length and width of the image, respectively.
Step two, assuming that the optimal threshold value for carrying out binarization processing on the L channel of the marker image is T, counting the proportion w of pixels with pixel values larger than T in the L channel to the imageL,1And the proportion w of pixels with pixel values less than or equal to T in the L channel to the imageL,2And calculating the average pixel value u of the pixels with the pixel values larger than T in the L channelL,1And the pixel value in the L channel is less than or equal toAverage pixel value u of pixels of TL,2;
Wherein, WL,1And WL,2Respectively representing the number of pixels in the L channel whose pixel value is greater than T and the number of pixels whose pixel value is equal to or less than T, i representing the pixel value of a pixel in the image, and n (i) representing the number of pixels whose pixel value is equal to i.
Step three, traversing each possible value of T, and calculating the difference value between classes by using the following formula
GL=wL,1×(uL,1-uL)2+wL,2×(uL,2-uL)2
Wherein G isLRepresenting the difference between the target part and the background part during the binarization process, when G isLWhen the maximum threshold value is reached, the optimal threshold value T of binarization can be obtained, and then the following formula is used for carrying out binarization processing on the L channel.
According to the steps, the image after the binarization processing is the second template.
402. And acquiring a third template after binarization of the converted calligraphy work to be processed according to the inverted numerical value of the third channel in the converted calligraphy work to be processed and a preset second threshold value.
In implementation, the inverted value a 'of each pixel in the post image in the third channel, namely the a channel, is acquired'
a'(x,y)=255-a(x,y),
Performing binarization processing on the channel a according to the magnitude relation between a' and a preset second threshold value, such as 110, to obtain a binary image, and using the binary image as a third template S of the seal in the post image;
where S (x, y) is a pixel value at coordinates (x, y) in the obtained binary image, and a' (x, y) is an inverted pixel value at coordinates (x, y) in the a-channel of the post image.
403. And combining the second template and the third template to obtain a combined template, extracting the shape and quality information and the expression information of the characters and the seal in the post image through a guide filter by combining the converted image to be processed, and obtaining an image containing the shape and quality information, the expression information and the expression information of the seal in the post image.
In the implementation, the combined template of the post image is used as an input image, the second channel of the post image, namely the L channel, is used as a guide image, and the shape and spirit information of the characters and the stamp in the post image are extracted by using the guide filter in the step, so as to obtain an image containing the shape and spirit information of the characters and the stamp.
In the process of extracting the shape and quality and the expression information of the post images, a combined template of the post images is used as an input image, and a second channel of the post images is used as a guide image. The process is to use the information of the channel image which can reflect the minimum brightness characteristic of the black characters to filter the combined template so as to obtain the shape and quality information which can express the outline edge of the characters, the expression of the shape and the truth, the false and true and other magic information of the strokes of the characters, and the shape and the quality information and the magic information of the seal in the image.
Optionally, the combining the second template and the third template to obtain a combined template includes:
obtaining a combined template according to a third formula
Wherein CS (x, y) is a pixel value at a coordinate (x, y) in the obtained combined template, C (x, y) is a pixel value at a coordinate (x, y) in the second template of the character in the post image, and S (x, y) is a pixel value at a coordinate (x, y) in the third template of the stamp in the post image.
In the method for extracting the expression information of the characters in the calligraphy work, the color space in the calligraphy work to be processed is converted, the type of the converted calligraphy work to be processed is distinguished according to the first channel threshold, and the calligraphy work to be processed is respectively processed according to the distinguished tablet image or the signature image, so that the image of the character expression and quality information in the tablet image, the image of the character expression and quality information in the signature image, the expression information of the stamp and the expression information of the expression information are obtained. The defect that the text information is incomplete due to the fact that only edge detection is relied on in the prior art is overcome, the detailed expression of the detected text information is increased, and the convenience of calligraphy work research is improved.
To demonstrate the effectiveness of the present method, the following comparative tests were specifically set up to demonstrate the superiority of the present method over the prior art.
And (3) comparison test:
simulation 1, the invention simulates the character, shape and quality and expression information extraction method in the stele image and the poster image.
The simulation conditions for simulation 1 were performed under MATLAB R2010b software.
Referring to fig. 5, a simulation experiment was performed on 5 famous tombstone images having a history of 1000 years, as shown by T02 and T03 in fig. 5, which adversely affect the extraction of the morphological information of characters in the tombstone images due to artificial or natural damage. For example: the T03 in fig. 5 contains a lot of noise information, and the adaptive guided filter proposed by the present invention is used to smooth the original marker image, and then the smoothed image is subjected to secondary guided filtering, so that the shape and quality information of the characters in the marker image can be extracted more completely and accurately, as shown in T02, T03, T04 and T05 in fig. 5.
Referring to fig. 6, a simulation experiment was performed on 4 post images having a history of more than 1000 years. In these well-preserved post images, the imprint of "four treasures of study" is evident. The template CS shown in fig. 6 includes main character information of characters and a small amount of character information of a stamp, which are obvious from W02 and W04 in fig. 6. And then further filtering processing is carried out by using a guide filter, so that more complete form and quality information can be obtained. And the pen and ink density change and force change reflecting the spiritual information can be extracted. In these resulting images, both the virtuality and reality of the strokes and the abrupt and gradual changes in the stroke tips can be better demonstrated by the calligrapher when writing text. In addition, the detail information of the seal can be extracted more clearly and completely.
And 2, simulation for comparing and analyzing the method and the existing method for extracting the character information from the inscription image and the poster image.
Simulation conditions for simulation 2 were performed under MATLAB R2010b software. Parameter epsilon of guiding filter is 0.110And r is 10. The method of the present invention is mainly related to Otsu's objective functions (GA-Otsu), two-dimensional (2D) Otsu, Fast Fuzzy C-means (FFCM) and Fractional-Order Darwini Particle swarm optimization based imaThe comparison and analysis of ge segmentation (FODPSO) proves that the method has remarkable advantages in the aspect of extracting the artistic information of the calligraphy works, particularly in the aspect of extracting the spiritual information of characters in the poster image. The comparison and analysis of the experimental results are described below:
referring to fig. 7, for the marker image, it is a main object to reduce noise information contained in the marker image and extract shape and quality information of characters in the marker image. In this experiment, GA-Otsu,2D Otsu and FFCM were selected for comparative analysis with the method of the present invention. In order to extract the visual effect of the result uniformly, the result obtained by the method is post-processed by using an Otsu method. As shown in fig. 7, the results obtained by GA-Otsu and FFCM are easily interfered by noise, resulting in unclear information on the form and quality of the extracted text, as shown by the results of T02 and T03 in fig. 7, while 2D Otsu can obtain better effect in images with less noise. In contrast, the results of the Otsu post-treatment based on the results obtained by the process of the invention are the best. Various types of noise contained in the image are almost completely removed, and the detail information of the characters is extracted more completely.
Referring to fig. 8, for the post image, the extraction of the form and character information and the expression information of the character should be considered at the same time. First, as for the extraction of the character shape and character information, all methods can extract the main shape and character information of the characters in the post image as shown in fig. 8. The method of the present invention is capable of retaining more detailed information as shown at W01 in fig. 8. For the extraction of the stamp, if the brightness in the stamp color information is high, the GA-Otsu, the 2D Otsu, and the FFCM can hardly extract the stamp information; as the brightness in the seal color information gradually becomes darker, the seal information extracted by the three methods is more accurate, but the extracted information is still incomplete and unclear. In any case, however, the method can extract most of the seal information and can keep more detailed information.
Secondly, in the extraction of artifact information of characters in a signature image, the method of the present invention performs a comparative analysis with a multi-level image segmentation method (FFCM (c ═ 3), FFCM (c ═ 4), three-level FODPSO and four-level FODPSO) which expresses an image using a plurality of intensity values, as shown in fig. 9, FFCM (c ═ 4) and four-level FODPSO can obtain a better effect, they can not only capture more morphological information but also express more artifact information, as shown in W03 and W04 in fig. 9, FFCM (c ═ 3) and three-level FODPSO, although they contain less noise information, they lose some useful information while suppressing noise, as well as no stamp information in the result of W01 in fig. 9, and the extraction result is rough, artifact information is unclear, and particularly, the change in concentration of pen ink is not accurately extracted, in contrast, the method of the present invention has a higher accuracy in the extraction of morphological information and artifact information, as shown by W04 in fig. 9, the abrupt and gradual change effect of ink between writings is fully revealed, and almost all types of noise are removed.
For the extraction of the character information in the tombstone image, mainly focusing on the extraction of the character shape and quality information, in order to quantitatively describe the experimental results of each method, an image which is manually extracted by a professional and contains the real shape and quality information of the character is used as a measurement standard (as shown in fig. 10), and Misclassification Error (ME) is used as a measurement index. ME is defined as follows:
wherein B is0And F0Respectively representing the background and foreground in an image containing information on the true form and quality of the text, BTAnd FTRegional pixels representing the background and foreground in the resulting image. | represents the number of elements in the set.
As shown in Table 1, the method of the present invention has a better advantage in terms of accuracy of extraction results than other methods, and the results obtained by the method of the present invention have the minimum ME value. In contrast, GA-Otsu gave the worst results, with the largest ME value (ME value 0.0355). FFCM is superior to GA-Otsu and inferior to 2D Otsu. In terms of stability of experimental results, the method of the present invention can obtain the most stable results with the smallest standard deviation (0.0078). Therefore, the experimental result shows that the method is the most accurate and stable method for extracting the shape and quality information of the characters in the tombstone image and the poster image.
TABLE 1 ME values of results obtained based on different methods of the standard plot
As can be seen from the results of various simulation experiments, the method of the invention uses the guide filter, not only can better eliminate various noises in the images, but also can more accurately and completely extract the shape, the quality and the spiritual information of characters in the tombstone image and the poster image. Compared with other character information extraction methods, the method has better effect on extracting the shape and the quality of the characters in the inscription image and the poster image and the expression information.
It should be noted that: the embodiment of extracting the text information by using the extraction method provided in the above embodiment is only used as a description in an actual application in the fixing device, and the extraction method can also be used in other application scenarios according to actual needs.
The serial numbers in the above embodiments are merely for description, and do not represent the sequence of the assembly or the use of the components.
The above description is only exemplary of the present invention and should not be taken as limiting the invention, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims (5)
1. A method for extracting expression information of characters in calligraphy works is characterized by comprising the following steps:
acquiring a calligraphy work to be processed, and converting the color space of the calligraphy work to be processed into a preset color space to obtain the converted calligraphy work to be processed;
extracting a first channel numerical value in the converted calligraphy works to be processed, and distinguishing the types of the converted calligraphy works to be processed according to a first threshold value;
if the converted calligraphy works to be processed are the tombstone images, processing the converted calligraphy works to be processed through a guide filter to obtain images containing the word, shape and quality information of the tombstone images;
if the converted calligraphy work to be processed is a signature image, processing the converted calligraphy work to be processed through the guide filter to obtain an image containing character shape and quality, expression information, seal shape and quality and expression information in the signature image;
extracting a first channel numerical value in the converted calligraphy works to be processed, and distinguishing the types of the calligraphy works to be processed according to a first threshold value, wherein the method comprises the following steps:
processing the converted calligraphy works to be processed, and determining a first channel numerical value in the converted calligraphy works to be processed;
determining a first threshold value for distinguishing the foreground and the background in the converted calligraphy work to be processed according to the first channel numerical value;
if the first threshold value is larger than or equal to a preset threshold value, the converted calligraphy work to be processed is a post image;
if the first threshold value is smaller than a preset threshold value, the converted calligraphy works to be processed are tombstone images;
if the converted calligraphy works to be processed are signature images, the converted calligraphy works to be processed are processed through the guide filter to obtain images containing character shape and character, expression information, seal shape and character and expression information in the signature images, and the method comprises the following steps:
performing binarization processing on the converted calligraphy work to be processed according to a second channel number to obtain a binarized second template;
according to the inverted numerical value of the third channel in the converted calligraphy work to be processed, combining with a preset second threshold value, obtaining a third template after binarization of the converted calligraphy work to be processed;
combining the second template and the third template to obtain a combined template, and combining the converted image to be processed, extracting the font information and the expression information of the characters and the seal in the poster image through a guide filter to obtain an image containing the font information and the expression information of the characters and the seal in the poster image;
the expression information refers to stroke front, virtual and real information of character strokes in the poster image and seal information.
2. The method according to claim 1, wherein if the converted calligraphy work to be processed is a tombstone image, the tombstone image is processed through a guiding filter to obtain an image containing word and character information of the tombstone image, and the method comprises the following steps:
performing binarization processing on the converted calligraphy work to be processed according to the second channel number to obtain a binarized first template;
denoising the converted calligraphy works to be processed by using a guide filter to obtain a denoised smooth template;
and according to the first template and the denoised smooth template, extracting the shape and quality information of the characters in the tombstone image through the guide filter to obtain the image containing the character shape and quality information of the tombstone image.
3. The method according to claim 2, wherein the denoising processing is performed on the converted calligraphy work to be processed by using the guided filter to obtain a denoised smooth template, and specifically comprises:
denoising the converted calligraphy works to be processed according to a first formula to obtain a denoised smooth template, wherein the first formula is
<mrow> <msub> <mi>I</mi> <mi>O</mi> </msub> <mrow> <mo>(</mo> <mi>x</mi> <mo>,</mo> <mi>y</mi> <mo>)</mo> </mrow> <mo>=</mo> <msub> <mi>a</mi> <mi>k</mi> </msub> <msub> <mi>I</mi> <mi>g</mi> </msub> <mrow> <mo>(</mo> <mi>x</mi> <mo>,</mo> <mi>y</mi> <mo>)</mo> </mrow> <mo>+</mo> <msub> <mi>b</mi> <mi>k</mi> </msub> <mo>,</mo> <mo>&ForAll;</mo> <mrow> <mo>(</mo> <mi>x</mi> <mo>,</mo> <mi>y</mi> <mo>)</mo> </mrow> <mo>&Element;</mo> <msub> <mi>&omega;</mi> <mi>k</mi> </msub> <mo>,</mo> </mrow>
Wherein, IO(x, y) is the pixel value at the coordinate position (x, y) in the filtered and transformed image, akAnd bkIs a linear coefficient, Ig(x, y) is a pixel value at which the coordinate position in the guide image is (x, y), ωkA local window centered around pixel (x, y) and having a radius r.
4. The method of claim 3, further comprising:
carrying out secondary denoising treatment on the smooth template by using a second formula to obtain a secondarily denoised smooth template, wherein the second formula is
<mrow> <msub> <mi>&sigma;</mi> <mi>n</mi> </msub> <mo>=</mo> <msqrt> <mfrac> <mi>&pi;</mi> <mn>2</mn> </mfrac> </msqrt> <mfrac> <mn>1</mn> <mrow> <mn>6</mn> <mrow> <mo>(</mo> <mi>W</mi> <mo>-</mo> <mn>2</mn> <mo>)</mo> </mrow> <mrow> <mo>(</mo> <mi>H</mi> <mo>-</mo> <mn>2</mn> <mo>)</mo> </mrow> </mrow> </mfrac> <munderover> <mo>&Sigma;</mo> <mrow> <mi>x</mi> <mo>=</mo> <mn>1</mn> </mrow> <mi>W</mi> </munderover> <munderover> <mo>&Sigma;</mo> <mrow> <mi>y</mi> <mo>=</mo> <mn>1</mn> </mrow> <mi>H</mi> </munderover> <mo>|</mo> <mi>I</mi> <mrow> <mo>(</mo> <mi>x</mi> <mo>,</mo> <mi>y</mi> <mo>)</mo> </mrow> <mo>*</mo> <mi>N</mi> <mo>|</mo> <mo>,</mo> </mrow>
Wherein σnIs the variance of the calculated noise, W and H represent the width and height, respectively, of the image I, and N is the mask operator.
5. The method of claim 1, wherein said combining the second template and the third template to obtain a combined template comprises:
obtaining a combined template according to a third formula
Wherein CS (x, y) is a pixel value at a coordinate (x, y) in the obtained combined template, C (x, y) is a pixel value at a coordinate (x, y) in the second template of the character in the post image, and S (x, y) is a pixel value at a coordinate (x, y) in the third template of the stamp in the post image.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510080291.4A CN104834890B (en) | 2015-02-13 | 2015-02-13 | A kind of extracting method to word expression information in calligraphy work |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510080291.4A CN104834890B (en) | 2015-02-13 | 2015-02-13 | A kind of extracting method to word expression information in calligraphy work |
Publications (2)
Publication Number | Publication Date |
---|---|
CN104834890A CN104834890A (en) | 2015-08-12 |
CN104834890B true CN104834890B (en) | 2018-01-05 |
Family
ID=53812768
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510080291.4A Active CN104834890B (en) | 2015-02-13 | 2015-02-13 | A kind of extracting method to word expression information in calligraphy work |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104834890B (en) |
Families Citing this family (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105404885B (en) * | 2015-10-28 | 2019-03-22 | 北京工业大学 | A kind of two dimension character graphics identifying code complex background noise jamming minimizing technology |
CN105373798B (en) * | 2015-11-20 | 2018-08-28 | 西北大学 | One kind scratching figure and the morphologic writing brush word extracting method of mathematics based on k nearest neighbor |
CN107403405A (en) * | 2016-05-20 | 2017-11-28 | 富士通株式会社 | Image processing apparatus, image processing method and information processor |
CN106156794B (en) * | 2016-07-01 | 2020-12-25 | 北京旷视科技有限公司 | Character recognition method and device based on character style recognition |
CN106446920B (en) * | 2016-09-05 | 2019-10-01 | 电子科技大学 | A kind of stroke width transform method based on gradient amplitude constraint |
CN108764070B (en) * | 2018-05-11 | 2021-12-31 | 西北大学 | Stroke segmentation method based on writing video and calligraphy copying guidance method |
CN110533049B (en) * | 2018-05-23 | 2023-05-02 | 富士通株式会社 | Method and device for extracting seal image |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1920819A (en) * | 2006-09-14 | 2007-02-28 | 浙江大学 | Writing brush calligraphy character seach method |
CN101635099A (en) * | 2008-07-22 | 2010-01-27 | 张炳煌 | Chinese dynamic copybook writing system |
CN103077516A (en) * | 2012-12-31 | 2013-05-01 | 温佩芝 | Digital rubbing method for stone inscription characters |
-
2015
- 2015-02-13 CN CN201510080291.4A patent/CN104834890B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1920819A (en) * | 2006-09-14 | 2007-02-28 | 浙江大学 | Writing brush calligraphy character seach method |
CN101635099A (en) * | 2008-07-22 | 2010-01-27 | 张炳煌 | Chinese dynamic copybook writing system |
CN103077516A (en) * | 2012-12-31 | 2013-05-01 | 温佩芝 | Digital rubbing method for stone inscription characters |
Non-Patent Citations (3)
Title |
---|
subpixel edge detection of color images by principal axis analysis and moment-preserving principle;Cheng S C等;《pattern recognition》;20051231;全文 * |
书法碑帖文字的笔划提取技术及其实现;赵琪;《中国优秀硕士学位论文全文数据库》;20110315;全文 * |
古籍手写汉字图像分割算法研究;朱雷;《中国优秀硕士学位论文全文数据库》;20111215;全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN104834890A (en) | 2015-08-12 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104834890B (en) | A kind of extracting method to word expression information in calligraphy work | |
CN110619642B (en) | Method for separating seal and background characters in bill image | |
CN103020917B (en) | Method for restoring ancient Chinese calligraphy and painting images on basis of conspicuousness detection | |
CN108805957B (en) | Vector diagram generation method and system based on bitmap image self-adaptive segmentation | |
CN106096610B (en) | A kind of file and picture binary coding method based on support vector machines | |
US9251614B1 (en) | Background removal for document images | |
CN103439338B (en) | Film defects sorting technique | |
CN104408449B (en) | Intelligent mobile terminal scene literal processing method | |
CN107316077A (en) | A kind of fat cell automatic counting method based on image segmentation and rim detection | |
CN101599125A (en) | The binarization method that the complex background hypograph is handled | |
CN103984958A (en) | Method and system for segmenting cervical caner cells | |
CN103942794A (en) | Image collaborative cutout method based on confidence level | |
CN104680130A (en) | Chinese character recognition method for identification cards | |
Shaikh et al. | A novel approach for automatic number plate recognition | |
CN104766344B (en) | Vehicle checking method based on movement edge extractor | |
CN112614062A (en) | Bacterial colony counting method and device and computer storage medium | |
CN104143199B (en) | Image processing method for color laser marking | |
CN109241973A (en) | A kind of full-automatic soft dividing method of character under grain background | |
JP2012527665A (en) | Apparatus and method for identifying the original author of a work of art | |
CN105373798B (en) | One kind scratching figure and the morphologic writing brush word extracting method of mathematics based on k nearest neighbor | |
CN105069788A (en) | Cluster segmentation method for ancient architecture wall inscription contaminated writing brush character image | |
CN112070684B (en) | Method for repairing characters of a bone inscription based on morphological prior features | |
CN113158977B (en) | Image character editing method for improving FANnet generation network | |
CN113538498A (en) | Seal image segmentation method based on local binarization, electronic device and readable storage medium | |
CN110807747B (en) | Document image noise reduction method based on foreground mask |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
EXSB | Decision made by sipo to initiate substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |