Print position acquisition method, device, apparatus, storage medium and program product

By scanning and recognizing the deflection angle of pre-printed paper, and using a character recognition model to determine the position of financial printing information, the problem of incorrect positioning caused by manual placement is solved, and accurate financial printing is achieved.

CN116301680BActive Publication Date: 2026-06-09INDUSTRIAL AND COMMERCIAL BANK OF CHINA

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
INDUSTRIAL AND COMMERCIAL BANK OF CHINA
Filing Date
2023-03-22
Publication Date
2026-06-09

AI Technical Summary

Technical Problem

In existing technologies, manually placing template paper onto the printer can easily lead to incorrect printing positions of financial data text content, resulting in overlap and tilting.

Method used

By scanning pre-printed paper to obtain paper images, identifying the deflection angle of the text area and rotating it in reverse, the text recognition model is used to obtain the text content and position information, and the accurate position of the financial printed information is determined based on the deflection angle.

Benefits of technology

It achieves accurate positioning of financial printing information on pre-printed paper, avoiding positional errors caused by manual placement and improving printing quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116301680B_ABST
    Figure CN116301680B_ABST
Patent Text Reader

Abstract

The application relates to a printing position acquisition method applied to the field of financial technology or other related fields. The method comprises the following steps: scanning pre-printed paper placed in a printing device to obtain a paper image corresponding to the pre-printed paper; identifying a character region in the paper image, obtaining a deflection angle of a character direction in the character region relative to a width direction of a pre-printed paper placement region of the printing device, and inversely rotating the paper image according to the deflection angle to obtain a corrected image corresponding to the paper image; inputting the corrected image into a pre-constructed character recognition model to obtain character content information and character position information in the corrected image; and in the case that the character content information matches character content in a pre-selected printing template, determining a printing position of pre-determined financial printing information on the pre-printed paper based on the character position information and the deflection angle. The method can accurately obtain the printing position of the financial printing information on the pre-printed paper.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of financial technology, and in particular to a method, apparatus, computer device, storage medium, and computer program product for obtaining print location. Background Technology

[0002] With the development of the fintech field, a method for printing financial document templates has emerged. This method involves manually placing the template-corresponding paper onto the printer, and then printing the relevant financial data and text onto the predetermined positions on the paper to obtain the printed financial document.

[0003] However, in the above technical solution, manually placing the template paper onto the printer can easily cause the template paper to tilt, resulting in incorrect printing position of the financial data text content, leading to overlapping and tilted text in the printed financial documents. Summary of the Invention

[0004] Therefore, it is necessary to provide a method, apparatus, computer device, computer-readable storage medium, and computer program product that can accurately obtain the printing position of financial text content, addressing the aforementioned technical problems.

[0005] Firstly, this application provides a method for printing a position. The method includes:

[0006] Scan the pre-printed paper placed in the printing device to obtain a paper image corresponding to the pre-printed paper;

[0007] Identify the text region in the paper image, obtain the deflection angle of the text direction in the text region relative to the width direction of the pre-printed paper placement area of ​​the printing device, and rotate the paper image in reverse according to the deflection angle to obtain the corrected image corresponding to the paper image;

[0008] The corrected image is input into a pre-built character recognition model to obtain the text content information and text position information in the corrected image;

[0009] If the text content information matches the text content in the pre-selected print template, the pre-determined print position of the financial print information on the pre-printed paper is determined based on the text position information and the deflection angle.

[0010] In one embodiment, the text region includes a first text region and a second text region; the step of identifying the text region in the paper image includes: inputting the paper image into a pre-constructed text region recognition model; identifying the first text region in the paper image through the horizontal text recognition branch in the text region recognition model; the first text region is obtained based on the horizontal arrangement attribute of the text in the paper image; identifying the second text region in the paper image through the oblique text recognition branch in the text region recognition model; the second text region is obtained based on the oblique arrangement attribute of the text in the paper image.

[0011] In one embodiment, obtaining the deflection angle of the text direction in the text region relative to the width direction of the pre-printed paper placement area of ​​the printing device includes: obtaining a first deflection angle of the text direction in the first text region relative to the width direction of the pre-printed paper placement area of ​​the printing device based on the first text region; obtaining a second deflection angle of the text direction in the second text region relative to the width direction of the pre-printed paper placement area of ​​the printing device based on the second text region; and obtaining the deflection angle according to preset weights corresponding to the first deflection angle, the second deflection angle, and the first deflection angle and the second deflection angle, respectively.

[0012] In one embodiment, identifying the second text region in the paper image through the tilted text recognition branch in the text region recognition model includes: obtaining a detection box for determining the second text region, and using a preset point on the boundary of the detection box as the rotation center of the detection box; determining the rotation angle range of the detection box, and identifying the second text region in the paper image through the tilted text recognition branch, the rotation center, and the rotation angle range.

[0013] In one embodiment, the text recognition model includes a text segmentation layer, a text feature extraction layer, and a text feature translation layer. The step of inputting the corrected image into the pre-constructed text recognition model to obtain text content information and text position information in the corrected image includes: inputting the corrected image into the text segmentation layer to obtain text images corresponding to each character in the corrected image, and text position information in the corrected image; inputting each text image into the text feature extraction layer to obtain text features corresponding to each character in the corrected image; and inputting the text features into the text feature translation layer to obtain text content information in the corrected image.

[0014] In one embodiment, determining the predetermined printing position of financial printing information on the pre-printed paper based on the text position information and the deflection angle includes: obtaining the initial printing position of the financial printing information on the correction image based on the text position information; and correcting the initial printing position according to the deflection angle to obtain the printing position of the financial printing information on the pre-printed paper.

