A character recognition method suitable for characters printed by dot matrix inkjet coding equipment

By acquiring and processing character images printed by dot matrix inkjet device and selecting and matching templates, the problems of slow recognition speed and low accuracy in the prior art are solved, fast and accurate character recognition is achieved, and hardware costs are reduced.

CN114495104BActive Publication Date: 2025-04-04SHENZHEN EMICO MARKING TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111573784.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-21
Publication Date
2025-04-04
Estimated Expiration
2041-12-21

AI Technical Summary

Technical Problem

The prior art cannot effectively identify the character content printed by dot matrix inkjet device, and the recognition speed is slow and the accuracy is low, so it cannot meet user needs.

Method used

The digital imaging device obtains the character image to be recognized, selects the matching template, enlarges in equal proportions, scores and accumulates the matching degree to identify the characters to be identified.

Benefits of technology

It realizes fast and accurate recognition of character content printed by dot matrix inkjet equipment, improves recognition speed and accuracy, and saves hardware costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114495104B_ABST
    Figure CN114495104B_ABST
Patent Text Reader

Abstract

The present invention provides a character recognition method applicable to the character content printed by a dot matrix inkjet printer, comprising the following steps: Step 1: Acquire a character image to be recognized by a digital imaging device; Step 2: Select a corresponding matching template according to the font and size of the current printed content; Step 3: Proportionately enlarge the template according to the size of the character image to be recognized to form a standard template to be matched; Step 4: Score the matching degree of each standard template in units of ink droplets; Step 5: Accumulate the individual point scores according to the weights to obtain the highest matching score and recognize the character to be recognized. The beneficial effects of the present invention are: 1. The recognition speed is fast and the accuracy is high for the character content printed by the dot matrix inkjet printer. 2. The CPU speed requirement is low, saving the cost of purchasing hardware. 3. There are fewer peripheral circuits, saving board space and low cost.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to a character recognition method suitable for character contents sprayed by a dot matrix inkjet coding device. Background Art

[0002] The current dot matrix inkjet coding equipment has been widely used. However, the existing technology has a slow recognition speed and low accuracy for the character content printed by the dot matrix inkjet coding equipment, which cannot meet user needs. Summary of the invention

[0003] The present invention provides a character recognition method applicable to the character content printed by a dot matrix inkjet coding device, comprising the following steps:

[0004] Step 1: Obtaining a character image to be recognized by a digital imaging device;

[0005] Step 2: Select the corresponding matching template according to the font and size of the current printing content;

[0006] Step 3: Enlarge the template in proportion to the size of the character image to be recognized to form a standard template to be matched;

[0007] Step 4: Score the matching degree of each standard template in units of ink droplets;

[0008] Step 5: Accumulate the scores of each point according to the weight to obtain the highest matching score and identify the character to be recognized.

[0009] As a further improvement of the present invention, in step 2:

[0010] The printing font is dynamically obtained by connecting with the front-end inkjet device, so that the font matched each time is the font corresponding to the previous printing content;

[0011] The printing font size is dynamically obtained by interconnecting with the front-end inkjet coding equipment, so that the font size matched each time is the font size corresponding to the previous printing content;

[0012] The ink drop size is retrieved based on the nozzle model currently used by the inkjet printer;

[0013] According to the selected font and size, the corresponding font image file is indexed in the computing mechanism that performs image recognition.

[0014] As a further improvement of the present invention, in step 4:

[0015] Counting the number of valid dots that meet the grayscale value of ink droplets in the matrix of each position to be printed;

[0016] The ratio of the number of valid points to the total number of points in the current matrix is ​​used as the recognition score of the position;

[0017] The score of each position to be printed needs to be added to the scores of the adjacent positions multiplied by a configurable proportionality factor to obtain the final score of the position.

[0018] As a further improvement of the present invention, in step 5:

[0019] For the point where the ink droplet is to be printed, the weight score of each matrix position is obtained using the final score obtained in step 4;

