Stamping position determination method and device, equipment, storage medium and program product
By obtaining and correcting the center coordinates and radius of the body to be stamped in the electronic bidding, the problem of overlapping seal positions is solved, and the accuracy of seal positions and the standardization of electronic bidding are achieved.
Patent Information
- Application Number
- CN202510422422.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-03
- Publication Date
- 2025-08-01
AI Technical Summary
In the prior art, the accuracy of determining the seal position of electronic bids is low, especially when faced with multiple categories of text, pictures and tables that require stamping, there may be a problem of overlapping seal areas.
By obtaining the first seal center coordinates of the body to be stamped in the target electronic bid, the seal area is determined based on the radius and center coordinates of the body. If there is overlap, the preset distance is used to correct the center coordinates of the seal area to ensure that the seal area does not intersect or tangent, and the seal position is accurately positioned using text, pictures and table detection models.
It effectively avoids conflicts between stamping areas, improves the accuracy of stamping location and the readability of electronic bids, and ensures the standardization and completeness of the stamping process.
Smart Images

Figure CN120411206A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of electronic signature, and in particular, to a method, apparatus, device, storage medium, and program product for determining the stamping position. Background Art
[0002] In the bidding process, bids are submitted in the form of electronic documents, and electronic tender documents need to be stamped to ensure the integrity and solemnity of the tender documents, as well as to ensure the standardization and fairness of the tender activities.
[0003] In the prior art, automatic stamping determines the stamping position by identifying keywords in the document, such as words related to stamping, such as "enterprise name" and "seal with official seal", and then stamps according to the stamping position.
[0004] However, in the prior art, there is a problem of low accuracy in determining the stamping position. Summary of the Invention
[0005] Embodiments of this application provide a method, apparatus, device, storage medium, and program product for determining the stamping position, so as to solve the problem of low accuracy in determining the stamping position.
[0006] In a first aspect, embodiments of this application provide a method for determining the stamping position, including:
[0007] Obtain the first stamping center coordinates of the target electronic tender document for at least two stamping bodies to be stamped;
[0008] According to the radius of each stamping body to be stamped and the first stamping center coordinates, determine the stamping area corresponding to each stamping body to be stamped;
[0009] If there are any two stamping areas that intersect or are tangent, then according to a preset distance, the first stamping center coordinates corresponding to any two stamping areas, and the radius of the stamping body to be stamped, correct the first stamping center coordinates corresponding to any two stamping areas to determine the new first stamping center coordinates;
[0010] If there are no any two stamping areas that intersect or are tangent, then determine the first stamping center coordinates of each stamping body to be stamped as the target stamping center coordinates.
[0011] In a possible implementation manner, if there are any two stamping areas that intersect or are tangent, then according to a preset distance, the first stamping center coordinates corresponding to any two stamping areas, and the radius of the stamping body to be stamped, determine the moving direction and moving distance of each stamping area in any two stamping areas;
[0012] For each of any two stamped areas, move it according to the corresponding moving direction and moving distance, and determine the center coordinates of the moved stamped area as the new first stamped center coordinates.
[0013] In a possible implementation, if any two stamped areas intersect or are tangent, then according to the formula Calculate the moving direction of the first stamped area in any two stamped areas;
[0014] Take The opposite direction of is determined as the moving direction of the second stamped area in any two stamped areas;
[0015] According to the formula Δd = (r1 + r2 + d safe ) - d bc , calculate the moving distance of each of any two stamped areas;
[0016] Where, Δd is used to represent the moving distance, r1 is used to represent the radius of the seal body to be stamped corresponding to the first stamped area, (x b , y b ) is the first stamped center coordinates of the first stamped area, r2 is used to represent the radius of the seal body to be stamped corresponding to the second stamped area, (x c , y c ) is the first stamped center coordinates of the second stamped area, d safe is used to represent the preset distance, and d bc is used to represent the center distance between the first stamped area and the second stamped area.
[0017] In a possible implementation, obtain the second stamped center coordinates of the target electronic tender for each seal body to be stamped;
[0018] For the second stamped center coordinates of each seal body to be stamped, determine whether the third stamped area corresponding to the second stamped center coordinates is within the page of the target electronic tender according to the second stamped center coordinates, the radius of the seal body to be stamped, and the page size of the target electronic tender;
[0019] If the third stamped area is not completely within the page of the target electronic tender, then correct the second stamped center coordinates according to the preset distance to determine the first stamped center coordinates of the seal body to be stamped.
[0020] In a possible implementation, if the third stamped area is not completely within the page of the target electronic tender, then determine the target boundary line exceeded by the third stamped area in the target electronic tender;
[0021] Control the third stamped area to move away from the target boundary line according to the preset distance;
[0022] Determine the coordinates of the center of the first seal according to the third seal area after movement.
[0023] In a possible implementation, the target electronic tender is input into the automatic sealing system to obtain the coordinates of the center of the second seal for each seal body to be sealed output by the automatic sealing system. The automatic sealing system includes different types of detection models. The detection model is used to detect the content of the corresponding type in the target electronic tender to determine the coordinates of the center of the second seal for each seal body to be sealed. The detection model includes at least one of the following: a text detection model, a picture detection model, and a table detection model.
[0024] In a second aspect, an embodiment of the present application provides a device for determining the seal position, including:
[0025] An acquisition module, configured to acquire the coordinates of the center of the first seal for at least two seal bodies to be sealed in the target electronic tender;
[0026] A first determination module, configured to determine the seal area corresponding to each seal body to be sealed according to the radius of each seal body to be sealed and the coordinates of the center of the first seal;
[0027] A second determination module, configured to, if any two seal areas intersect or are tangent, correct the coordinates of the center of the first seal corresponding to any two seal areas according to a preset distance, the coordinates of the center of the first seal corresponding to any two seal areas, and the radius of the seal body to be sealed, and determine the new coordinates of the center of the first seal;
[0028] A third determination module, configured to, if there is no intersection or tangency between any two seal areas, determine the coordinates of the center of the first seal of each seal body to be sealed as the coordinates of the target seal center.
[0029] In a third aspect, an embodiment of the present application provides an electronic device, including: a memory, a processor;
[0030] The memory stores computer-executable instructions;
[0031] The processor executes the computer-executable instructions stored in the memory, so that the processor executes the above first aspect and / or various possible implementation manners of the first aspect.
[0032] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored, and when the computer-executable instructions are executed by a processor, they are used to implement the above first aspect and / or various possible implementation manners of the first aspect.
[0033] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, and when the computer program is executed by a processor, it implements the above first aspect and / or various possible implementation manners of the first aspect.
[0034] A method, apparatus, device, storage medium, and program product for determining a stamping position provided by an embodiment of the present application obtain first stamping center coordinates of a target electronic tender for at least two stamping bodies to be stamped; determine a stamping area corresponding to each stamping body to be stamped according to the radius of each stamping body to be stamped and the first stamping center coordinates; if there are any two stamping areas that intersect or are tangent, then according to a preset distance, the first stamping center coordinates corresponding to any two stamping areas, and the radius of the stamping body to be stamped, correct the first stamping center coordinates corresponding to any two stamping areas to determine new first stamping center coordinates; if there are no any two stamping areas that intersect or are tangent, then determine the first stamping center coordinates of each stamping body to be stamped as the target stamping center coordinates. Thereby, the situation of overlapping areas corresponding to the stamping positions is checked and corrected, and the problem of low accuracy in determining the stamping position is solved. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] The accompanying drawings herein are incorporated into the specification and constitute a part of this specification, showing embodiments consistent with the present application, and are used together with the specification to explain the principles of the present application.
[0036] Figure 1 A flowchart showing a method for determining a stamping position provided by an embodiment of the present application Figure 1 ;
[0037] Figure 2 A flowchart showing a method for determining a stamping position provided by an embodiment of the present application Figure 2 ;
[0038] Figure 3 A flowchart showing a method for determining a stamping position provided by an embodiment of the present application Figure 3 ;
[0039] Figure 4 A flowchart showing a method for determining a stamping position provided by an embodiment of the present application Figure 4 ;
[0040] Figure 5 A coordinate schematic diagram of an electronic tender provided by an embodiment of the present application;
[0041] Figure 6 A structural schematic diagram of a device for determining a stamping position provided by an embodiment of the present application;
[0042] Figure 7 A structural schematic diagram of an electronic device provided by an embodiment of the present application.
[0043] Through the above-mentioned accompanying drawings, specific embodiments of the present application have been shown, and will be described in more detail hereinafter. These drawings and the written description are not intended to limit the scope of the concept of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by reference to specific embodiments. Detailed Description of the Embodiments
[0044] Exemplary embodiments will be described in detail herein, and examples thereof are shown in the accompanying drawings. When the following description refers to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0045] First, the terms related to the present application are explained:
[0046] Automatic stamping system: It refers to an automated tool implemented through computer software or hardware devices, used to automatically generate and place electronic seals or signatures on electronic documents such as electronic tender documents, contracts, reports, etc. Based on advanced deep learning and image processing technologies, it can automatically complete the selection, adjustment, and application of the stamping position, ensuring that the stamping process is efficient, accurate, and compliant with regulations.
[0047] In the bidding and tendering activities, it is usually involved to submit bids in the form of electronic documents. In order to ensure the standardization of electronic tender documents, it is necessary to stamp the electronic bids. With the development of technologies such as image processing, the automatic stamping system has emerged. By identifying the keywords related to stamping in the electronic tender documents, the stamping position is determined for stamping, which speeds up the stamping speed and efficiency.
[0048] However, in the existing technologies, in the face of multiple types of areas that need to be stamped, such as text, pictures, and tables, there is a possibility of overlapping stamping areas. At this time, in the automatic stamping system, the identification of the stamping position only relies on identifying keywords for stamping, ignoring the processing of overlapping areas, which will lead to a decrease in the readability of the electronic tender documents after stamping. Thus, in the existing technologies, there is a problem of low accuracy in determining the stamping position.
[0049] In response to this, for the case of stamping a circular seal body on an electronic tender document, the inventor proposes that the stamping area can be delineated by using the radius of the seal body and the identified stamping center coordinates, so that for the circular stamping area, the geometric principle of determining the distance between two circles using the center coordinates can be utilized to determine whether the stamping areas are tangent or intersecting, in order to find the overlapping stamping areas. For the overlapping stamping areas, by using the radius of the seal body and the center coordinates corresponding to the stamping area, a solution for how to move the stamping area to avoid overlap is searched for, so as to correct the center coordinates corresponding to the seal body area until there is no tangency or intersection in the stamping area, thus solving the problem of low accuracy in determining the stamping position.
[0050] The following uses specific embodiments to elaborate in detail on the technical solution of this application and how the technical solution of this application solves the above technical problems. These several specific embodiments below can be combined with each other, and for the same or similar concepts or processes, they may not be repeated in some embodiments. The embodiments of this application will be described below in conjunction with the accompanying drawings.
[0051] Figure 1 Flow schematic of a method for determining stamping position provided by an embodiment of this application Figure 1 , as Figure 1 shown, this method includes:
[0052] S101. Obtain the first stamping center coordinates of the target electronic tender document for at least two seal bodies to be stamped.
[0053] Among them, the target electronic tender document may refer to an electronic tender file that needs to be stamped. The electronic tender file may contain text prompting stamping, such as "Bidder Name (Official Seal)", or "Supplier Name (Official Seal)"; the file may also contain forms that need to be stamped, such as approval columns, confirmation columns, etc.
[0054] The seal body to be stamped may refer to an electronic seal or signature that needs to be affixed to the target electronic tender document. Each seal body to be stamped has its specific position and size. In the embodiments of this application, a circular seal body is defined by its radius. Since it is necessary to detect whether there is overlap in different stamping areas, the first stamping center coordinates of at least two seal bodies to be stamped are required.
[0055] The first stamping center coordinates may refer to the specific position of the center point of each seal body to be stamped in the document page coordinate system. This coordinate is usually represented in the form of (x, y). In the embodiments of this application, with the upper left vertex of the page as the origin, a plane rectangular coordinate system is established. In this coordinate system, the positive x-axis direction is to the right, and the positive y-axis direction is downward, so as to determine the first stamping center coordinates.
[0056] In some embodiments, since the first stamped center coordinates in the obtained target electronic tender documents may exceed the tender document page, it is necessary to correct this type of center coordinates at this time.
[0057] For example, the second stamped center coordinates for each seal body to be stamped in the target electronic tender document can be represented by the set C = {(x1, y1), (x2, y2), …(x n ,y n )}, and a traversal operation needs to be performed. When the page width is W and the height is H, for each center coordinate (x i ,y i ) in C, it will be separately checked whether the left boundary x i - r ≥ 0, the upper boundary y i - r ≥ 0, the right boundary x i + r ≤ W, and the lower boundary y i + r ≤ H are all satisfied simultaneously. The judgment of these four boundary conditions is based on the physical boundary of the page and the actual coverage range of the seal. Only when all the circles corresponding to the center coordinates satisfy these four conditions can it be determined that all the circles in C are within the page range, and the automatic stamping system will check each center coordinate one by one. When there is a second stamped center coordinate that does not meet these four boundary conditions, the corresponding stamping area is not inside the page of the target electronic tender document.
[0058] Therefore, it is necessary to solve the problem that the stamping area is not within the page range. In one possible implementation, obtain the second stamped center coordinates for each seal body to be stamped in the target electronic tender document; for the second stamped center coordinates of each seal body to be stamped, determine whether the third stamping area corresponding to the second stamped center coordinates is inside the page of the target electronic tender document according to the second stamped center coordinates, the radius of the seal body to be stamped, and the page size of the target electronic tender document; if the third stamping area is not completely inside the page of the target electronic tender document, correct the second stamped center coordinates according to a preset distance to determine the first stamped center coordinates of the seal body to be stamped.
[0059] Among them, the second stamped center coordinates can refer to the center coordinates that need to be stamped in the target electronic tender document. At this time, in the second stamped center coordinates, the stamping area formed by combining the radius of the seal body to be stamped may exceed the page range of the target electronic tender document. Therefore, after correction, the second stamped center coordinates that meet the requirement of not exceeding the page range are used as the first stamped center coordinates of the seal body to be stamped.
[0060] The third stamping area can refer to the circular area determined by the radius of the seal body to be stamped and the second stamped center coordinates. Before correction, the third stamping area may be completely within the page range, may be partially within the page range, or may not be within the page range.
[0061] The page size of the target electronic tender can refer to the actual size range of each page of the target electronic tender, usually represented by the width and height of the page. In the embodiments of the present application, the page width is W and the page height is H.
[0062] It can be seen that after determining whether the third stamping area corresponding to the second stamping center coordinate is inside the page of the target electronic tender, for the case where the third stamping area is not completely inside the page of the target electronic tender, it is necessary to correct the second stamping center coordinate according to a preset distance, so as to meet the requirement that all stamping areas are within the page.
[0063] Therefore, in a possible implementation manner, if the third stamping area is not completely inside the page of the target electronic tender, then determine the target boundary line that the third stamping area in the target electronic tender exceeds; control the third stamping area to move away from the target boundary line according to the preset distance; determine the first stamping center coordinate according to the moved third stamping area.
[0064] Among them, the target boundary line can refer to the specific boundary line that the third stamping area exceeds the page of the target electronic tender. The target boundary line can be the upper boundary line, or the left boundary line, or can also be the upper boundary line and the left boundary line at the same time.
[0065] It can be seen that after it is determined that the third stamping area is not completely inside the page of the target electronic tender, it is necessary to correct the second stamping center coordinate corresponding to the third stamping area, so that all stamping areas are within the page, and the corresponding center coordinate can be determined as the first stamping center coordinate of the stamping body to be stamped.
[0066] For example, there is a center (x a , y a ) that exceeds the left boundary, that is, it satisfies x a -r < 0, and at the same time y a -r ≥ 0, x a +r ≤ W, y a +r ≤ H. Using the preset distance d safe as the safety distance value to ensure that there is enough space between the corrected circle and the page boundary, the automatic stamping system moves the center to the right by a distance of r - x a + d safe , so as to obtain the corrected center coordinate as (r + d safe , y a ). At this time, the stamping body area determined by the center coordinate (r + d safe , y a ) and the stamping body radius r is inside the page of the target electronic tender, and the corresponding stamping body area is the moved third stamping area. (r + d safe , ya ) as the center coordinates of the first seal.
[0067] For another example, there is a center (x a , y a ) that exceeds the upper and right boundaries, that is, when y a - r < 0 and x a + r > W, the system will move the center to the left by x a + r - W + d safe , and at the same time move it down by r - y a + d safe , and the new center coordinates obtained are (W - r - d safe , r + d safe ), which are used as the center coordinates of the first seal.
[0068] It should be understood that during the correction process, the automatic seal - stamping system will update the center coordinates in real - time and re - check whether the corrected circle is within the page to ensure the effectiveness of the correction operation.
[0069] In some embodiments, for obtaining the center coordinates of the second seal, it can be output by a detection model. Therefore, in a possible implementation, the target electronic tender is input into the automatic seal - stamping system to obtain the center coordinates of the second seal for each seal body to be stamped output by the automatic seal - stamping system. The automatic seal - stamping system includes different types of detection models. The detection model is used to detect the content of the corresponding type in the target electronic tender to determine the center coordinates of the second seal for each seal body to be stamped. The detection model includes at least one of the following: a text detection model, a picture detection model, and a table detection model.
[0070] Among them, the detection model can refer to a model that performs detection according to extraction requirements. The extraction requirements can be for text, pictures, or tables, so as to ensure that all places that need to be stamped in the target electronic tender are extracted.
[0071] The text detection model can refer to a pre - trained natural language processing model. After fine - tuning training with a large number of bidding documents, it can accurately identify text content in different fonts, font sizes, and layout formats. And it will perform semantic analysis on the text, identify key nodes of contract terms, positions of important declarations, etc., which need to be stamped. It will consider format information such as bold font, underlined text, color changes of the text, as well as layout features such as paragraph indentation and alignment methods to more accurately locate the stamping position.
[0072] The image detection model can learn the features of various types of images, accurately distinguish the main body and background in the images, and identify the stamped areas. It will also analyze the attributes of the images, such as the resolution, color mode, file format, etc. of the images, and combine the position and context information of the images in the document to determine whether to stamp on the images. At the same time, it will also analyze the embedding method of the images, such as whether it is a floating image, whether it is wrapped with text, etc., and check the annotation information and copyright statement of the images to determine whether to stamp on the images.
[0073] The table detection model combines optical character recognition and table structure analysis algorithms, and can parse the header, body, and footer information of complex tables. At the same time, it will deeply analyze the structure of the table, including the merging and splitting of cells, the separation method of the header and the body, and the type and distribution of data in the table, such as the approval column in the header and the data confirmation column in the footer, so as to determine the appropriate stamping position in the table.
[0074] It should be understood that for the second stamping center coordinates in the embodiments of the present application, they are output in combination with at least one of the text detection model, the image detection model, and the table detection model. The automatic stamping system will summarize all the obtained center coordinates and take the union of these coordinate sets.
[0075] If the set of stamping position coordinates obtained after taking the union is empty, to ensure the rigor of the electronic tender, it is default to stamp all pages.
[0076] For example, when the upper left corner is determined as the fixed stamping position, when the left margin of the page is w and the upper margin is h, the coordinates of the fixed stamping position are set as (w + r, h + r), so as to ensure that the seal can be completely and clearly displayed in the text editable area of the page, and at the same time, it will not affect the readability and aesthetics of the text content. After stamping, the tender is saved.
[0077] S102. Determine the stamping area corresponding to each to-be-stamped seal body according to the radius of each to-be-stamped seal body and the first stamping center coordinates.
[0078] Among them, the stamping area can refer to a circular area determined by the radius of the to-be-stamped seal body and the first stamping center coordinates. For different to-be-stamped seal bodies, different radii and center coordinates will determine different stamping areas. Therefore, after multiple stamping areas are determined, there may be overlapping or coincident situations, which will reduce the readability of the seal. Therefore, such situations need to be checked. In the embodiments of the present application, because the stamping area is a circular area, it is possible to judge whether there are intersecting or tangent situations in the circle where the stamping area is located, so as to assist in judging whether the seals overlap.
[0079] For example, store the coordinates of the centers of all the first stamps in set S. If S has only one element, there is no case where two circles intersect or are tangent. If there is more than one element in set S, establish an empty set T to record the pairs of intersecting or tangent circles. To ensure the accuracy of the judgment, use a double loop to traverse the centers in set S. The outer loop variable i ranges from 1 to n - 1, and the inner loop variable j ranges from i + 1 to n. For each combination of i and j, the system accurately calculates the distance between the selected centers (x ,y i ,y i ) and (x j ,y j ) according to the distance formula between two points. This formula is based on Euclidean geometry principles and can accurately calculate the straight-line distance between two points on a plane.
[0080] Then, based on the relationship between d ij and the radii of the two circles, determine whether there is an intersecting or tangent situation. If so, add the pair (i, j) to set T. If set T is an empty set, it means that no two circles in set S intersect or are tangent.
[0081] S103: If there is any intersection or tangency between any two stamped areas, then according to the preset distance, the coordinates of the centers of the first stamps corresponding to any two stamped areas, and the radius of the stamp body to be stamped, correct the coordinates of the centers of the first stamps corresponding to any two stamped areas to determine the new coordinates of the centers of the first stamps.
[0082] Among them, the preset distance can refer to the preset spacing standard to ensure that each stamped area meets the specifications.
[0083] For example, there are two circular stamped areas with centers (x b ,y b ) and (x c ,y c ), and the radii of these two stamped areas are r. Calculate according to the formula If d bc ≤2r, it can be determined that the two circles with centers (x b ,y b ) and (x c ,y c ) intersect or are tangent. At this time, it is necessary to move these two stamped areas to avoid overlapping of the two stamped areas.
[0084] In a possible implementation, if any two stamped areas intersect or are tangent to each other, then according to a preset distance, the first stamped center coordinates corresponding to any two stamped areas, and the radius of the stamp body to be stamped, determine the moving direction and moving distance of each stamped area in any two stamped areas; for each stamped area in any two stamped areas, move it according to the corresponding moving direction and moving distance, and determine the center coordinates of the moved stamped area as the new first stamped center coordinates.
[0085] The moving direction can refer to the direction in which the intersecting or tangent stamped areas need to be moved to avoid overlapping of the stamped areas. The direction away from the center point can be selected and moved outward along the line connecting the two centers to increase the distance between them. Or a specific angle can be calculated so that each stamp can meet the requirement of not overlapping with other stamps and at the same time maintain the aesthetics of the overall layout as much as possible.
[0086] The moving distance can refer to the distance by which the intersecting or tangent stamped areas need to be moved to avoid overlapping of the stamped areas.
[0087] It can be seen that it is necessary to calculate the actual distance between the centers of the current two stamped areas, and then according to their respective radii and the preset distance, calculate how much more distance needs to be increased and move in the appropriate moving direction to meet the non-overlapping requirement.
[0088] Therefore, in a possible implementation, if any two stamped areas intersect or are tangent to each other, then according to the formula calculate the moving direction of the first stamped area in any two stamped areas; take the opposite direction as the moving direction of the second stamped area in any two stamped areas; according to the formula Δd = (r1 + r2 + d safe ) - d bc , calculate the moving distance of each stamped area in any two stamped areas;
[0089] where, Δd is used to represent the moving distance, r1 is used to represent the radius of the stamp body to be stamped corresponding to the first stamped area, (x b , y b ) are the first stamped center coordinates of the first stamped area, r2 is used to represent the radius of the stamp body to be stamped corresponding to the second stamped area, (x c , y c ) are the first stamped center coordinates of the second stamped area, d safe is used to represent the preset distance, and d bc is used to represent the center distance between the first stamped area and the second stamped area.
[0090] For example, the center is (x b , yb ) and (x c , y c ), two circular stamping areas are respectively used as the first stamping area and the second stamping area, and their radii are r1 and r2 respectively. Calculate the center distance between the first stamping area and the second stamping area according to the formula When calculating to d bc ≤ r1 + r2, it indicates that there is an intersection or tangency between these two circular areas, then calculate the center connection vector And calculate the vector length According to Δd = (r1 + r2 + d safe ) - d bc Calculate the moving distance of each stamping area.
[0091] If the radii of the two circular stamping areas are the same, both are r, then according to Δd = (2r + d safe ) - d bc Calculate the moving distance of each stamping area.
[0092] To make the coordinate correction uniform, the movable distance of each circle is set to If Then calculate the unit vector As the moving direction, it can make the first stamping area with the center (x b , y b ) move along in the opposite direction by the distance, and the second stamping area with the center (x c , y c ) move along in the positive direction by the distance, so as to complete the correction of the center position of the intersecting or tangent circles.
[0093] For the corrected center position, among which the first stamping area with the center (x b , y b ), the new center coordinates after moving are (x b ′ , y b ′ ), it can be known that the second stamping area with the center (x c , y c ), the new center coordinates after moving are (x c ′ , y c ′ ), it can be known that (x b ′ , y b′ ) and (x c ′ , y c ′ ) is the new first stamping center coordinate.
[0094] In the embodiment of the present application, after completing the correction of not being on the page, intersection or tangency correction, it will be determined again whether all circles are within the page and whether any two circles intersect or are tangent. If there are still situations that do not meet the conditions, that is, there are circles exceeding the page boundary or intersecting / tangent circles, the correction operation will be repeated again. This process will be carried out multiple times until all circles neither intersect nor are tangent and are completely within the page range to ensure the accuracy and effectiveness of the correction operation.
[0095] S104. If there is no intersection or tangency between any two stamping areas, determine the first stamping center coordinate of each stamping body to be stamped as the target stamping center coordinate.
[0096] Among them, the target stamping center coordinate can refer to the stamping center coordinate that meets the requirement of non-overlapping stamping areas, that is, after repeatedly detecting whether any two circles intersect or are tangent, the stamping areas of all circles neither intersect nor are tangent.
[0097] It can be seen that the first stamping center coordinate of each stamping body to be stamped at this time can be determined as the target stamping center coordinate, so that the automatic stamping system can select a suitable seal from the electronic seal library according to the target stamping center coordinate and accurately stamp it at the corresponding position of the electronic tender. After stamping is completed, the system will save the stamped document.
[0098] A method for determining a stamping position provided by an embodiment of the present application obtains the first stamping center coordinates of at least two stamping bodies to be stamped for a target electronic tender, determines the stamping area according to the radius and the first stamping center coordinate of each stamping body to be stamped. If there is an intersection or tangency of the stamping areas, the center coordinate is corrected according to the preset distance, the first stamping center coordinate of the relevant stamping area and the radius of the stamping body to be stamped to obtain a new first stamping center coordinate. If there is no intersection or tangency, the target stamping center coordinate is directly determined. Thereby, the problem of low accuracy in determining the stamping position is solved, and conflicts between stamping areas are effectively avoided.
[0099] Figure 2 It is a flow chart of a method for determining a stamping position provided by an embodiment of the present application Figure 2 , as Figure 2 shown, on the basis of the Figure 1 embodiment, a method for determining a stamping position is described in detail. The method includes:
[0100] S201. Obtain the electronic tender.
[0101] S202. The electronic tender is detected by the text detection model, the image detection model, and the table detection model, and the central position coordinate sets of the text areas to be stamped, the central position coordinate sets of the image areas, and the central position coordinate sets of the table areas are output respectively.
[0102] S203. Take the union of the results output by the text detection model, the image detection model, and the table detection model.
[0103] S204. Determine whether the set is empty. If it is not empty, execute S205; if it is empty, execute S206.
[0104] S205. When the set is empty, determine whether the stamping area is within the page. At this time, the stamping area is circular. If it is within the page, execute S207; if it is not within the page, execute S208.
[0105] S206. According to the page layout, select a fixed position, that is, the fixed stamping position coordinates in the upper left corner.
[0106] S207. If the stamping area enclosed by the circle is within the page, continue to determine whether the two circles intersect or are tangent. If they do not intersect or are not tangent, execute S211. If there is an intersection or tangency, execute S209.
[0107] S208. If the stamping area formed by the circle is not within the page, after correcting the center position of the stamping area, execute S205 again.
[0108] S209. If there is an intersection or tangency between the two circles, after correcting the center position of the stamping area, execute S210.
[0109] S210. After correcting the center position of the stamping area where there is an intersection or tangency, determine again whether the stamping area enclosed by the circle is within the page. If it is, execute S211; otherwise, execute S208.
[0110] S211. Determine the final stamping position.
[0111] It can be seen that after the electronic tender passes through the text detection model, the image detection model, and the table detection model, the union of the detection results is taken. First, determine whether the set is empty. If it is empty, select a fixed position, that is, stamp in the upper left corner. If it is not empty, then determine whether the stamping area is within the page. If it is not, correct the center position of the stamping area. If it is within the page, continue to determine whether the circle where the stamping area is located intersects or is tangent. If it does not intersect or is not tangent, the final stamping position can be determined. If there is an intersection or tangency, after correcting the center position, until it meets the requirements, then determine the final stamping position.
[0112] Figure 3 Flow schematic of a method for determining the stamping position provided by an embodiment of the present application Figure 3 , as Figure 3 shown, this embodiment details the case where the stamping area is not within the page, including:
[0113] S301. After setting the safety distance value and traversing the centers of the circles to be corrected, if it exceeds a single page boundary, execute S302; if it exceeds two page boundaries, execute S303.
[0114] S302. Corresponding to the four cases of exceeding the left boundary, upper boundary, right boundary, and lower boundary respectively, calculate the direction and distance that the center of the stamping area needs to move.
[0115] S303. Corresponding to the four cases of exceeding the left boundary and upper boundary, left boundary and lower boundary, upper boundary and right boundary, and right boundary and lower boundary respectively, calculate the direction and distance that the center of the stamping area needs to move.
[0116] S304. According to the calculated direction and distance of movement, implement the correction of the center position.
[0117] S305. Repeatedly check whether it is within the page, and perform correction when it is determined not to be within the page.
[0118] It can be seen that when determining whether the stamping area is within the page, when the stamping area exceeds a single boundary, there are four cases of exceeding the left boundary, upper boundary, right boundary, and lower boundary, and the corresponding direction and distance of movement need to be calculated; when the stamping area exceeds two boundaries, there are four cases of exceeding the left boundary and upper boundary, left boundary and lower boundary, upper boundary and right boundary, and right boundary and lower boundary, and the corresponding direction and distance of movement also need to be calculated, so as to implement the correction of the center position.
[0119] Figure 4 Flow schematic of a method for determining the stamping position provided by an embodiment of the present application Figure 4 , as Figure 4 shown, this embodiment details the case where the stamping areas intersect or are tangent, including:
[0120] S401. Set a safety distance and traverse the pairs of circles to be corrected.
[0121] S402. Calculate the vector of the line connecting the centers of the pair of circles and the length of the vector.
[0122] S403. According to the vector of the line connecting the centers and the length of the vector, calculate the movement amount and the unit vector.
[0123] S404. According to the calculated movement amount and unit vector, implement the correction of the center position.
[0124] S405. Repeatedly check for intersections or tangencies, and make corrections when it is determined that there are intersections or tangencies.
[0125] It can be seen that when there are intersections or tangencies in the stamping area, it is necessary to determine the safety distance and the pairs of circles that need to be corrected, then calculate the vector of the line connecting the centers of the circles and the vector length, and then the unit vector representing the moving direction can be determined according to the vector of the line connecting the centers of the circles, and the moving amount representing the moving distance can be determined according to the vector length, so as to realize the correction of the center position of the circle.
[0126] Figure 5 This is the coordinate schematic diagram of the electronic tender document provided by the embodiment of the present application. As Figure 5 shown, taking the upper left vertex O1 of the page as the origin, a plane rectangular coordinate system is established, with the right direction as the positive direction of the x-axis and the downward direction as the positive direction of the y-axis. The area within the dashed box is the tender document text editing area, and it can be seen that the left margin of the page is w and the upper margin is h. Figure 5 A stamping area with O3 as the center and a radius of r is given.
[0127] Figure 6 This is the structural schematic diagram of a stamping position determination device provided by the embodiment of the present application. As Figure 6 shown, the stamping position determination device 60 provided in this embodiment includes:
[0128] An acquisition module 601, configured to acquire the first stamping center coordinates of the target electronic tender document for at least two stamping bodies to be stamped;
[0129] A first determination module 602, configured to determine the stamping area corresponding to each stamping body to be stamped according to the radius of each stamping body to be stamped and the first stamping center coordinates;
[0130] A second determination module 603, configured to, if there are intersections or tangencies between any two stamping areas, correct the first stamping center coordinates corresponding to any two stamping areas according to a preset distance, the first stamping center coordinates corresponding to any two stamping areas, and the radius of the stamping body to be stamped, and determine the new first stamping center coordinates;
[0131] A third determination module 604, configured to, if there are no intersections or tangencies between any two stamping areas, determine the first stamping center coordinates of each stamping body to be stamped as the target stamping center coordinates.
[0132] In a possible implementation, the second determination module 603 is further configured to, if there are any two stamped areas that intersect or are tangent to each other, determine the moving direction and moving distance of each of the two stamped areas according to a preset distance, the first stamped center coordinates corresponding to the two stamped areas, and the radius of the stamp body to be stamped; for each of the two stamped areas, move it according to the corresponding moving direction and moving distance, and determine the center coordinates of the moved stamped area as the new first stamped center coordinates.
[0133] In a possible implementation, the second determination module 603 is further configured to, if there are any two stamped areas that intersect or are tangent to each other, then according to the formula calculate the moving direction of the first stamped area among the two stamped areas; take the opposite direction as the moving direction of the second stamped area among the two stamped areas; according to the formula Δd = (r1 + r2 + d safe ) - d bc , calculate the moving distance of each of the two stamped areas;
[0134] wherein, Δd is used to represent the moving distance, r1 is used to represent the radius of the stamp body to be stamped corresponding to the first stamped area, (x b , y b ) are the first stamped center coordinates of the first stamped area, r2 is used to represent the radius of the stamp body to be stamped corresponding to the second stamped area, (x c , y c ) are the first stamped center coordinates of the second stamped area, d safe is used to represent the preset distance, and d bc is used to represent the center distance between the first stamped area and the second stamped area.
[0135] In a possible implementation, the obtaining module 601 is further configured to obtain the second stamped center coordinates of the target electronic tender for each stamp body to be stamped; for the second stamped center coordinates of each stamp body to be stamped, determine whether the third stamped area corresponding to the second stamped center coordinates is within the page of the target electronic tender according to the second stamped center coordinates, the radius of the stamp body to be stamped, and the page size of the target electronic tender; if the third stamped area is not completely within the page of the target electronic tender, correct the second stamped center coordinates according to the preset distance to determine the first stamped center coordinates of the stamp body to be stamped.
[0136] In a possible implementation, the obtaining module 601 is further configured to, if the third stamping area is not completely within the page of the target electronic tender document, determine the target boundary line exceeded by the third stamping area in the target electronic tender document; control the third stamping area to move away from the target boundary line according to a preset distance; and determine the first stamping center coordinates according to the moved third stamping area.
[0137] In a possible implementation, the obtaining module 601 is further configured to input the target electronic tender document into an automatic stamping system to obtain the second stamping center coordinates of each stamping body to be stamped output by the automatic stamping system. The automatic stamping system includes different types of detection models, and the detection model is used to detect the content of the corresponding type in the target electronic tender document to determine the second stamping center coordinates of each stamping body to be stamped. The detection model includes at least one of the following: a text detection model, a picture detection model, and a table detection model.
[0138] The stamping position determination device provided in this embodiment can execute the method provided in the above method embodiment, and its implementation principle and technical effect are similar, which will not be elaborated here in this embodiment.
[0139] Figure 7 This is a schematic structural diagram of an electronic device provided in an embodiment of the present application. As Figure 7 shown, the electronic device 70 provided in this embodiment includes at least one processor 701 and a memory 702. Optionally, the electronic device 70 further includes a communication component 703. Among them, the processor 701, the memory 702, and the communication component 703 are connected through a bus 704.
[0140] In a specific implementation process, at least one processor 701 executes the computer execution instructions stored in the memory 702, so that at least one processor 701 executes the above method.
[0141] The specific implementation process of the processor 701 can refer to the above method embodiment, and its implementation principle and technical effect are similar, which will not be elaborated here in this embodiment.
[0142] In the above embodiments, it should be understood that the processor may be a central processing unit (CPU for short), or may also be other general-purpose processors, digital signal processors (DSP for short), application specific integrated circuits (ASIC for short), etc. The general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the method disclosed in combination with the invention can be directly implemented by the execution of the hardware processor, or can be implemented by the combination of hardware and software modules in the processor.
[0143] The memory may include a high-speed memory (Random Access Memory, RAM), and may also include non-volatile memory (Non-volatile Memory, NVM), such as at least one disk memory.
[0144] The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For the convenience of representation, the bus in the drawings of this application is not limited to only one bus or one type of bus.
[0145] This application also provides a computer program product, including a computer program, which implements the above method when executed by a processor.
[0146] This application also provides a computer-readable storage medium, in which computer-executable instructions are stored, and when the processor executes the computer-executable instructions, the above method is implemented.
[0147] The above-readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, a magnetic disk or an optical disc. The readable storage medium can be any available medium accessible by a general-purpose or special-purpose computer.
[0148] An exemplary readable storage medium is coupled to a processor so that the processor can read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an Application Specific Integrated Circuits (ASIC). Of course, the processor and the readable storage medium can also exist as discrete components in a device.
[0149] The division of units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the couplings or direct couplings or communication connections shown or discussed among each other can be indirect couplings or communication connections through some interfaces, devices or units, and can be in electrical, mechanical or other forms.
[0150] The units described as separate components may or may not be physically separated. The components shown as units may or may not be physical units, that is, they can be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0151] In addition, in each embodiment of the present invention, the functional units can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit.
[0152] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or a part of this technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods in each embodiment of the present invention. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs that can store program codes.
[0153] Those of ordinary skill in the art will understand that all or part of the steps of implementing the above method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments; and the aforementioned storage medium includes: various media such as ROM, RAM, magnetic disks, or optical discs that can store program codes.
[0154] Finally, it should be noted that those skilled in the art will readily conceive of other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. The present invention is intended to cover any variations, uses, or adaptations of the present invention, which follow the general principles of the present invention and include common general knowledge or conventional technical means in the technical field not disclosed in the present invention. It is not limited to the exact structures described above and shown in the drawings, and various modifications and changes can be made without departing from its scope. The scope of the present invention is only limited by the appended claims.
Claims
1. A method for determining the stamping position, characterized in that Including: Obtaining the first sealing center coordinates of the target electronic tender for at least two bodies to be sealed; Determining the sealing area corresponding to each body to be sealed according to the radius of each body to be sealed and the first sealing center coordinates; If there are any two sealing areas that intersect or are tangent, then according to the preset distance, the first sealing center coordinates corresponding to the any two sealing areas, and the radius of the body to be sealed, correcting the first sealing center coordinates corresponding to the any two sealing areas to determine the new first sealing center coordinates; If there are no any two sealing areas that intersect or are tangent, then determining the first sealing center coordinates of each body to be sealed as the target sealing center coordinates.
2. The method according to claim 1, characterized in that, The step of, if there are any two sealing areas that intersect or are tangent, then according to the preset distance, the first sealing center coordinates corresponding to the any two sealing areas, and the radius of the body to be sealed, correcting the first sealing center coordinates corresponding to the any two sealing areas to determine the new first sealing center coordinates, includes: If there are any two sealing areas that intersect or are tangent, then determining the moving direction and moving distance of each sealing area in the any two sealing areas according to the preset distance, the first sealing center coordinates corresponding to the any two sealing areas, and the radius of the body to be sealed; For each sealing area in the any two sealing areas, moving it according to the corresponding moving direction and moving distance, and determining the center coordinates of the moved sealing area as the new first sealing center coordinates.
3. The method according to claim 2, characterized in that, The step of, if there are any two sealing areas that intersect or are tangent, then determining the moving direction and moving distance of each sealing area in the any two sealing areas according to the preset distance, the first sealing center coordinates corresponding to the any two sealing areas, and the radius of the body to be sealed, includes: If there are any two stamped areas that intersect or are tangent to each other, then according to the formula calculate the moving direction of the first stamped area among the any two stamped areas; Determine the opposite direction of the as the moving direction of the second stamping area among any two stamping areas; According to the formula Δd = (r1 + r2 + d safe ) - d bc , calculate the moving distance of each of the arbitrarily two stamped areas; Among them, Δd is used to represent the moving distance, r1 is used to represent the radius of the seal body to be sealed corresponding to the first sealing area, (x b , y b ) is the first sealing center coordinate of the first sealing area, r2 is used to represent the radius of the seal body to be sealed corresponding to the second sealing area, (x c , y c ) is the first sealing center coordinate of the second sealing area, d safe is used to represent the preset distance, and d bc is used to represent the center distance between the first sealing area and the second sealing area.
4. The method according to any one of claims 1-3, characterized in that, The step of obtaining the first sealing center coordinates of the target electronic tender for at least two bodies to be sealed includes: Obtaining the second sealing center coordinates of the target electronic tender for each body to be sealed; For the second sealing center coordinates of each body to be sealed, determining whether the third sealing area corresponding to the second sealing center coordinates is inside the page of the target electronic tender according to the second sealing center coordinates, the radius of the body to be sealed, and the page size of the target electronic tender; If the third sealing area is not completely inside the page of the target electronic tender, then correcting the second sealing center coordinates according to the preset distance to determine the first sealing center coordinates of the body to be sealed.
5. The method according to claim 4, characterized in that, The step of, if the third sealing area is not completely inside the page of the target electronic tender, then correcting the second sealing center coordinates according to the preset distance to determine the first sealing center coordinates of the body to be sealed, includes: If the third sealing area is not completely inside the page of the target electronic tender, then determining the target boundary line that the third sealing area exceeds in the target electronic tender; Controlling the third sealing area to move away from the target boundary line according to the preset distance; Determine the coordinates of the center of the first seal according to the third seal area after movement.
6. The method according to claim 4, characterized in that, The obtaining the coordinates of the center of the second seal for each seal body to be sealed in the target electronic tender includes: Input the target electronic tender into the automatic sealing system to obtain the coordinates of the center of the second seal for each seal body to be sealed output by the automatic sealing system. The automatic sealing system includes different types of detection models, and the detection model is used to detect the content of the corresponding type in the target electronic tender to determine the coordinates of the center of the second seal for each seal body to be sealed. The detection model includes at least one of the following: a text detection model, a picture detection model, and a table detection model.
7. A device for determining the stamping position, characterized in that, It includes: An obtaining module, configured to obtain the coordinates of the center of the first seal for at least two seal bodies to be sealed in the target electronic tender; A first determination module, configured to determine the seal area corresponding to each seal body to be sealed according to the radius of each seal body to be sealed and the coordinates of the center of the first seal; A second determination module, configured to, if there are any two seal areas that intersect or are tangent, correct the coordinates of the center of the first seal corresponding to the any two seal areas according to a preset distance, the coordinates of the center of the first seal corresponding to the any two seal areas, and the radius of the seal body to be sealed, and determine the new coordinates of the center of the first seal; A third determination module, configured to, if there are no any two seal areas that intersect or are tangent, determine the coordinates of the center of the first seal of each seal body to be sealed as the coordinates of the target seal center.
8. An electronic device, characterized in that, It includes: A memory, a processor; The memory stores computer execution instructions; The processor executes the computer execution instructions stored in the memory, so that the processor executes the method according to any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer execution instructions, and when the computer execution instructions are executed by the processor, they are used to implement the method according to any one of claims 1-6.
10. A computer program product, characterized in that, It includes a computer program, and when the computer program is executed by the processor, it implements the method according to any one of claims 1-6.