[0015] In one embodiment, after determining the predetermined printing position of the financial printing information on the pre-printed paper based on the text position information and the deflection angle, the method further includes: printing the financial printing information onto the pre-printed paper based on the printing position to obtain printed paper; determining the page number information of unprinted paper based on the page number information of the printed paper and all page number information corresponding to the printing template; obtaining the page number information of the printed paper from the text content information of the printed paper; and displaying the page number information of the unprinted paper on the display terminal corresponding to the printing device to instruct the printing user to place the unprinted paper corresponding to the page number information of the unprinted paper into the printing device to continue printing.

[0016] Secondly, this application also provides a printing position acquisition device. The device includes:

[0017] The paper image acquisition module is used to scan the pre-printed paper placed in the printing device to obtain the paper image corresponding to the pre-printed paper;

[0018] The image correction module is used to identify the text region in the paper image, obtain the deflection angle of the text direction in the text region relative to the width direction of the pre-printed paper placement area of ​​the printing device, and rotate the paper image in reverse according to the deflection angle to obtain the correction image corresponding to the paper image.

[0019] The text information acquisition module is used to input the corrected image into a pre-built text recognition model to obtain the text content information and text position information in the corrected image;

[0020] The print position confirmation module is used to determine the pre-determined print position of the financial print information on the pre-printed paper based on the text position information and the deflection angle, when the text content information matches the text content in the pre-selected print template.

[0021] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps:

[0022] Scan the pre-printed paper placed in the printing device to obtain a paper image corresponding to the pre-printed paper;

[0023] Identify the text region in the paper image, obtain the deflection angle of the text direction in the text region relative to the width direction of the pre-printed paper placement area of ​​the printing device, and rotate the paper image in reverse according to the deflection angle to obtain the corrected image corresponding to the paper image;

[0024] The corrected image is input into a pre-built character recognition model to obtain the text content information and text position information in the corrected image;

[0025] If the text content information matches the text content in the pre-selected print template, the pre-determined print position of the financial print information on the pre-printed paper is determined based on the text position information and the deflection angle.

[0026] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, performs the following steps:

[0027] Scan the pre-printed paper placed in the printing device to obtain a paper image corresponding to the pre-printed paper;

[0028] Identify the text region in the paper image, obtain the deflection angle of the text direction in the text region relative to the width direction of the pre-printed paper placement area of ​​the printing device, and rotate the paper image in reverse according to the deflection angle to obtain the corrected image corresponding to the paper image;

[0029] The corrected image is input into a pre-built character recognition model to obtain the text content information and text position information in the corrected image;

[0030] If the text content information matches the text content in the pre-selected print template, the pre-determined print position of the financial print information on the pre-printed paper is determined based on the text position information and the deflection angle.

[0031] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, performs the following steps:

[0032] Scan the pre-printed paper placed in the printing device to obtain a paper image corresponding to the pre-printed paper;

[0033] Identify the text region in the paper image, obtain the deflection angle of the text direction in the text region relative to the width direction of the pre-printed paper placement area of ​​the printing device, and rotate the paper image in reverse according to the deflection angle to obtain the corrected image corresponding to the paper image;

[0034] The corrected image is input into a pre-built character recognition model to obtain the text content information and text position information in the corrected image;

[0035] If the text content information matches the text content in the pre-selected print template, the pre-determined print position of the financial print information on the pre-printed paper is determined based on the text position information and the deflection angle.

[0036] The aforementioned method, apparatus, computer device, storage medium, and computer program product for obtaining the print position involves scanning a pre-printed sheet placed in a printing device to obtain a paper image corresponding to the pre-printed sheet; identifying text regions in the paper image; obtaining the deflection angle of the text direction relative to the width direction of the pre-printed sheet placement area in the printing device; and rotating the paper image inversely based on the deflection angle to obtain a corrected image corresponding to the paper image; inputting the corrected image into a pre-constructed character recognition model to obtain text content information and text position information in the corrected image; and determining the pre-determined print position of the financial printing information on the pre-printed sheet based on the text position information and the deflection angle when the text content information matches the text content in a pre-selected print template. This application, through a text region recognition model, first obtains the deflection angle of the paper image, then corrects the paper image using the deflection angle to obtain a corrected image, then inputs the corrected image into a character recognition model to obtain text content information and text position information in the corrected image, and finally, accurately determines the print position of the financial printing information on the pre-printed sheet based on the text content information and text position information. Attached Figure Description

[0037] Figure 1 This is a flowchart illustrating a method for obtaining the print position in one embodiment;

[0038] Figure 2 This is a schematic diagram of the process for obtaining a text region in one embodiment;

[0039] Figure 3 This is a flowchart illustrating the process of obtaining the deflection angle in one embodiment;

[0040] Figure 4 This is a schematic diagram of the process for obtaining the second text region in one embodiment;

[0041] Figure 5This is a flowchart illustrating a method for printing bank vouchers at designated locations in one embodiment;

[0042] Figure 6 This is a structural diagram of the image recognition module in one embodiment;

[0043] Figure 7 This is a structural block diagram of a printing position acquisition device in one embodiment;

[0044] Figure 8 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0045] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0046] It should be noted that the terms "first" and "second" used in the embodiments of the present invention are merely to distinguish similar objects and do not represent a specific ordering of objects. It is understood that "first" and "second" can be interchanged in a specific order or sequence where permissible. It should be understood that the objects distinguished by "first" and "second" can be interchanged where appropriate so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein.

[0047] In one embodiment, such as Figure 1 As shown, a method for obtaining the print position is provided. This embodiment illustrates the application of this method to a terminal. It is understood that this method can also be applied to a server, and to a system including both a terminal and a server, and implemented through interaction between the terminal and the server. In this embodiment, the method includes the following steps:

[0048] Step S101: Scan the pre-printed paper placed in the printing device to obtain the paper image corresponding to the pre-printed paper.

[0049] The printing device is a printer that prints the aforementioned pre-printed paper. The printer is equipped with a scanning device for scanning the aforementioned pre-printed paper. The pre-printed paper is paper with the content of the printing template printed on it. The pre-printed paper is used to print the financial text to be printed in the blank areas. The paper image is the image obtained by the aforementioned scanning device scanning the pre-printed paper.

[0050] Specifically, the pre-printed paper is placed in a predetermined position on the printing device, and the scanning device on the printing device recognizes the pre-printed paper, scans the pre-printed paper, and obtains the paper image corresponding to the pre-printed paper.

[0051] Step S102: Identify the text region in the paper image, obtain the deflection angle of the text direction in the text region relative to the width direction of the pre-printed paper placement area of ​​the printing device, and rotate the paper image in reverse according to the deflection angle to obtain the corrected image corresponding to the paper image.

[0052] The text area refers to the area containing the text in the aforementioned paper image. This text area can be a rectangle. The text direction refers to the direction in which the text is arranged, which can be a horizontal arrangement from left to right. The pre-printed paper placement area is the rectangular area on the printing device where the pre-printed paper is placed. The aforementioned scanning device is installed directly above the pre-printed paper placement area. The width direction is the width of the pre-printed paper placement rectangle. Finally, the deflection angle is the deflection angle of the horizontal direction of the text relative to the width direction. This deflection angle is used to indicate whether the pre-printed paper is placed in the correct position and is not tilted. The calibration image is the scanned image corresponding to the pre-printed paper being placed in the correct position and not tilted.

[0053] Specifically, the text rectangular regions in the paper image are identified by the Horizontal Text Region Detection Model (CTPN) and the Tilt Text Region Detection Model (RRPN), and then the text direction of the text in the text rectangular region is obtained. The angle between the text direction and the width direction of the pre-printed paper placement area is calculated, which is the aforementioned offset angle. Based on the center of the paper image, the paper image is rotated in reverse by the aforementioned offset angle, and then the aforementioned corrected image is obtained, which is the paper image when the offset angle is zero.

[0054] Step S103: Input the corrected image into the pre-built character recognition model to obtain the text content information and text position information in the corrected image.

[0055] The text recognition model is a pre-constructed text recognition model of the aforementioned printed paper, which is composed of a text segmentation model and a text content recognition model. The text content information is the text content in the aforementioned corrected image, and the text position information is the position coordinates of the text in the aforementioned corrected image.

[0056] Specifically, the corrected image is input into a pre-built character recognition model, and the character segmentation model in the character recognition model segments the characters in the corrected image into individual character images, and obtains the position coordinates corresponding to each character image.

[0057] Step S104: If the text content information matches the text content in the pre-selected print template, determine the pre-determined print position of the financial print information on the pre-printed paper based on the text position information and the deflection angle.

[0058] The printing template is the digital template corresponding to the pre-printed paper, while the text content is the text content on the printing template. Financial printing information refers to the financial text content to be printed, such as electronic bank vouchers, which needs to be printed on the pre-printed paper. Finally, the printing location is the position where the financial printing information will be printed on the pre-printed paper. For example, if the pre-printed paper has the word "date" printed on it, the date of the banking transaction will be printed in the designated blank space next to that word.

[0059] Specifically, a template corresponding to the pre-printed paper is obtained, and the text content on the template is compared with the text content on the pre-printed paper. If they match, the pre-determined printing position of the financial printing information on the pre-printed paper is determined based on the text position information and the offset angle. If the text content does not match the text content in the pre-selected printing template, it indicates that the pre-printed paper has been selected incorrectly, printing is terminated, and the pre-printed paper needs to be replaced.

[0060] In the aforementioned method for obtaining the print position, a paper image corresponding to the pre-printed paper is obtained by scanning the pre-printed paper placed in the printing device; text regions in the paper image are identified, and the deflection angle of the text direction relative to the width direction of the pre-printed paper placement area in the printing device is obtained; the paper image is then rotated inversely according to the deflection angle to obtain a corrected image corresponding to the paper image; the corrected image is input into a pre-built character recognition model to obtain the text content information and text position information in the corrected image; if the text content information matches the text content in a pre-selected print template, the pre-determined print position of the financial printing information on the pre-printed paper is determined based on the text position information and the deflection angle. This application, through a text region recognition model, first obtains the deflection angle of the aforementioned paper image, then corrects the paper image using the deflection angle to obtain a corrected image, then inputs the corrected image into a character recognition model to obtain the text content information and text position information in the corrected image, and finally, based on the text content information and text position information, can accurately determine the print position of the financial printing information on the pre-printed paper.

[0061] In one embodiment, such as Figure 2 As shown, the text region includes a first text region and a second text region; recognizing the text region in the paper image includes the following steps:

[0062] Step S201: Input the paper image into the pre-built text region recognition model.

[0063] Among them, the text region recognition model is a pre-built model used to identify the rectangular region where the text is located in a paper image.

[0064] Specifically, the paper image is input into a pre-built text region recognition model.

[0065] Step S202: The first text region in the paper image is identified through the horizontal text recognition branch in the text region recognition model; the first text region is obtained based on the horizontal arrangement attribute of the text in the paper image.

[0066] The Horizontal Character Recognition Branch (CTPN) is a sub-model of the text region recognition model, and the Angled Character Recognition Branch (RRPN) is also a sub-model of the text region recognition model. The two branches are arranged side by side. The horizontal arrangement attribute refers to the horizontal arrangement feature of the text in the paper image, and the first text region refers to the text region recognized by the Horizontal Character Recognition Branch based on this horizontal arrangement feature.