[0020] The weighted scores are accumulated and the total score of each standard template is calculated;

[0021] Sort the total scores and get the scores of the top 3 ranked characters;

[0022] The first three scores are compared. When the score of the first character is greater than the sum of the scores of the second and third characters, the character is considered to be the final matching character.

[0023] As a further improvement of the present invention, the step 1 comprises:

[0024] Step 1: Obtain the original image data through the interface API driver, and convert the image format according to the sensor settings to obtain the original binary data of the image to be detected;

[0025] Step 2: Binarize the original image according to the grayscale value of the input background image and the grayscale value of the foreground ink droplet, and extract the effective binary image;

[0026] Step 3: Filter out the noise in the image through the corrosion algorithm. The parameters of the corrosion calculation can be set externally.

[0027] Step 4: Dilate the denoised image after corrosion so that the ink droplets can be connected to each other, preparing for the subsequent connected domain identification;

[0028] Step 5: Connected domain processing, calculate the connected domain of the image, extract the characters to be recognized through four-connected or eight-connected algorithms, and form the image coordinates and pixel data information of the characters to be detected;

[0029] Step 6: Inversely mark the character image in the original image according to the connected domain data to provide the original image information for the subsequent recognition process;

[0030] Step 7: Correct the original ink drop position in the horizontal and vertical directions, correct the horizontal and vertical ink drop position, and complete the character correction.

[0031] As a further improvement of the present invention, in step 2, for the binary algorithm of the inkjet coding image, since the shooting conditions are controllable and the foreground and background colors of the product are relatively fixed, a binary algorithm with a fixed threshold is selected for processing:

[0032] Input the HSV values ​​of foreground and background through the human-computer interaction interface;

[0033] Enter the allowable offset range of the HSV value through the human-computer interaction interface;

[0034] Convert the original image grayscale value into HSV space according to the following algorithm to obtain each component:

[0035] R'=R / 255

[0036] G'=G / 255

[0037] B'=B / 255

