Calligraphy font retrieval method
By segmenting and preprocessing the images of calligraphy works, calculating the HOG feature information of calligraphy fonts, and searching the database based on the feature information, the problem of being unable to quickly and accurately retrieve calligraphy fonts in the existing technology is solved, and efficient and accurate calligraphy font search is achieved.
Patent Information
- Application Number
- CN202510696889.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-28
- Publication Date
- 2025-06-27
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art cannot search individual calligraphy fonts quickly and accurately, and cannot search without the label information.
By obtaining the image of calligraphy works, a single calligraphy font image is obtained, pre-processing includes the minimum encirclement method cutting and red consideration processing, calculating the HOG feature information of the calligraphy font, and generating filter conditions based on the feature information, and performing database searches to achieve fast and accurate calligraphy font search.
It realizes fast and accurate retrieval of calligraphy fonts, narrows the search range, improves the search speed, and improves the recognition accuracy through HOG feature recognition.
Smart Images

Figure QLYQS_1 
Figure QLYQS_2 
Figure QLYQS_3
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and particularly relates to a method for retrieving calligraphy fonts. Background Art
[0002] Calligraphy works belong to precious art creations. Calligraphy works by some famous artists have high value and are mostly collected in museums and libraries. For the convenience of consultation, the preservation units mostly provide scanned images of calligraphy works and provide users with a retrieval service for calligraphy characters through a digital library portal to achieve resource sharing. However, due to the various forms and styles of calligraphy characters, the retrieval function of calligraphy characters is basically for retrieving the already marked information such as the name, author, font, style, and age of calligraphy works, and it is impossible to retrieve a single calligraphy font without the marked information. Therefore, it is necessary to develop a method for retrieving calligraphy fonts that can quickly and accurately retrieve. Summary of the Invention
[0003] The technical problem to be solved by the present invention is to provide a method for retrieving calligraphy fonts that can quickly and accurately retrieve.
[0004] To solve the above technical problem, the technical solution of the present invention is a method for retrieving calligraphy fonts, including the following steps: S1. Obtain a calligraphy work image, segment it to obtain a single calligraphy font image, and record the position sequence number of the single calligraphy font image in the calligraphy work; S2. Preprocessing; for the calligraphy font image with the target position sequence number, further crop it using the minimum bounding method; then adjust the size of the pixel number of the image to make its pixel number reach a preset threshold; perform red filtering on the adjusted calligraphy work image and convert it into a binary image; S3. The images of the fonts stored in the database are all binary images that have been cropped using the method in step S2, meet the pixel number threshold, and have been red-filtered, and the feature information of the font image is stored; calculate the feature information of the calligraphy font binary image, generate a screening condition according to the feature information, and sequentially delete the fonts in the database that do not meet the screening condition according to the screening condition; the feature information includes height, width, and the ratio of height to width; S4. Calculate the vector feature of the binary image; S5. Input the calculated vector feature into the database for retrieval and return a matching value.
[0005] Further, the vector feature in step S4 is the HOG feature.
[0006] Further, the method of the minimum bounding method in step S2 is as follows: find the maximum and minimum values of the X coordinates and Y coordinates whose gray values satisfy the preset threshold, and draw two vertical lines along the two pixel points with the maximum X coordinate and the minimum X coordinate respectively; draw two horizontal lines along the two pixel points with the maximum Y coordinate and the minimum Y coordinate respectively, and the rectangle enclosed by the four lines is the calligraphy font image after further cropping.
[0007] Further, the screening conditions in step S3 are: , and ; or , and ; where H, W, and K are the height, width, and the ratio of length to width of the binary image of the calligraphy font respectively, and h, w, and k are the height, width, and the ratio of length to width of the font image in the database respectively; are preset thresholds greater than 1 respectively.
[0008] Further, the feature information further includes the proportion of the number of black pixel points in the image to the total number of pixel points; the screening condition is: ; Q is the proportion of the number of black pixel points in the binary image of the calligraphy font to the total number of pixel points; q is the proportion of the number of black pixel points in the image in the database to the total number of pixel points; is a preset threshold greater than 1.
[0009] Further, the feature information further includes the length of the contour line in the image ; the screening condition is: or ; L is the length of the contour line of the binary image of the calligraphy font; is the length of the contour line of the image in the database; is a preset threshold greater than 1.
[0010] Further, the feature information of the font images stored in the database further includes the corresponding simplified Chinese characters; the simplified Chinese characters corresponding to the images with the highest matching values retrieved for individual calligraphy font images in the calligraphy work are displayed in the order number of the positions of the individual calligraphy font images to form a sentence.
[0011] Further, analyze the sentence of the retrieved simplified Chinese characters and perform manual verification to determine whether there is a retrieval error for individual calligraphy fonts.
[0012] Advantages of the present invention: The present invention calculates the feature information of the binary image of the calligraphy font, generates a screening condition according to the feature information, and deletes some font images in the database that do not meet the screening condition, which can narrow the retrieval range and improve the retrieval speed; uses HOG features to retrieve the calligraphy font, and has a high recognition accuracy. The simplified Chinese characters in the feature information of the images retrieved for each individual calligraphy font in the entire calligraphy work are displayed in the order number of the position of each individual calligraphy font, and the context is combined to manually verify whether there is a retrieval error for a single calligraphy font. Detailed implementation manners
[0013] It should be noted here that the description of these implementation manners is used to help understand the present invention, but does not constitute a limitation to the present invention. In addition, the technical features involved in the various implementation manners of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0014] A method for retrieving calligraphy fonts includes the following steps: S1. Obtain a calligraphy work image, segment it to obtain individual calligraphy font images, and record the position sequence number of each individual calligraphy font image in the calligraphy work; S2. Preprocess; for the calligraphy font image with the target position sequence number, further crop it using the minimum bounding method; then adjust the size of the pixel number of the image to make its pixel number reach a preset threshold; perform red filtering on the adjusted calligraphy work image and convert it into a binary image; Among them, adjusting the size of the pixel number of the image to make it meet the preset threshold belongs to the prior art. In this embodiment, the threshold of the pixel number in the width direction of the picture is defined as W max , and the threshold of the pixel number in the height direction is H max , first calculate the ratio k1 of the pixel number W in the width direction of the image to be adjusted to W max , and then calculate whether the ratio of the pixel number H in the height direction of the image to be adjusted to k1 is less than or equal to H max ; if so, scale both the length and width of the image to be adjusted in proportion to k1 while maintaining the original aspect ratio; if not, calculate the ratio k2 of the pixel number H in the height direction of the image to be adjusted to H max , and scale both the length and width of the image to be adjusted in proportion to k2 while maintaining the original aspect ratio. Specifically, an interpolation algorithm is used to perform the scaling operation on the image, and the interpolation algorithm can select common interpolation algorithms such as Bicubic Interpolation, Bilinear Interpolation, and Lanczos.
[0015] The method of the minimum bounding method is as follows: Find the maximum and minimum values of the X coordinates and Y coordinates whose grayscale values satisfy the preset threshold, and draw two vertical lines along the two pixel points with the maximum X coordinate and the minimum X coordinate respectively; draw two horizontal lines along the two pixel points with the maximum Y coordinate and the minimum Y coordinate respectively. The rectangle enclosed by the four lines is the calligraphy font image after further cropping.
[0016] S3. The images of the fonts stored in the database are all binary images that have been cropped using the method in step S2, satisfy the pixel quantity threshold, and have undergone red filtering processing, and the feature information of the font images is stored; Calculate the feature information of the calligraphy font binary image, generate a screening condition according to the feature information, and sequentially delete the fonts in the database that do not meet the screening condition according to the screening condition; The feature information includes height, width, the ratio of height to width, the proportion of black pixel points to the total number of pixel points, and the contour line length. S31. The first screening condition is: , and ; or , and ; where H, W, and K are the height, width, and the ratio of length to width of the calligraphy font binary image respectively, and h, w, and k are the height, width, and the ratio of length to width of the font image in the database respectively; are preset thresholds greater than 1 respectively.
[0017] S32. The second screening condition is: ; Q is the proportion of black pixel points to the total number of pixel points in the calligraphy font binary image; q is the proportion of black pixel points to the total number of pixel points in the image in the database; is a preset threshold greater than 1.
[0018] S33. The third screening condition is: or ; L is the contour line length of the calligraphy font binary image; is the contour line length of the image in the database; is a preset threshold greater than 1.
[0019] S4. Calculate the HOG features of the binary image. S5. Input the calculated HOG features into the database for retrieval and return the matching value.
[0020] S6. The feature information of the font images stored in the database also includes the corresponding simplified Chinese characters; Display the simplified Chinese characters corresponding to the image with the highest matching value retrieved from the database for each single calligraphy font image in the calligraphy work in the order number of the position of the single calligraphy font image to form a sentence. S7. Analyze the sentences and phrases of the retrieved simplified Chinese characters, perform manual verification, and determine whether there are retrieval errors in individual calligraphy fonts.
[0021] The above has described the embodiments of the present invention in detail, but the present invention is not limited to the described embodiments. For those skilled in the art, without departing from the principle and spirit of the present invention, various changes, modifications, substitutions, and variations made to these embodiments still fall within the protection scope of the present invention.
Claims
1. A method for retrieving calligraphy characters, characterized in that: It includes the following steps: S1. Obtain a calligraphy work image, segment it to obtain individual calligraphy font images, and record the position sequence numbers of the individual calligraphy font images in the calligraphy work; S2. Preprocess; For the calligraphy font image with the target position sequence number, further crop it using the minimum bounding method; then adjust the size of the pixel quantity of the image to make its pixel quantity reach a preset threshold; perform red filtering on the adjusted calligraphy work image and convert it into a binary image; S4. The images of the fonts stored in the database are all images processed through the step S2, and the feature information of the font images is stored; Calculate the feature information of the calligraphy font binary image, generate a screening condition according to the feature information, and sequentially delete the fonts in the database that do not meet the screening condition; the feature information includes height, width, and the ratio of height to width; S6. Calculate the vector feature of the binary image; S7. Input the calculated vector feature into the database for retrieval and return a matching value.
2. The calligraphy character retrieval method according to claim 1, wherein: The method of the minimum bounding method in the step S2 is as follows: find the maximum and minimum values of the X coordinates and Y coordinates whose gray values meet the preset threshold, and respectively draw two vertical lines along the two pixel points with the maximum X coordinate and the minimum X coordinate; respectively draw two horizontal lines along the two pixel points with the maximum Y coordinate and the minimum Y coordinate, and the rectangle enclosed by the four lines is the further cropped calligraphy font image.
3. The calligraphy character retrieval method according to claim 1, characterized in that: The screening conditions in step S3 are as follows: and ; or and ; where H, W, and K are respectively the height, width, and the ratio of length to width of the binary image of the calligraphy font, and h, w, and k are respectively the height, width, and the ratio of length to width of the font image in the database; are respectively preset thresholds greater than 1.
4. The calligraphy character retrieval method according to claim 1, characterized in that: The feature information further includes the ratio of the number of black pixel points in the image to the total number of pixel points; the screening condition is: ; Q is the ratio of the number of black pixel points in the binarized image of the calligraphy font to the total number of pixel points; q is the ratio of the number of black pixel points in the image in the database to the total number of pixel points; is a preset threshold greater than 1.
5. The calligraphy character retrieval method according to claim 1, wherein: The feature information further includes the length of the contour line in the image ; The screening condition is: or ; L is the length of the contour line of the binary image of the calligraphy font; is the length of the contour line of the image in the database; is a preset threshold greater than 1.
6. The calligraphy character retrieval method according to claim 1, wherein: The feature information of the images of the fonts stored in the database further includes the corresponding simplified Chinese characters; display the simplified Chinese characters corresponding to the images with the highest matching values retrieved for the individual calligraphy font images in the calligraphy work in the order of the position sequence numbers of the individual calligraphy font images to form a sentence.
7. The calligraphy character retrieval method according to claim 6, characterized in that: Analyze the sentence of the retrieved simplified Chinese characters and perform manual verification to judge whether there is a retrieval error for the individual calligraphy font.
8. The calligraphy character retrieval method according to claim 1, characterized in that: The vector feature in the step S4 is the HOG feature.
Citation Information
Patent Citations
Elastic HOG (histograms of oriented gradient) feature-based Chinese calligraphy image retrieval method matched with DDTW (Derivative dynamic time wrapping)
CN103268363A
Calligraphy work Chinese character recognition and retrieval method and device and storage medium
CN116704515A
Writing brush calligraphy character seach method
CN1920819A