[0067] Specifically, the paper image is input into the horizontal text recognition branch of the text region recognition model. Based on the horizontal arrangement features of the text in the paper image, the first text region in the paper image is identified through the horizontal text recognition branch.

[0068] Step S203: The second text region in the paper image is identified through the tilted text recognition branch in the text region recognition model; the second text region is obtained based on the tilted arrangement attribute of the text in the paper image.

[0069] The tilted arrangement attribute refers to the tilted arrangement feature of the text in the paper image, while the second text region refers to the text region identified by the tilted text recognition branch based on this tilted arrangement feature and the tilted text arrangement feature in the paper image. The first and second text regions are different recognition results for the same text region, and there may be some error between them.

[0070] Specifically, the paper image is input into the tilted character recognition branch of the text region recognition model, and the second text region in the paper image is identified through the tilted character recognition branch.

[0071] In this embodiment, by inputting the paper image into the two branches of the text region recognition model, the text region in the paper image can be accurately obtained based on the horizontal and slanted arrangement features of the text in the paper image.

[0072] In one embodiment, such as Figure 3 As shown, obtaining the deflection angle of the text direction in the text area relative to the width direction of the pre-printed paper placement area of ​​the printing device includes the following steps:

[0073] Step S301: Based on the first text region, obtain the first deflection angle of the text direction in the first text region relative to the width direction of the pre-printed paper placement area of ​​the printing device.

[0074] The first deflection angle is the deflection angle calculated based on the first text area mentioned above.

[0075] Specifically, the angle between the left-to-right arrangement direction of the characters in the first text area and the width direction of the pre-printed paper placement area is calculated, which is the first deflection angle.

[0076] Step S302: Based on the second text region, obtain the second deflection angle of the text direction in the second text region relative to the width direction of the pre-printed paper placement area of ​​the printing device.

[0077] The second deflection angle is calculated based on the second text region mentioned above.

[0078] Specifically, the angle between the left-to-right arrangement direction of the text in the second text area and the width direction of the pre-printed paper placement area is calculated, which is the second deflection angle.

[0079] Step S303: Obtain the deflection angle according to the preset weights corresponding to the first deflection angle, the second deflection angle, and the first deflection angle and the second deflection angle respectively.

[0080] The preset weights are the calculation ratios corresponding to the first deflection angle and the second deflection angle, respectively, when calculating the deflection angle.

[0081] Specifically, based on the preset weights corresponding to the first deflection angle and the second deflection angle, a weighted average is calculated to obtain the deflection angle.

[0082] In this embodiment, the aforementioned deflection angle can be accurately calculated by using the preset weights corresponding to the first deflection angle, the second deflection angle, and the first deflection angle and the second deflection angle, respectively.

[0083] In one embodiment, such as Figure 4 As shown, the second text region in the paper image is identified through the tilted text recognition branch of the text region recognition model, including the following steps:

[0084] Step S401: Obtain a detection box for determining the second text region, and use a preset point on the boundary of the detection box as the rotation center of the detection box.

[0085] In this context, the detection box is the bounding box in the Recognition of Tilted Characters (RRPN) branch, and the boundary of the detection box is the border of the rectangular detection box. The preset point can be the lower left corner of the detection box, and the rotation center is the anchor point in the Recognition of Tilted Characters (RRPN) branch.

[0086] Specifically, a rectangular detection box is obtained to determine the second text region, and the lower left corner of the rectangular detection box (instead of the geometric center of the rectangular detection box) is used as the rotation center of the detection box, i.e., the anchor point.

[0087] Step S402: Determine the rotation angle range of the detection frame, and identify the second text region in the paper image by using the tilted text recognition branch, rotation center and rotation angle range.

[0088] The rotation angle range refers to the range of angles within which the detection frame rotates based on the rotation center.

[0089] Specifically, the anchor point (rotation center) in the tilted character recognition branch (RRPN model) is changed from the geometric center of the detection box to the lower left corner of the detection box, and the rotation angle range of the detection box is reduced to a preset value. After that, the tilted character recognition branch is trained, and the second text region in the paper image is identified through the trained tilted character recognition branch.

[0090] In this embodiment, by modifying the anchor point (rotation center) in the tilted character recognition branch (RRPN model) from the geometric center of the detection box to the lower left corner of the detection box, and reducing the rotation angle range of the detection box to a preset value, the tilted character recognition branch is trained. Through the trained tilted character recognition branch, the second text region in the paper image can be recognized more accurately.

[0091] In one embodiment, the text recognition model includes a text segmentation layer, a text feature extraction layer, and a text feature translation layer; inputting a corrected image into the pre-built text recognition model to obtain text content information and text location information in the corrected image includes the following steps:

[0092] The corrected image is input into the text segmentation layer to obtain the text images corresponding to each character in the corrected image, as well as the text position information in the corrected image; each text image is input into the text feature extraction layer to obtain the text features corresponding to each character in the corrected image; the text features are input into the text feature translation layer to obtain the text content information in the corrected image.

[0093] The character segmentation layer (CFS) is a sub-model in the character recognition model used to segment each character image, while the character feature extraction layer (CNN) is a sub-model in the character recognition model used to extract features from each character image. The character feature translation layer (CTC) is a sub-model in the character recognition model used to finally recognize the text content.

[0094] Specifically, the corrected image is input into the text segmentation layer to obtain the text images corresponding to each character in the corrected image, as well as the text position information in the corrected image. Then, each text image is input into the text feature extraction layer to obtain the text features corresponding to each character in the corrected image. Finally, the text features are input into the text feature translation layer to obtain the text content information in the corrected image.