[0038] C max = max(R', G', B')

[0039] Cmin=min(R',G',B')

[0040] Δ=C max-C min

[0041] H calculation:

[0042] Hue

[0043]

[0044] S calculation:

[0045] Saturation

[0046]

[0047] V calculation:

[0048] Value

[0049] V=Cmax

[0050] When the saturation S is greater than the preset threshold, the chromaticity H is judged, and the pixel points that meet the foreground image are positioned as the foreground, and the pixel points that meet the background image are positioned as the background. The points that do not meet the requirements are set as pending points.

[0051] When the saturation S is less than the preset threshold, the brightness V is further judged. If the brightness is also lower than the threshold, the current point is determined to be a pending point. Otherwise, the chromaticity H value is further determined to determine whether the current point is a foreground or background.

[0052] As a further improvement of the present invention, in step 3, according to the characteristics of the inkjet image, that is, the object of interest is a character or graphic composed of inkjet ink droplets:

[0053] The ink droplets printed by the inkjet printer are all circular, and the corrosion algorithm is carried out through the 8-link criterion;

[0054] The erosion filter window is set to 3 × 3 pixels;

[0055] During corrosion filtering, the undetermined point is treated as a background point;

[0056] The execution times of the corrosion algorithm can be set through the human-computer interaction interface, and the corrosion times can be set according to the size of the printed ink droplets to filter out noise while retaining the original ink droplets.

[0057] As a further improvement of the present invention, in step 4,

[0058] The execution times of the expansion algorithm are set through the human-computer interaction interface. During the debugging stage, the expansion times are reasonably adjusted according to the actual ink droplet size, so that the ink droplets are finally connected; the expansion filter window size is 3×3 pixels.

[0059] As a further improvement of the present invention, in step 5,

[0060] Adopt the connected domain algorithm based on runlength analysis;

[0061] Establish a travel statistics data table, which is initialized at the beginning of each image;

[0062] Extract a single trip line by line from the image, count the coordinates of the starting point and end point of the trip, and then extract the number of pixels of the trip;

[0063] Update the trip statistics table. For a new trip, that is, when there is no other trip above it, create a new table entry, use the y coordinate of the trip as the fixed point coordinate of the object, and start recording the x, y coordinates and the number of valid pixels of the trip;

[0064] For inherited strokes, that is, when there are other strokes above the stroke, the data table item corresponding to the stroke is updated, the x coordinate of the current stroke is compared, the left and right coordinates of the object corresponding to the item are judged, and the coordinates are updated if they meet the conditions, and the pixel points of the current stroke are merged into the points of the object;

[0065] After completing the travel identification statistics of the entire image, the travel data table is merged, and the reversely connected objects are merged to form the final object statistics table. The statistics table contains the following information: the number of objects in the current frame image, the number of each object, the up, down, left, and right coordinates of each object, and the number of pixels of each object.

[0066] The present invention also discloses a character recognition system applicable to the character content printed by a dot matrix inkjet coding device, comprising: a memory, a processor, and a computer program stored in the memory, wherein the computer program is configured to implement the steps of the character recognition method of the present invention when called by the processor;

[0067] The present invention also discloses a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program is configured to implement the steps of the character recognition method of the present invention when called by a processor.

[0068] The beneficial effects of the present invention are: 1. The recognition speed is fast and the accuracy is high for the characters printed by the dot matrix inkjet printer. 2. The CPU speed requirement is low, which saves the hardware purchase cost. 3. The peripheral circuits are few, which saves the board space and has low cost. BRIEF DESCRIPTION OF THE DRAWINGS

[0069] Figure 1 is a flow chart of the present invention;

[0070] Figure 2 is a flow chart of an embodiment of the present invention. DETAILED DESCRIPTION

[0071] like Figure 1 As shown, the present invention discloses a character recognition method applicable to the character content printed by a dot matrix inkjet coding device, comprising the following steps:

[0072] Step 1: Obtaining a character image to be recognized by a digital imaging device;

[0073] Step 2: Select the corresponding matching template according to the font and size of the current printing content;

[0074] Step 3: Enlarge the template in proportion to the size of the character image to be recognized to form a standard template to be matched;

[0075] Step 4: Score the matching degree of each standard template in units of ink droplets;

[0076] Step 5: Accumulate the scores of each point according to the weight to obtain the highest matching score and identify the character to be recognized.

[0077] In step 2:

[0078] The printing font is dynamically obtained by connecting with the front-end inkjet device, so that the font matched each time is the font corresponding to the previous printing content;

[0079] The printing font size is dynamically obtained by interconnecting with the front-end inkjet coding equipment, so that the font size matched each time is the font size corresponding to the previous printing content;

[0080] The ink drop size is retrieved based on the nozzle model currently used by the inkjet printer;

[0081] According to the selected font size, the corresponding font image file is indexed in the computing mechanism that performs image recognition, such as a processor based on an X86 platform, a computing unit based on a DSP core, or a processing platform based on a GPU platform.

[0082] In step 4:

[0083] Counting the number of valid dots that meet the grayscale value of ink droplets in the matrix of each position to be printed;

[0084] The ratio of the number of valid points to the total number of points in the current matrix is ​​used as the recognition score of the position;

[0085] According to the working characteristics of the character inkjet printer, the score of each position to be printed needs to be added to the score of the adjacent position multiplied by a configurable proportional coefficient to obtain the final score of the position.

[0086] In step 5:

[0087] For the point where the ink droplet is to be printed, the weight score of each matrix position is obtained using the final score obtained in step 4;

[0088] The weighted scores are accumulated and the total score of each standard template is calculated;

[0089] Sort the total scores and get the scores of the top 3 ranked characters;

[0090] The first three scores are compared. When the score of the first character is greater than the sum of the scores of the second and third characters, the character is considered to be the final matching character.

[0091] like Figure 2 As shown, the step 1 includes:

[0092] Step 1: Obtain the original image data through the interface API driver, and convert the image format according to the sensor settings to obtain the original binary data of the image to be detected;

[0093] Step 2: Binarize the original image according to the grayscale value of the input background image and the grayscale value of the foreground ink droplet, and extract the effective binary image;

[0094] Step 3: Filter out the noise in the image through the corrosion algorithm. The parameters of the corrosion calculation can be set externally.

[0095] Step 4: Dilate the denoised image after corrosion so that the ink droplets can be connected to each other, preparing for the subsequent connected domain identification;

[0096] Step 5: Connected domain processing, calculate the connected domain of the image, extract the characters to be recognized through four-connected or eight-connected algorithms, and form the image coordinates and pixel data information of the characters to be detected;

[0097] Step 6: Inversely mark the character image in the original image according to the connected domain data to provide the original image information for the subsequent recognition process;

[0098] Step 7: Correct the original ink drop position in the horizontal and vertical directions, correct the horizontal and vertical ink drop position, and complete the character correction to compensate for the interference of the CIJ inkjet coding equipment ink drop position fluctuation on character recognition.

[0099] In step 2, for the binary algorithm of the inkjet coding image, since the shooting conditions are controllable and the foreground and background colors of the product are relatively fixed, this method selects a binary algorithm with a fixed threshold for processing:

[0100] Input the HSV values ​​of foreground and background through the human-computer interaction interface;

[0101] Enter the allowable offset range of the HSV value through the human-computer interaction interface;

[0102] Convert the original image grayscale value into HSV space according to the following algorithm to obtain each component:

[0103] R'=R / 255

[0104] G'=G / 255

[0105] B'=B / 255

[0106] C max = max(R', G', B')

[0107] Cmin=min(R',G',B')

[0108] Δ=C max-C min

[0109] H calculation:

[0110] Hue

[0111]

[0112] S calculation:

[0113] Saturation

[0114]

[0115] V calculation:

[0116] Value

[0117] V=Cmax

[0118] When the saturation S is greater than the preset threshold, the chromaticity H is judged, and the pixel points that meet the foreground image are positioned as the foreground, and the pixel points that meet the background image are positioned as the background. The points that do not meet the requirements are set as pending points.

[0119] When the saturation S is less than the preset threshold, the brightness V is further judged. If the brightness is also lower than the threshold, the current point is determined to be a pending point. Otherwise, the chromaticity H value is further determined to determine whether the current point is a foreground or background.

[0120] In step 3, according to the characteristics of the inkjet image, that is, the object of interest is the characters or graphics composed of inkjet ink droplets:

[0121] The ink droplets printed by CIJ inkjet printers are all circular, and the corrosion algorithm is performed through the 8-link criterion; the corrosion filter window is set to 3×3 pixels to avoid corrosion distortion when the ink droplets are small;

[0122] During corrosion filtering, the undetermined point is treated as a background point;

[0123] The execution times of the corrosion algorithm can be set through the human-computer interaction interface, and the corrosion times can be set according to the size of the printed ink droplets to filter out noise while retaining the original ink droplets.

[0124] In step 4, the execution times of the expansion algorithm are set through the human-computer interaction interface, and the expansion times are reasonably adjusted according to the actual ink droplet size during the debugging stage, so that the ink droplets are finally connected; the expansion filter window size is 3×3 pixels.

[0125] In the step five,

[0126] Inkjet character recognition requires high algorithm speed. In some cases, the processing time of an image needs to be less than 20ms, so the algorithm efficiency is required to be high.

[0127] In the process of connecting domain extraction, considering the above efficiency requirements, the algorithm advocated by the present invention is to use a connecting domain algorithm based on runlength analysis;

[0128] Create a travel statistics table, which is initialized at the beginning of each image;

[0129] Extract a single trip line by line from the image, count the coordinates of the starting point and end point of the trip, and then extract the number of pixels of the trip;

[0130] Update the trip statistics table. For a new trip, that is, when there is no other trip above it, create a new table entry, use the y coordinate of the trip as the fixed point coordinate of the object, and start recording the x, y coordinates and the number of valid pixels of the trip;

[0131] For inherited strokes, that is, when there are other strokes above the stroke, the data table item corresponding to the stroke is updated, the x coordinate of the current stroke is compared, the left and right coordinates of the object corresponding to the item are judged, and the coordinates are updated if they meet the conditions, and the pixel points of the current stroke are merged into the points of the object;

[0132] After completing the travel identification statistics of the entire image, the travel data table is merged, and the reversely connected objects are merged to form the final object statistics table. The statistics table contains the following information: the number of objects in the current frame image, the number of each object, the up, down, left, and right coordinates of each object, and the number of pixels of each object.

[0133] The present invention also discloses a character recognition system suitable for character contents printed by a dot matrix inkjet coding device, comprising: a memory, a processor and a computer program stored on the memory, wherein the computer program is configured to implement the steps of the character recognition method of the present invention when called by the processor.

[0134] The present invention also discloses a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program is configured to implement the steps of the character recognition method of the present invention when called by a processor.

[0135] The beneficial effects of the present invention are as follows:

[0136] 1. For CIJ dot characters, the recognition speed is fast and the accuracy is high.

[0137] 2. Low CPU speed requirement, saving hardware purchase costs.

[0138] 3. Fewer peripheral circuits, saving board space and low cost.

[0139] The above contents are further detailed descriptions of the present invention in combination with specific preferred embodiments, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. For ordinary technicians in the technical field to which the present invention belongs, several simple deductions or substitutions can be made without departing from the concept of the present invention, which should be regarded as falling within the protection scope of the present invention.

Claims

1. A character recognition method applicable to the character content printed by a dot matrix inkjet coding device, characterized in that: The steps include: Step 1: Obtaining a character image to be recognized by a digital imaging device; which includes: Step 1: Obtain the original image data through the interface API driver, and convert the image format according to the sensor settings to obtain the original binary data of the image to be detected; Step 2: Binarize the original image according to the grayscale value of the input background image and the grayscale value of the foreground ink droplet, and extract the effective binary image; Step 3: Filter out the noise in the image through the corrosion algorithm. The parameters of the corrosion calculation can be set externally. Step 4: Dilate the denoised image after corrosion so that the ink droplets can be connected to each other, preparing for the subsequent connected domain identification; Step 5: Connected domain processing, calculate the connected domain of the image, extract the characters to be recognized through the four-connected or eight-connected algorithm, and form the image coordinates and pixel data information of the characters to be tested; specifically: Adopt the connected domain algorithm based on runlength analysis; Establish a travel statistics data table, which is initialized at the beginning of each image; Extract a single trip line by line from the image, count the coordinates of the starting point and end point of the trip, and then extract the number of pixels of the trip; Update the trip statistics table. For a new trip, that is, when there is no other trip above it, create a new table entry, use the y coordinate of the trip as the fixed point coordinate of the object, and start recording the x, y coordinates and number of valid pixels of the trip; For inherited strokes, that is, when there are other strokes above the stroke, the data table item corresponding to the stroke is updated, the x coordinate of the current stroke is compared, the left and right coordinates of the object corresponding to the item are judged, and the coordinates are updated if they meet the conditions, and the pixel points of the current stroke are merged into the points of the object; After completing the trip identification statistics of the entire image, merge the trip data table, merge the reversely connected objects, and form the final object statistics table. The statistics table contains the following information: the number of objects in the current frame image, the number of each object, the up, down, left, and right coordinates of each object, and the number of pixels of each object; Step 6: Inversely mark the character image in the original image according to the connected domain data to provide the original image information for the subsequent recognition process; Step 7: Correct the original ink drop position in the horizontal and vertical directions, correct the horizontal and vertical ink drop positions, and complete the character correction; Step 2: Select the corresponding matching template according to the font and size of the current printing content; Step 3: Enlarge the template in proportion to the size of the character image to be recognized to form a standard template to be matched; Step 4: Score the matching degree of each standard template in units of ink droplets; Step 5: Accumulate the scores of each point according to the weight to obtain the highest matching score and identify the character to be recognized.

2. The character recognition method according to claim 1, characterized in that: In step 2: The printing font is dynamically obtained by connecting with the front-end inkjet device, so that the font matched each time is the font corresponding to the previous printing content; The printing font size is dynamically obtained by interconnecting with the front-end inkjet coding equipment, so that the font size matched each time is the font size corresponding to the previous printing content; The ink drop size is retrieved based on the nozzle model currently used by the inkjet printer; According to the selected font and size, the corresponding font image file is indexed in the computing mechanism that performs image recognition.

3. The character recognition method according to claim 1, characterized in that: In step 4: Counting the number of valid dots that meet the grayscale value of ink droplets in the matrix of each position to be printed; The ratio of the number of valid points to the total number of points in the current matrix is ​​used as the recognition score of the position; The score of each position to be printed needs to be added to the scores of the adjacent positions multiplied by a configurable proportionality factor to obtain the final score of the position.

4. The character recognition method according to claim 1, characterized in that: In step 5: For the point where the ink droplet is to be printed, the weight score of each matrix position is obtained using the final score obtained in step 4; Accumulate the weighted scores and calculate the total score of each matching template; Sort the total scores and get the scores of the top 3 ranked characters; The first three scores are compared. When the score of the first character is greater than the sum of the scores of the second and third characters, the character is considered to be the final matching character.

5. The character recognition method according to claim 1, characterized in that: In step 2, for the binary algorithm of the inkjet coding image, since the shooting conditions are controllable and the foreground and background colors of the product are relatively fixed, a binary algorithm with a fixed threshold is selected for processing: Input the HSV values ​​of foreground and background through the human-computer interaction interface; Enter the allowable offset range of the HSV value through the human-computer interaction interface; Convert the original image grayscale value into HSV space according to the following algorithm to obtain each component: R′=R / 255 G′=G / 255 B′=B / 255 Cmax=max(R′,G′,B′) Cmin=min(R′,G′,B′) Δ=Cmax-Cmin H calculation: Hue S calculation: Saturation V calculation: Value V=Cmax When the saturation S is greater than the preset threshold, the chromaticity H is judged, and the pixel points that meet the foreground image are positioned as the foreground, and the pixel points that meet the background image are positioned as the background. The points that do not meet the requirements are set as pending points. When the saturation S is less than the preset threshold, the brightness V is further judged. If the brightness is also lower than the threshold, the current point is determined to be a pending point. Otherwise, the chromaticity H value is further determined to determine whether the current point is a foreground or background.

6. The character recognition method according to claim 5, characterized in that: In step 3, according to the characteristics of the inkjet image, that is, the object of interest is the characters or graphics composed of inkjet ink droplets: The ink droplets printed by the inkjet printer are all circular, and the corrosion algorithm is carried out through the 8-link criterion; The erosion filter window is set to 3 × 3 pixels; During the corrosion filtering, the undetermined point is treated as a background point; The execution times of the corrosion algorithm can be set through the human-computer interaction interface, and the corrosion times can be set according to the size of the printed ink droplets to filter out noise while retaining the original ink droplets.

7. The character recognition method according to claim 6, characterized in that: In the step 4, The execution times of the expansion algorithm are set through the human-computer interaction interface, and the expansion times are reasonably adjusted according to the actual ink droplet size during the debugging stage, so that the ink droplets are finally connected; The dilation filter window size is 3×3 pixels.

8. A character recognition system suitable for characters printed by a dot matrix inkjet printer, characterized in that: include: A memory, a processor and a computer program stored in the memory, wherein the computer program is configured to implement the steps of the character recognition method according to any one of claims 1 to 7 when called by the processor.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is configured to implement the steps of the character recognition method according to any one of claims 1 to 7 when called by a processor.

Citation Information

Patent Citations

  • Printing style digital recognition method based on template matching

    CN104463195A

  • Character recognition device, character recognition method and character data

    CN1955981A