[0095] In this embodiment, the text segmentation layer, text feature extraction layer, and text feature translation layer in the text recognition model can accurately obtain the text content information in the corrected image.

[0096] In one embodiment, determining the pre-determined printing position of financial printing information on pre-printed paper based on text location information and deflection angle includes the following steps:

[0097] Based on the text position information, the initial printing position of the financial printing information on the calibrated image is obtained; according to the deflection angle, the initial printing position is corrected to obtain the printing position of the financial printing information on the pre-printed paper.

[0098] The initial print position is the print position of the financial print information on the corrected image.

[0099] Specifically, based on the text position information, the initial printing position of the financial printing information on the calibration image is obtained. Then, based on the aforementioned deflection angle, the initial printing position is modified to obtain the printing position of the financial printing information on the paper image, which is also the printing position of the financial printing information on the pre-printed paper.

[0100] In this embodiment, the initial printing position of the financial printing information on the correction image is obtained based on the text position information. Then, the initial printing position is corrected according to the deflection angle, so that the printing position of the financial printing information on the pre-printed paper can be accurately obtained.

[0101] In one embodiment, after determining the pre-determined printing position of the financial printing information on the pre-printed paper based on the text position information and the deflection angle, the method further includes the following steps:

[0102] Based on the printing position, the financial printing information is printed onto the pre-printed paper to obtain the printed paper; based on the page number information of the printed paper and all the page number information corresponding to the printing template, the page number information of the unprinted paper is determined; the page number information of the printed paper is obtained from the text content information of the printed paper; the page number information of the unprinted paper is displayed on the display terminal corresponding to the printing device to instruct the printing user to place the unprinted paper corresponding to the page number information of the unprinted paper into the printing device to continue printing.

[0103] The "printed paper" refers to the printed sheets of paper, while the "page number information" refers to the page numbers of the printed sheets. The "all page number information" refers to all page numbers of the print template, where each print template corresponds to one or more pre-printed sheets. The "display terminal" is a monitor installed on the aforementioned printing equipment, and the "unprinted paper" refers to the unprinted sheets among the multiple pre-printed sheets corresponding to the print template.

[0104] Specifically, based on the printing location, the financial printing information is printed onto the blank space of the pre-printed paper to obtain the printed paper. The page number information of the printed paper is obtained from the text content information of the printed paper, and the page number information of the unprinted paper is obtained. This information is then displayed on the monitor. After the printing user sees the page number information of the unprinted paper, they place the unprinted paper into the printing device to continue printing.

[0105] In this embodiment, by obtaining the page number information of the printed paper from the text content information of the printed paper, the page number information of the unprinted paper can be obtained, ensuring that no financial printing information to be printed is missed.

[0106] In one application embodiment, such as Figure 5 As shown, this application provides a method for fixed-point printing of bank vouchers, including: when staff perform fixed-point printing, they need to select a template and input pre-printing information. After inputting the information, they insert the pre-printing paper and wait for the device to scan and analyze it. The printing information returned by the device is checked against the text verification result of the pre-printing paper, and printing is confirmed. After confirmation, the printing device will perform fixed-point printing on the pre-printing paper, return the page numbers of the unprinted pages in the template, and wait for the next pre-printing paper to be inserted or for manual selection to end the printing. This technical solution effectively solves the problems of traditional fixed-point printing of bank vouchers, such as easy printing misalignment, the need for manual confirmation of the printing quantity and page numbers, and the need for manual checking of pre-printed document information. Specifically, it includes the following steps:

[0107] Before scheduled printing, users need to select a template and input the required information via computer. The computer will then read all information from the selected template, including the text, the number of sheets, and page numbers. The user places the paper into the printing equipment, which scans the paper and inputs the scanned data into the text detection module. This module identifies the text rectangle and calculates the offset angle. After the angle calculation, the scanned image is rotated inversely to obtain a horizontal image, which is then input into the text recognition module. This module segments and identifies the text within the image, locating the coordinates for scheduled printing. The printing equipment then uses the recognized text to obtain the page numbers, analyzes the information from the template, and displays the unprinted pages. Simultaneously, the printing equipment compares the recognized text with the text information corresponding to the page numbers in the template to analyze for any errors in the pre-printed document. After verification, the printing coordinates are recalculated based on the obtained offset angle and fixed-point coordinates, input into the printer, and a prompt is displayed asking the staff whether to print. After the staff confirms, the pre-printed document is printed at the fixed point. After printing is completed, the unprinted page numbers in the template are displayed.

[0108] like Figure 6 As shown, the image recognition module in this invention is mainly divided into a text detection module and a text recognition module. The text detection module is responsible for detecting text in the scanned image information and dividing the text areas within the image information into rectangular regions. The text recognition module is responsible for recognizing text in the image after angle correction and calculating the coordinates and text information of the printing position as required for processing by subsequent functional modules.

[0109] Text Detection Module: The text detection module is primarily responsible for segmenting text regions within an image. The printing device scans the inserted paper and sends the scanned image to the text detection module. The system then crops the image to fit the model input size and sends the cropped image to both the CTPN and RRPN models. Each model calculates and outputs a set of coordinates for the two text regions. These coordinate sets form a rectangle on the image. By calculating the coordinates of the four corners, the horizontal deflection angle of the text can be obtained, representing the possible rotation of the paper during printing or errors in pre-printing. A single model's calculation may contain significant errors. By independently calculating with both models and integrating their results, a more accurate result can be obtained. Therefore, a weighted average of the angles calculated by the two models, based on their accuracy, yields a more accurate deflection angle. Using this angle, the scanned image is rotated inversely to obtain a horizontally aligned pre-printed paper image.

[0110] The RRPN model is a scene text detection method based on candidate regions. This model proposes using anchors with rotation angles to generate angled candidate regions, and then calculates the intersection of these candidate regions with the real text regions to obtain the model result. Traditional RPN model anchors are rectangles parallel to the coordinate axes, while the RRPN model adds angle information to the anchor information of the traditional RPN model; this anchor is called an R-Anchor. An R-Anchor consists of five elements, where (x, y) represents the geometric center of the bounding box, (w, h) represents the length and width of the bounding box, and θ represents the rotation angle of the anchor, i.e., the rotation angle of the candidate region. In the model, θ+kΠ controls the range from (-1 / 4Π to 3 / 4Π). In real-world scenarios, since the rotation angle of the paper is not very large, and the text is long and narrow, this invention proposes two optimization ideas for the RRPN model based on these characteristics:

[0111] The original anchor point coordinates were replaced from the geometric center of the bounding box to the coordinates of the top-left corner of the box. After the replacement, the overlap between the rotated candidate region and the real text region increased, which improved the regression speed of the network during training, greatly reduced the number of network iterations, and reduced the model training time by 15%.

[0112] The rotation angle range is narrowed. In reality, the paper being inserted often only rotates slightly, while existing models have a relatively large rotation angle range. Most of the candidate regions generated by these rotations have very low overlap with the actual text regions, leading to angles being discarded. By narrowing the angle range, the model better reflects the small-angle rotations in real-world scenarios, increasing the overlap between the generated rotation candidate regions and the actual text regions. This results in more effective candidate regions and improves the model's training efficiency. Furthermore, calculating the intersection of multiple effective candidate regions improves model accuracy, resulting in a 5% increase in recognition accuracy when the model is subsequently applied to actual text region detection.

[0113] Text Recognition Module: This module is primarily responsible for recognizing text in scanned images. Unlike the text detection module, it converts images into text by inversely rotating them to obtain a horizontally aligned image, which is then fed into the text recognition module. The module first performs character segmentation on the input text image. Using the CFS segmentation algorithm, it divides the image into individual characters and then recognizes each character. Previous text recognition modules could only recognize text information within images; by incorporating the CFS segmentation algorithm, the system can now determine the position of each character. When special strings near a fixed print location, such as "Account:", "Name:", "Date:", and their coordinates, are obtained, the system can accurately calculate the print location coordinates. Simultaneously, the recognized text is stored on the computer and can be used as a source of information for subsequent text verification and page number retrieval.

[0114] CRNN Model Optimization: CRNN is a commonly used text recognition model. Its main components are CNN (Convolutional Neural Network), RNN (Recurrent Neural Network), and CTC (Translation Layer). Based on the text features of pre-printed paper in practical situations, an optimization method is provided:

[0115] The recurrent neural network used in the CRNN model is an LSTM (Long Short-Term Memory) neural network. This network can combine forward and backward information from an unknown character image to determine the text characters in the image. However, since the text in the pre-printed text is not widespread, belonging to a relatively simple scenario, strong temporal information is not actually needed. Considering the business scenario, removing the RNN and shrinking the overall model to consist of a CNN (Convolutional Neural Network) and a CTC (Translation Transformation Layer) ensures faster training and network convergence while maintaining accuracy. Furthermore, in actual recognition, due to the smaller model network structure and fewer parameters, the recognition speed is greatly improved, reducing recognition time by 2 seconds compared to the original model, and reducing the image processing time by 30%.

[0116] After confirming the business with the customer, the staff selects the template to be printed on the designated voucher printing equipment and enters the corresponding information as required. At this time, the system checks whether the information entered by the staff matches and reads the information of the corresponding template, including the number of sheets to be printed, the page numbers, and the text information of the template. When the staff puts in the first pre-printed sheet, the equipment scans the paper and transmits the image to the text detection module.

[0117] The text detection module's CTPN and RRPN models independently divide the text in the scanned image into regions, calculate the deflection angles of the two texts, obtain a more accurate deflection angle through a weighted average, save it in the computer, and automatically perform reverse rotation of the image according to the deflection angle to obtain a horizontally aligned text image, which is then input into the text recognition module.

[0118] The text recognition module first segments the image, using the CFS segmentation algorithm to divide the entire text image into individual text images and saving the coordinates of each text image. Then, the CRNN algorithm identifies the characters in each text image. By matching specific strings, the coordinates of the fixed-point printing location can be obtained. In addition, the recognized text information is checked against the text information in the template, eliminating the need for manual verification of existing information. Finally, the number of pages in the pre-printed document is determined based on the recognized text and matched against the template information. The number and quantity of unprinted pages are counted and displayed on the computer.

[0119] Once the staff has verified the above analysis results and confirmed the printing, the computer will perform reverse calculations based on the stored fixed-point printing coordinates and deflection angles to obtain the actual printing coordinates and transmit them to the printing device for printing. After printing is completed, the unprinted pages of the template will be returned, waiting for the next pre-printed sheet to be inserted. The entire printing process will be closed when all pages to be printed have been detected and printed, or when the staff chooses to end the process.

[0120] In this embodiment, the rotation angle of the paper is calculated by an improved CTPN network and an improved RRPN network, and the text recognition is performed by an improved CRNN network. This enables the recalculation of the fixed-point printing coordinates, so that the input information can be printed to the correct position without readjusting the paper.

[0121] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0122] Based on the same inventive concept, this application also provides a print position acquisition device for implementing the print position acquisition method described above. The solution provided by this device is similar to the solution described in the above method; therefore, the specific limitations in one or more print position acquisition device embodiments provided below can be found in the limitations of the print position acquisition method described above, and will not be repeated here.

[0123] In one embodiment, such as Figure 7 As shown, a print position acquisition device is provided, including: a paper image acquisition module 701, a correction image acquisition module 702, a text information acquisition module 703, and a print position confirmation module 704, wherein:

[0124] The paper image acquisition module 701 is used to scan the pre-printed paper placed in the printing device to obtain the paper image corresponding to the pre-printed paper.

[0125] The correction image acquisition module 702 is used to identify the text area in the paper image, obtain the deflection angle of the text direction in the text area relative to the width direction of the pre-printed paper placement area of ​​the printing device, and rotate the paper image in reverse according to the deflection angle to obtain the correction image corresponding to the paper image.

[0126] The text information acquisition module 703 is used to input the corrected image into a pre-built text recognition model to obtain the text content information and text position information in the corrected image;

[0127] The print position confirmation module 704 is used to determine the print position of the pre-determined financial print information on the pre-printed paper based on the text position information and the deflection angle, when the text content information matches the text content in the pre-selected print template.

[0128] In one embodiment, the image acquisition module 702 is further configured to input the paper image into a pre-constructed text region recognition model; identify a first text region in the paper image through the horizontal text recognition branch in the text region recognition model; the first text region is obtained based on the horizontal arrangement attribute of the text in the paper image; identify a second text region in the paper image through the oblique text recognition branch in the text region recognition model; the second text region is obtained based on the oblique arrangement attribute of the text in the paper image.

[0129] In one embodiment, the image correction module 702 is further configured to obtain a first deflection angle of the text direction in the first text region relative to the width direction of the pre-printed paper placement area of ​​the printing device based on the first text region; obtain a second deflection angle of the text direction in the second text region relative to the width direction of the pre-printed paper placement area of ​​the printing device based on the second text region; and obtain the deflection angle according to the preset weights corresponding to the first deflection angle, the second deflection angle, and the first deflection angle and the second deflection angle respectively.

[0130] In one embodiment, the image acquisition module 702 is further configured to acquire a detection box for determining the second text region, and use a preset point on the boundary of the detection box as the rotation center of the detection box; determine the rotation angle range of the detection box, and identify the second text region in the paper image by using the tilted text recognition branch, the rotation center and the rotation angle range.

[0131] In one embodiment, the text information acquisition module 703 is further configured to input the correction image into the text segmentation layer to obtain the text images corresponding to each character in the correction image, as well as the text position information in the correction image; input each text image into the text feature extraction layer to obtain the text features corresponding to each character in the correction image; and input the text features into the text feature translation layer to obtain the text content information in the correction image.

[0132] In one embodiment, the print position confirmation module 704 is further configured to obtain the initial print position of the financial print information on the correction image based on the text position information; and to correct the initial print position according to the deflection angle to obtain the print position of the financial print information on the pre-printed paper.

[0133] In one embodiment, the print position confirmation module 704 is further configured to print financial printing information onto pre-printed paper based on the print position to obtain printed paper; determine the page number information of unprinted paper based on the page number information of the printed paper and all page number information corresponding to the print template; obtain the page number information of the printed paper from the text content information of the printed paper; and display the page number information of unprinted paper on the display terminal corresponding to the printing device to instruct the printing user to place the unprinted paper corresponding to the page number information of the unprinted paper into the printing device to continue printing.

[0134] Each module in the aforementioned print position acquisition device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0135] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 8 As shown, the computer device includes a processor, memory, communication interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When executed by the processor, the computer program implements a method for obtaining print position. The display screen can be an LCD screen or an e-ink display screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the computer device casing, or an external keyboard, touchpad, or mouse.

[0136] Those skilled in the art will understand that Figure 8 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0137] In one embodiment, a computer device is provided, including a printer, a display, a memory, and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:

[0138] Scan the pre-printed paper placed in the printing device to obtain the paper image corresponding to the pre-printed paper; identify the text area in the paper image, obtain the deflection angle of the text direction in the text area relative to the width direction of the pre-printed paper placement area of ​​the printing device, and rotate the paper image in reverse according to the deflection angle to obtain the corrected image corresponding to the paper image.

[0139] The corrected image is input into a pre-built character recognition model to obtain the text content information and text location information in the corrected image;

[0140] When the text content matches the text content in the pre-selected print template, the pre-determined print position of the financial print information on the pre-printed paper is determined based on the text position information and the deflection angle.

[0141] In one embodiment, when the processor executes the computer program, it further performs the following steps: inputting a paper image into a pre-built text region recognition model; identifying a first text region in the paper image through a horizontal text recognition branch in the text region recognition model; the first text region is obtained based on the horizontal arrangement attribute of the text in the paper image; identifying a second text region in the paper image through a tilted text recognition branch in the text region recognition model; the second text region is obtained based on the tilted arrangement attribute of the text in the paper image.

[0142] In one embodiment, when the processor executes the computer program, it further implements the following steps: based on the first text region, obtaining a first deflection angle of the text direction in the first text region relative to the width direction of the pre-printed paper placement area of ​​the printing device; based on the second text region, obtaining a second deflection angle of the text direction in the second text region relative to the width direction of the pre-printed paper placement area of ​​the printing device; and obtaining the deflection angle according to the preset weights corresponding to the first deflection angle, the second deflection angle, and the first deflection angle and the second deflection angle, respectively.

[0143] In one embodiment, when the processor executes the computer program, it further implements the following steps: obtaining a detection box for determining the second text region, and using a preset point on the boundary of the detection box as the rotation center of the detection box; determining the rotation angle range of the detection box, and identifying the second text region in the paper image by using the tilted text recognition branch, the rotation center, and the rotation angle range.

[0144] In one embodiment, when the processor executes the computer program, it further performs the following steps: inputting the corrected image into the text segmentation layer to obtain text images corresponding to each character in the corrected image, and text position information in the corrected image; inputting each text image into the text feature extraction layer to obtain text features corresponding to each character in the corrected image; and inputting the text features into the text feature translation layer to obtain text content information in the corrected image.

[0145] In one embodiment, when the processor executes the computer program, it further performs the following steps: obtaining the initial printing position of the financial printing information on the calibrated image based on the text position information; and correcting the initial printing position according to the deflection angle to obtain the printing position of the financial printing information on the pre-printed paper.

[0146] In one embodiment, when the processor executes the computer program, it further performs the following steps: printing financial printing information onto pre-printed paper based on the printing position to obtain printed paper; determining the page number information of unprinted paper based on the page number information of the printed paper and all page number information corresponding to the printing template; obtaining the page number information of the printed paper from the text content information of the printed paper; and displaying the page number information of unprinted paper on the display terminal corresponding to the printing device to instruct the printing user to place the unprinted paper corresponding to the page number information of the unprinted paper into the printing device to continue printing.

[0147] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.

[0148] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0149] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.

[0150] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0151] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0152] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A method for obtaining a printing position, characterized in that, The method includes: Scan the pre-printed paper placed in the printing device to obtain a paper image corresponding to the pre-printed paper; The paper image is input into a pre-constructed text region recognition model; the first text region in the paper image is identified through the horizontal text recognition branch in the text region recognition model; the first text region is obtained based on the horizontal arrangement attribute of the text in the paper image; a detection box is obtained to determine the second text region, and a preset point on the boundary of the detection box is used as the rotation center of the detection box; the rotation angle range of the detection box is determined, and the second text region in the paper image is identified through the tilted text recognition branch, the rotation center, and the rotation angle range; the second text region is obtained based on the tilted arrangement attribute of the text in the paper image. Based on the first text region, a first deflection angle is obtained relative to the width direction of the pre-printed paper placement area of ​​the printing device; based on the second text region, a second deflection angle is obtained relative to the width direction of the pre-printed paper placement area of ​​the printing device; according to the preset weights corresponding to the first deflection angle, the second deflection angle, the first deflection angle, and the second deflection angle, the deflection angle of the text region relative to the width direction of the pre-printed paper placement area of ​​the printing device is obtained; and the paper image is rotated in reverse according to the deflection angle to obtain a horizontally aligned correction image, wherein the deflection angle is used to characterize the physical placement posture of the pre-printed paper; The corrected image is input into a pre-built character recognition model to obtain the text content information and text position information in the corrected image; If the text content information matches the text content in the pre-selected print template, the initial print position of the financial print information on the correction image is obtained based on the text position information; and a coordinate inverse transformation is performed based on the initial print position and the deflection angle to obtain the print position of the financial print information on the pre-printed paper.

2. The method according to claim 1, characterized in that, The text recognition model includes a text segmentation layer, a text feature extraction layer, and a text feature translation layer; The step of inputting the corrected image into a pre-built character recognition model to obtain the text content information and text position information in the corrected image includes: The corrected image is input into the text segmentation layer to obtain the text image corresponding to each character in the corrected image, as well as the text position information in the corrected image; Each text image is input into the text feature extraction layer to obtain the text features corresponding to each character in the corrected image; The text features are input into the text feature translation layer to obtain the text content information in the corrected image.

3. The method according to any one of claims 1-2, characterized in that, After determining the pre-determined printing position of the financial printing information on the pre-printed paper based on the text position information and the deflection angle, the method further includes: Based on the printing position, the financial printing information is printed onto the pre-printed paper to obtain the printed paper; Based on the page number information of the printed paper and all page number information corresponding to the printing template, the page number information of the unprinted paper is determined; the page number information of the printed paper is obtained from the text content information of the printed paper. The display terminal corresponding to the printing device shows the page number information of the unprinted paper, so as to instruct the printing user to place the unprinted paper corresponding to the page number information of the unprinted paper into the printing device to continue printing.

4. A printing position acquisition device, characterized in that, The device includes: The paper image acquisition module is used to scan the pre-printed paper placed in the printing device to obtain the paper image corresponding to the pre-printed paper; A calibration image acquisition module is used to input the paper image into a pre-constructed text region recognition model; identify a first text region in the paper image through the horizontal text recognition branch in the text region recognition model; the first text region is obtained based on the horizontal arrangement attribute of the text in the paper image; acquire a detection box for determining a second text region, and use a preset point on the boundary of the detection box as the rotation center of the detection box; determine the rotation angle range of the detection box, and identify the second text region in the paper image through the tilted text recognition branch, the rotation center, and the rotation angle range; the second text region is obtained based on the tilted arrangement attribute of the text in the paper image; based on the first text region, obtain the... The text direction in the first text region is deflected by a first angle relative to the width direction of the pre-printed paper placement area of ​​the printing device; based on the second text region, a second angle of deflection of the text direction in the second text region relative to the width direction of the pre-printed paper placement area of ​​the printing device is obtained; according to the preset weights corresponding to the first angle, the second angle, the first angle, and the second angle, the deflection angle of the text direction in the text region relative to the width direction of the pre-printed paper placement area of ​​the printing device is obtained; and the paper image is rotated in reverse according to the deflection angle to obtain a horizontally aligned correction image, wherein the deflection angle is used to characterize the physical placement posture of the pre-printed paper; The text information acquisition module is used to input the corrected image into a pre-built text recognition model to obtain the text content information and text position information in the corrected image; The print position confirmation module is used to obtain the initial print position of the financial print information on the calibration image based on the text position information when the text content information matches the text content in the pre-selected print template; and to perform an inverse coordinate transformation based on the initial print position and the deflection angle to obtain the print position of the financial print information on the pre-printed paper.

5. A printing device, comprising a printer, a display, a memory, and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 3.

6. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 3.

7. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 3.