CN116071755B - Text positioning method, device and equipment in electronic seal and storage medium - Google Patents

Text positioning method, device and equipment in electronic seal and storage medium Download PDF

Info

Publication number
CN116071755B
CN116071755B CN202310364339.9A CN202310364339A CN116071755B CN 116071755 B CN116071755 B CN 116071755B CN 202310364339 A CN202310364339 A CN 202310364339A CN 116071755 B CN116071755 B CN 116071755B
Authority
CN
China
Prior art keywords
coordinate
seal
text
character
information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202310364339.9A
Other languages
Chinese (zh)
Other versions
CN116071755A (en
Inventor
滕明航
侯京彪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fuxin Kunpeng Beijing Information Technology Co ltd
Original Assignee
Fuxin Kunpeng Beijing Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fuxin Kunpeng Beijing Information Technology Co ltd filed Critical Fuxin Kunpeng Beijing Information Technology Co ltd
Priority to CN202310364339.9A priority Critical patent/CN116071755B/en
Publication of CN116071755A publication Critical patent/CN116071755A/en
Application granted granted Critical
Publication of CN116071755B publication Critical patent/CN116071755B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/14Image acquisition
    • G06V30/146Aligning or centring of the image pick-up or image-field
    • G06V30/1465Aligning or centring of the image pick-up or image-field by locating a pattern
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/14Image acquisition
    • G06V30/1444Selective acquisition, locating or processing of specific regions, e.g. highlighted text, fiducial marks or predetermined fields
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Collating Specific Patterns (AREA)

Abstract

The application relates to a text positioning method, a text positioning device, text positioning equipment and a storage medium in an electronic seal, and belongs to the technical field of electronic seals. The method comprises the following steps: acquiring elliptical seal information; wherein, the elliptic seal information comprises seal character information and seal shape information; the seal text information comprises a text word number, a text space, a text-to-seal contour distance and a text drawing path; taking the center of the ellipse as a coordinate origin, and determining ellipse vertex coordinate information based on the seal shape information; and determining character coordinate information of characters in the elliptical seal based on the seal character information, the elliptical vertex coordinate information and a preset character positioning rule. The electronic seal has the advantages that the characters in the electronic seal are accurately arranged according to elliptical bending, and therefore each character in the electronic seal has a good visual effect.

Description

Text positioning method, device and equipment in electronic seal and storage medium
Technical Field
The present disclosure relates to the field of electronic seals, and in particular, to a method, an apparatus, a device, and a storage medium for positioning characters in an electronic seal.
Background
With the advent of the age of invoice electronization, more and more enterprises transmit information by stamping electronic documents in an electronic seal signature (OFD) format.
When the electronic seal is displayed in the OFD format, the electronic seal is rendered in a vector image mode, so that the electronic seal is displayed in the OFD format more clearly and is not distorted.
When the electronic seal is drawn, the characters in the electronic seal need to be arranged along with the shape of the electronic seal in a surrounding way, for an elliptic electronic seal, the characters in the ellipse need to be arranged along with the bending of the ellipse, and the number of characters in the electronic seal can be different due to uncertainty of the distance from the center of the ellipse to the ellipse, so that when the characters are added in the ellipse, each character is difficult to be arranged in a bending way accurately around the ellipse. Therefore, there is a need for a text positioning method in an electronic seal, which is applied to an elliptical electronic seal and realizes text arrangement according to the shape of the ellipse.
Disclosure of Invention
In order to realize that characters in an elliptical electronic seal are arranged according to the shape of the ellipse, each character in the electronic seal has a good visual effect, the application provides a character positioning method, a device, equipment and a storage medium in the electronic seal.
In a first aspect, the present application provides a text positioning method in an electronic seal, which adopts the following technical scheme:
a text positioning method in an electronic seal comprises the following steps:
acquiring elliptical seal information; wherein, the elliptic seal information comprises seal character information and seal shape information; the seal text information comprises a text word number, a text space, a text-to-seal contour distance and a text drawing path;
taking the center of the ellipse as a coordinate origin, and determining ellipse vertex coordinate information based on the seal shape information;
and determining character coordinate information of characters in the elliptical seal based on the seal character information, the elliptical vertex coordinate information and a preset character positioning rule.
By adopting the technical scheme, the seal shape, the character spacing and the distance from the characters to the seal outline are used as constraint conditions. All characters in the seal are symmetrical by taking the Y axis as a symmetry axis, the center position of the characters is positioned on a normal line of an ellipse tangent line, the obtained coordinate positions are used for arranging the characters according to the ellipse shape, each character is perpendicular to the tangent line of the connecting line of the character center point and the mapping point of the character center point on the ellipse, the precise arrangement of the characters in the ellipse electronic seal according to the ellipse shape is realized, and each character in the electronic seal has a better visual effect.
Optionally, the determining the text coordinate information of the text in the elliptical seal based on the seal text information, the elliptical vertex coordinate information and the preset text positioning rule includes:
if the number of the characters of the seal is singular, determining character coordinate information of the characters in the elliptical seal based on the character information of the seal, the coordinate information of the elliptical vertex and a first positioning algorithm;
and if the number of the characters of the seal is double, determining character coordinate information of the characters in the elliptical seal based on the character information of the seal, the coordinate information of the vertex of the ellipse and a second positioning algorithm.
Optionally, the determining the text coordinate information of the text in the elliptical seal based on the seal text information, the elliptical vertex coordinate information and the first positioning algorithm includes:
determining intermediate character coordinates based on the ellipse vertex coordinates and the character-to-seal contour distance, and taking the intermediate character as a target character;
calculating a first target point coordinate on the ellipse based on a preset ellipse coordinate calculation rule;
determining the next character coordinate of the target character based on a preset ellipse correlation equation, the first target point coordinate and the character-to-seal contour distance;
calculating a first coordinate distance between the target text coordinate and the next text coordinate;
Comparing the first coordinate distance with the text space; if the first coordinate distance is not equal to the text space, adjusting the first target point coordinate based on an ellipse coordinate adjusting rule, and executing the step of determining the next text coordinate of the target text based on a preset ellipse correlation equation, the first target point coordinate and the text-to-seal contour distance until the first coordinate distance is equal to the text space;
if the first coordinate distance is equal to the character spacing, taking the next character as a target character, and executing the step of selecting the first target point coordinate on the ellipse based on a preset ellipse coordinate selection rule until all character coordinates on one side of the coordinate axis are calculated;
and performing symmetrical processing on all the text coordinates on one side of the coordinate axis to obtain text coordinate information of the text in the elliptical seal.
By adopting the technical scheme, when the number of characters in the seal is singular, the positions of the middle characters are positioned on the symmetry axis of the elliptical seal, and the positions of all the characters in the seal are obtained by calculating the positions of the characters on one side of the middle characters, so that the calculated amount of the computer for calculating the coordinates of the characters is reduced, and the efficiency of positioning the characters in the seal is improved.
Optionally, the determining the text coordinate information of the text in the elliptical seal based on the seal text information, the elliptical vertex coordinate information and the second positioning algorithm includes:
determining the X coordinate of the (N/2+1) th character based on the character spacing, and recording the (N/2+1) th character as the current character; wherein N is the word number of the characters;
calculating coordinates of a second target point on the ellipse based on a preset ellipse coordinate calculation rule;
calculating the Y coordinate of the current text based on a preset ellipse correlation equation and the second target point coordinate to obtain the current text coordinate;
calculating a second coordinate distance between the current text coordinate and the second target point;
comparing the second coordinate distance with the text-to-seal contour distance; if the second coordinate distance is not equal to the text-to-seal contour distance, adjusting the second target point coordinate based on an ellipse coordinate adjustment rule, and executing the step of calculating the Y coordinate of the current text based on a preset ellipse correlation equation and the second target point coordinate to obtain the current text coordinate until the second coordinate distance is equal to the text-to-seal contour distance;
If the second coordinate distance is equal to the distance from the text to the seal outline, the current text coordinate is used as a target text coordinate; and executing the step of calculating the coordinates of the first target point on the ellipse based on the preset ellipse coordinate calculation rule.
Optionally, the calculating the coordinates of the first target point on the ellipse based on the preset ellipse coordinate calculation rule includes:
determining the vertex coordinates of the target ellipse based on the text drawing path;
determining an X coordinate range [ X ] of the first target point coordinate based on the target text coordinate, the target elliptical vertex coordinate and a preset elliptical coordinate range formula min ,X max ]The method comprises the steps of carrying out a first treatment on the surface of the The preset elliptic coordinate range formula is as follows:
X min =X 0 +a;X max =X a -a;
wherein X is 0 The X coordinate of the target text; x is X a Is the X coordinate of the vertex of the ellipse; a is a convergence coefficient;
determining an X coordinate of the first target point coordinate based on a dichotomy formula and an X coordinate range of the first target point coordinate; the dichotomy formula is:
X 1 =(X min +X max )/2;
wherein X is 1 An X coordinate which is a first target point coordinate;
and calculating the first target point coordinate based on the ellipse standard equation and the X coordinate of the first target point coordinate.
By adopting the technical scheme, a point on the ellipse is selected by taking the X coordinate of the target character and the major axis of the ellipse as the range through the dichotomy, the Y coordinate is obtained by using an ellipse standard equation, and then the possible character coordinate on the normal line of the point is obtained. The distance from the possible character coordinates to the ellipse mapping point and the distance from the possible character coordinates to the target character coordinates are compared, and the possible range of the points on the ellipse is continuously divided into two parts until the determined coordinates and the normal slope are finally obtained. The quaternary quadratic equation needed by solving is avoided, the calculated amount is reduced, and the calculated time is greatly shortened.
Optionally, the adjusting the coordinates of the first target point based on the ellipse coordinate adjustment rule includes:
if the first coordinate distance is greater than the text space, the electronic device updates X by taking the X coordinate of the current first target point coordinate as the maximum value of the first target point coordinate max =X 1 Obtaining a new X coordinate range of the first target point coordinate;
if the first coordinate distance is smaller than the text space, the electronic equipment takes the X coordinate of the current first target point coordinate as the minimum value of the first target point coordinate, and updates X min =X 1, Obtaining a new X coordinate range of the first target point coordinate;
and repeatedly executing the step of determining the X coordinate of the first target point coordinate based on the dichotomy formula and the X coordinate range of the first target point coordinate.
Optionally, after determining the text coordinate information of the text in the elliptical seal based on the seal text information, the elliptical vertex coordinate information and a preset text positioning rule, the method further includes:
and generating the electronic seal in a vector format according to the seal character information, the seal shape information and the character coordinate information of the characters in the elliptical seal.
By adopting the technical scheme, the original definition and the curvature of the electronic seal in the vector format can be maintained, and the attribute of the electronic seal can be moved and changed for many times without influencing the resolution ratio of the electronic seal.
In a second aspect, the present application provides a text positioning device in an electronic seal, which adopts the following technical scheme:
a text positioning device in an electronic seal, comprising:
the acquisition module is used for acquiring elliptical seal information; wherein, the elliptic seal information comprises seal character information and seal shape information; the seal text information comprises a text word number, a text space, a text-to-seal contour distance and a text drawing path;
the determining module is used for taking the center of the ellipse as a coordinate origin and determining ellipse vertex coordinate information based on the seal shape information;
and the character positioning module is used for determining character coordinate information of characters in the elliptical seal based on the seal character information, the elliptical vertex coordinate information and a preset character positioning rule.
By adopting the technical scheme, the seal shape, the character spacing and the distance from the characters to the seal outline are used as constraint conditions. All characters in the seal are symmetrical by taking the Y axis as a symmetry axis, the center position of the characters is positioned on a normal line of an ellipse tangent line, the obtained coordinate positions are used for arranging the characters according to the ellipse shape, each character is perpendicular to the tangent line of the connecting line of the character center point and the mapping point of the character center point on the ellipse, the precise arrangement of the characters in the ellipse electronic seal according to the ellipse shape is realized, and each character in the electronic seal has a better visual effect.
In a third aspect, the present application provides an electronic device, which adopts the following technical scheme:
an electronic device comprising a memory and a processor, the memory having stored thereon a computer program capable of being loaded by the processor and performing the text positioning method in an electronic seal as described in any of the first aspects.
In a fourth aspect, the present application provides a computer readable storage medium, which adopts the following technical scheme:
a computer-readable storage medium storing a computer program capable of being loaded by a processor and executing the text positioning method in the electronic seal according to any one of the first aspect.
In summary, the present application includes at least one of the following beneficial technical effects: the user determines the shape of the ellipse by setting the parameters of the length and the short axis of the ellipse, and the character spacing and the vertical distance from the characters to the tangent line of the ellipse are taken as constraint conditions. All characters in the seal are axisymmetric by taking the Y axis as an axisymmetric mode, the center positions of the characters are positioned on a normal line of an ellipse tangent line, the obtained coordinate positions arrange the characters according to the ellipse, each character is perpendicular to the tangent line of a connecting line of a character center point and a mapping point of the character center point on the ellipse, accurate arrangement of the characters in the ellipse electronic seal according to the ellipse is realized, and each character in the electronic seal has a good visual effect.
Drawings
Fig. 1 is a flow chart of a text positioning method in an electronic seal according to an embodiment of the present application.
FIG. 2 is a flow chart of steps S1311-S1316 in an embodiment of the present application.
Fig. 3 is a schematic diagram of a word positioning structure with a single number of words of a seal in the embodiment of the present application.
Fig. 4 is a flow chart illustrating a substep of step S1312 in the embodiment of the present application.
Fig. 5 is a schematic diagram of a text positioning structure with the number of characters of the seal being two in the embodiment of the application.
FIG. 6 is a flow chart of steps S1321 to S1325 in the embodiment of the present application.
Fig. 7 is an example of a stamp of singular characters and double characters of the embodiment of the present application.
Fig. 8 is a block diagram of a text positioning device in an electronic seal according to an embodiment of the present application.
Fig. 9 is a block diagram of an electronic device according to an embodiment of the present application.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the embodiments of the present application more clear, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, are intended to be within the scope of the present application.
In addition, the term "and/or" herein is merely an association relationship describing an association object, and means that three relationships may exist, for example, a and/or B may mean: a exists alone, A and B exist together, and B exists alone. In this context, unless otherwise specified, the term "/" generally indicates that the associated object is an "or" relationship.
The embodiment of the application provides a text positioning method in an electronic seal, which can be executed by electronic equipment, wherein the electronic equipment can be a server or mobile terminal equipment, and the server can be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers or a cloud server for providing cloud computing service; the mobile terminal device may be, but is not limited to, a tablet computer, a notebook computer, a mobile phone, a desktop computer, etc.
Embodiments of the present application are described in further detail below with reference to the drawings attached hereto. As shown in fig. 1, the main flow of the method is described as follows (steps S11 to S13):
s11, obtaining elliptical seal information; wherein, the elliptic seal information comprises seal character information and seal shape information;
In the embodiment of the application, a user inputs elliptical seal information on a seal generation interface of electronic equipment, and seal character information comprises character content, character number, character distance, character-to-seal contour distance and character drawing paths, wherein the character drawing paths can be the lower half surrounding of the elliptical seal or the upper half surrounding of the elliptical seal; for example, the user inputs a text content of the adult tax bureau, the number of text words is 5, the space between the text words is 1 cm, the distance between the text words and the seal outline is 1 cm, and the text drawing path is encircled by the lower half part of the elliptical seal. The user may also select an elliptical stamp style template, e.g., a single line elliptical style, a double line elliptical style, etc., at the stamp-generation interface. The stamp shape information includes an ellipse major axis, an ellipse minor axis, and an ellipse focus.
For an elliptic seal, the elliptic frame can be uniquely determined according to the input long and short axes, the characters in the ellipse are arranged along with the bending of the ellipse, and the calculation is performed according to the vertical distance from each character to the ellipse and the character spacing.
When the major axis of the ellipse is equal to the minor axis of the ellipse in the seal shape information output by the user, the circle radius is equivalent, that is, the character positioning in the circle seal is also suitable for the method.
The user can trigger input operation through a mouse, a keyboard, a touch screen and the like of the electronic equipment, and the electronic equipment responds to the input operation of the user to acquire elliptical seal information.
S12, taking the center of the ellipse as the origin of coordinates, and determining the coordinate information of the vertex of the ellipse based on the shape information of the seal;
in the embodiment of the present application, taking the ellipse center point as the origin of coordinates, the ellipse center point coordinates are (0, 0), and the ellipse vertex coordinates are determined according to the ellipse center point coordinates, the ellipse major axis and the ellipse minor axis, for example, the ellipse major axis is 20 cm and the ellipse minor axis is 15 cm, and then it is known that the ellipse vertex coordinates are (-20, 0), (0, -15), (20, 0) and (0, 15), respectively.
And step S13, determining character coordinate information of characters in the elliptical seal based on the seal character information, the elliptical vertex coordinate information and a preset character positioning rule.
In the embodiment of the present application, step S13 includes the following two cases.
In the first case, if the number of characters in the seal is singular, determining character coordinate information of characters in the elliptical seal based on the seal character information, the elliptical vertex coordinate information and a first positioning algorithm;
And in the second case, if the number of characters in the seal is double, determining character coordinate information of characters in the elliptical seal based on the seal character information, the elliptical vertex coordinate information and a second positioning algorithm.
The method for locating characters in the seal in the first case is illustrated by using the number of characters of the seal as 5 characters, and the coordinates of the vertices of the ellipse as (-axisX, 0), (0, -axisY), (axisX, 0) and (0, axisY) respectively, wherein the distance from the characters to the seal contour is distance elipse and the distance text is distance text.
Specifically, as shown in fig. 2, the first case includes the following substeps (steps S1311 to 1316):
step S1311, when the number of characters of the seal is singular, the electronic equipment determines the coordinates of the middle characters based on the coordinate information of the elliptical vertex and the distance from the characters to the seal outline, and takes the middle characters as target characters;
when the number of characters of the seal is five, the number of characters is singular, so that the positions of all the characters of the seal are symmetrically arranged by taking the position of the middle character as a symmetrical arrangement, the middle character is a third character, and the third character is taken as a target character. In this embodiment, as shown in fig. 3, the current position of the target text is recorded as a point a, and the point a is located in the Y symmetry axis, and if the text path input by the user at the electronic seal generating interface is the lower half of the elliptical seal, the electronic device encircles the lower vertex a of the ellipse according to the text-to-seal contour distance and the ellipse The coordinates of the center point A are calculated to be (0, -axisY+DistanceEllipse).
Note that, since the character center position is on the normal line of the ellipse tangent line, and the target character coordinate is located in the Y symmetry axis, the Y symmetry axis is the normal line of the point a.
Step S1312, calculating the coordinates of a first target point on the ellipse based on a preset ellipse coordinate calculation rule;
the first target point is a point on the ellipse, in this embodiment, as shown in fig. 3, the position of the first target point is recorded as point B
Further, as shown in fig. 4, step S1312 specifically includes (steps Sa to Sd):
step Sa, the electronic equipment determines the coordinates of the vertex of the target ellipse based on the text drawing path; in the embodiment of the application, the text drawing path is that text surrounds the lower half part of the elliptical seal or text surrounds the upper half part of the elliptical seal, the text coordinate determining direction is determined by the right direction of the Y symmetry axis, and the target vertexes are all elliptical right vertexes; in contrast, the character coordinate determining direction is determined by the Y symmetry axis to the left side, and the target vertexes are all elliptical left vertexes.
Step Sb, determining an X coordinate range [ X ] of the first target point coordinate based on the target character coordinate, the target elliptical vertex coordinate and a preset elliptical coordinate range formula min ,X max ]The method comprises the steps of carrying out a first treatment on the surface of the The preset elliptic coordinate range formula is as follows:
X min =X 0 +a;X max =X a -a;
wherein X is 0 The X coordinate of the target text; x is X a Is the X coordinate of the vertex of the ellipse; a is a convergence coefficient;
in the embodiment of the present application, the convergence coefficient is set to 0.01, and the first target point coordinate is a point on the ellipse between the right side of the target character and the major axis of the ellipse, namely point B To be a point on the ellipse between the right side of the point A and the right vertex of the ellipse, a point B can be obtained The minimum value of the X coordinate of (C) is 0.01, point B The maximum value of the X coordinate of (C) is axisX-0.01.
Step Sc, determining the X coordinate of the first target point coordinate based on a dichotomy formula and the X coordinate range of the first target point coordinate; the dichotomy formula is:
X 1 =(X min +X max )/2;
wherein X is 1 An X coordinate which is a first target point coordinate;
in the embodiment of the present application, the point B is calculated X coordinate of (2) is X B' =(0.01+axisX-0.01)/2。
And step Sd, calculating the first target point coordinate based on the elliptic standard equation and the X coordinate of the first target point coordinate.
In the present embodiment, the point B is calculated according to the elliptic standard equation Calculating the first target point coordinate;
the elliptic standard equation is:
Figure SMS_1
=1(a>b>0) The method comprises the steps of carrying out a first treatment on the surface of the Wherein a is an elliptic long half shaft, and b is an elliptic short half shaft; point B Substituting the X coordinate of (2) into the elliptic standard equation to obtain the point B The Y coordinate of (C) is:
Figure SMS_2
by using a dichotomy, a point on the ellipse is selected with the X-coordinate and the ellipse major axis of the target character as the ranges, the Y-coordinate is obtained using an ellipse standard equation, and then the possible character coordinates on the normal line of the point are obtained. The distance from the possible character coordinates to the ellipse mapping point and the distance from the possible character coordinates to the target character coordinates are compared, and the possible range of the points on the ellipse is continuously divided into two parts until the determined coordinates and the normal slope are finally obtained. The quaternary quadratic equation needed by solving is avoided, the calculated amount is reduced, and the solving time is greatly shortened.
Step S1313, determining a next text coordinate of the target text based on a preset elliptic correlation equation, the first target point coordinate and the text-to-seal contour distance;
in the embodiment of the present application, first, the point B is calculated according to the elliptic tangent equation A tangential slope on the ellipse; the elliptic tangent equation is:
Figure SMS_3
the method comprises the steps of carrying out a first treatment on the surface of the Wherein k is an ellipseTangential slope at any point above; a is an elliptic long half shaft; b is an elliptic short half shaft; x is the X coordinate of any point on the ellipse; y is the Y coordinate of any point on the ellipse.
Calculating to obtain a point B Tangential slope Y on the ellipse B' The percentage is:
Figure SMS_4
then, calculating the point B according to the tangent function and the arctangent function Angle theta and point B with elliptic long half axis An included angle theta-Normal between the Normal line of the ellipse major axis;
the tangent function is:
Figure SMS_5
the method comprises the steps of carrying out a first treatment on the surface of the The arctangent function is: />
Figure SMS_6
Calculating to obtain a point B The included angle with the elliptic long half shaft is as follows:
Figure SMS_7
since the product of the tangent and the normal slope is-1, the point B is calculated The included angle between the normal line of the (C) and the elliptic long half axis is as follows:
Figure SMS_8
thereafter, according to point B Coordinates, text-to-seal contour distance and point B Calculating point B of included angle between normal line and elliptic long half axis The next character coordinate of the target character on the normal line;
as shown in fig. 3, in the embodiment of the present application, the next text coordinate is recorded as a point B, and the X coordinate of the point B is calculated as:
Figure SMS_9
the method comprises the steps of carrying out a first treatment on the surface of the The Y-coordinate of the calculated point B is:
Figure SMS_10
step S1314, calculating a first coordinate distance between the target text coordinate and the next text coordinate;
in the embodiment of the present application, a first coordinate Distance from the point a to the point B is calculated according to the point a coordinate and the point B coordinate, and the first coordinate Distance is recorded as Distance1.
Step S1315, comparing the first coordinate distance with the text pitch;
if the first coordinate distance is not equal to the text space, adjusting the first target point coordinate based on an ellipse coordinate adjusting rule, and executing the next text coordinate of the target text determined based on a preset ellipse correlation equation, the first target point coordinate and the text-to-seal contour distance until the first coordinate distance is equal to the text space;
Specifically, the adjusting the coordinates of the first target point based on the ellipse coordinate adjustment rule includes:
if the first coordinate distance is greater than the text space, the electronic device updates X by taking the X coordinate of the current first target point coordinate as the maximum value of the first target point coordinate max =X 1 Obtaining a new X coordinate range of the first target point coordinate;
in the examples of the present application, distance1 is assumed>DistanceText, update X max =X B' ,X max For (0.01+axisX-0.01)/2, then point B The X coordinate range of (2) is: the minimum value of the X coordinate is 0.01, point B The maximum value of X coordinate of (2) is (0.01+axisX-0.01)/0.
If the first coordinate distance is smaller than the text space, the electronic equipment takes the X coordinate of the current first target point coordinate as the minimum value of the first target point coordinate, and updates X min =X 1 Obtaining a new X coordinate range of the first target point coordinate;
in the examples of the present application, distance1 is assumed<DistanceText, update X min =X B' ,X min For (0.01+axisX-0.01)/2, then point B The X coordinate range of (2) is: minimum value of X coordinate is(0.01+axisX-0.01)/2, point B The maximum value of the X coordinate of (C) is axisX-0.01.
And the electronic equipment repeatedly executes the step Sc, determines the X coordinate of the first target point coordinate based on the dichotomy formula and the X coordinate range of the first target point coordinate, and iterates until the first coordinate distance is equal to the character spacing.
If the first coordinate distance is equal to the text distance, the next text is used as a target text, and the step S1312 is executed, wherein the step of selecting the coordinates of the first target point on the ellipse based on a preset ellipse coordinate selection rule is performed until all text coordinates on one side of the coordinate axis are calculated;
in the embodiment of the present application, if Distance 1=distance text, then point B is taken as the target text, and the next text coordinate of the target text is continuously calculated until the coordinates of all the text on the right side of the middle point a of the seal text are calculated.
Step S1316, performing a symmetrical process on all the text coordinates on one side of the coordinate axis, to obtain text coordinate information of the text in the elliptical seal.
By symmetrically processing the characters on one side of the coordinate axis, the calculation of the coordinate information of the characters in the electronic seal is reduced, and the efficiency of positioning the characters in the electronic seal is improved.
The text positioning method in the second case of the seal is illustrated by using the number of seal text words as 6 words, and ellipse vertex coordinates of (-axisX, 0), (0, -axisY), (axisX, 0) and (0, axisY) respectively, wherein the text-to-seal contour distance is distance elipse and the text distance is distance text.
Specifically, as shown in fig. 6, the second case includes the following substeps (steps S1321 to 1325):
step S1321, when the number of characters of the seal is double, the electronic equipment determines the X coordinate of the (N/2+1) th character based on the character spacing, and marks the (N/2+1) th character as the current character; wherein N is the word number of the characters;
in the embodiment of the application, when the characters in the seal are 6 characters, (N/2+1) characters are the first4 words, as shown in fig. 5, the 4 th word is recorded as a point a, the 3 rd word is recorded as a point C, the point a is located on the right side of the Y axis, the point a and the point C are symmetrical about the Y axis, the distance between the point a and the point C is distance text, if the text path input by the user at the electronic seal generating interface is the lower half of the elliptical seal, the electronic device can calculate that the X coordinate of the point a is X according to the text distance A =DistanceText/2。
Step S1322, calculating the coordinates of a second target point on the ellipse based on a preset ellipse coordinate calculation rule;
in the embodiment of the present application, the coordinates of the second target point are one point on the ellipse, as shown in fig. 3, the second target point is point a The preset elliptic coordinate calculation rule of the second case is the same as the preset elliptic coordinate calculation rule of the first case, and will not be described here again. Point A is located past point A Point a on the normal line of the tangent line The X coordinate of (2) is positioned on the right side of the target character, and the point A is calculated according to a preset elliptic coordinate calculation rule X coordinate minimum of (2) is X A +0.01, point A Has an X coordinate maximum of axisX-0.01; finally, calculating to obtain a point A The X coordinate of (2) is: x is X A' =(X A +axisx)/2; calculating to obtain a point A The Y coordinate of (C) is:
Figure SMS_11
step S1323, calculating the Y coordinate of the current text based on a preset elliptic correlation equation and the second target point coordinate to obtain the current text coordinate;
in the embodiment of the present application, first, the point a is calculated according to the elliptic tangent equation The tangential slope on the ellipse is
Figure SMS_12
Then, calculating the point A according to the tangent function and the arctangent function The included angle theta with the elliptic long half shaft is:
Figure SMS_13
finally, calculating a point A according to the product of the tangential slope and the normal slope as-1 The Y coordinate of point A on the normal is:
Figure SMS_14
step S1324, calculating a second coordinate distance between the current text coordinate and the second target point;
in the embodiment of the present application, as shown in FIG. 5, the point A coordinates and the point A are calculated according to Coordinate calculation points A to A The recorded coordinate Distance is Distance2.
Step S1325, comparing the second coordinate distance with the text-to-seal contour distance; if the coordinate distance is not equal to the seal outline from the character center, adjusting the coordinate of the second target point based on an ellipse coordinate adjusting rule, and executing the step of calculating the Y coordinate of the current character based on a preset ellipse correlation equation and the coordinate of the second target point to obtain the coordinate of the current character until the coordinate distance is equal to the seal outline distance from the character;
The rule for adjusting the coordinates of the ellipse is discussed in the first case, and is not described in detail here.
In the examples of the present application, the dichotomy is used for X of point A coordinates min And X max Make adjustments if distance 2>DistanceeEllipse, update X max The method comprises the steps of carrying out a first treatment on the surface of the If distance 2<DisanceText, update X min
If the second coordinate distance is equal to the distance from the text to the seal outline, the current text coordinate is used as a target text coordinate; step S1312 in the first case is executed, where the coordinates of the first target point on the ellipse are calculated based on the preset ellipse coordinate calculation rule, until all the text coordinates in the seal text are calculated.
The method determines the shape of an ellipse by setting the parameters of the length and the short axis of the ellipse, and takes the distance between characters and the vertical distance between the characters and the tangent line of the ellipse as constraint conditions. All characters in the seal are axisymmetric by taking the Y axis as an axisymmetric mode, the center positions of the characters are positioned on a normal line of an ellipse tangent line, the obtained coordinate positions arrange the characters according to the ellipse, each character is perpendicular to the tangent line of a connecting line of a character center point and a mapping point of the character center point on the ellipse, accurate arrangement of the characters in the ellipse electronic seal according to the ellipse is realized, and each character in the electronic seal has a good visual effect.
In order to enable the electronic seal to still maintain original definition under moving and stretching, as an optional implementation manner of the embodiment of the application, after determining the text coordinate information of the text in the elliptical seal based on the seal text information, the ellipse vertex coordinate information and a preset text positioning rule, the method further includes:
and generating the electronic seal in a vector format according to the seal character information, the seal shape information and the character coordinate information of the characters in the elliptical seal.
In this embodiment, fig. 6 is an example of a seal with singular characters and double characters in this embodiment, where the electronic device renders the shape of the elliptical seal into a canvas, and renders the text content of the seal into the canvas according to the text coordinate information, so as to generate an electronic seal in a vector format, for example, in an SVG format. Because the generated seal is an SVG image, the original definition and curvature of the seal can be maintained, and the attribute of the seal can be moved and changed for many times without affecting the resolution ratio of the seal.
The foregoing is an introduction to the method in the embodiments of the present application, and the following description of the embodiments of the present application is provided by means of device embodiments.
Fig. 8 is a block diagram of a text positioning method in an electronic seal according to an embodiment of the present application.
As shown in fig. 8, the text positioning device 200 in the electronic seal includes:
an acquisition module 201, configured to acquire elliptic seal information; wherein, the elliptic seal information comprises seal character information and seal shape information; the seal text information comprises a text word number, a text space, a text-to-seal contour distance and a text drawing path;
a determining module 202, configured to use the center of the ellipse as a coordinate origin, and determine vertex coordinate information of the ellipse based on the seal shape information;
the text positioning module 203 is configured to determine text coordinate information of text in the elliptical seal based on the seal text information, the elliptical vertex coordinate information and a preset text positioning rule.
As an alternative implementation of the embodiment of the present application, the text positioning module 203 includes:
the first character positioning module is used for determining character coordinate information of characters in the elliptical seal based on the seal character information, the elliptical vertex coordinate information and a first positioning algorithm if the number of the seal characters is singular;
and the second character positioning module is used for determining character coordinate information of characters in the elliptic seal based on the seal character information, the elliptic vertex coordinate information and a second positioning algorithm if the number of the seal characters is double.
In this alternative embodiment, the first text positioning module includes:
the first character coordinate determining submodule is used for determining intermediate character coordinates based on the ellipse vertex coordinates and the character-to-seal contour distance, and taking the intermediate character as a target character;
the first calculating sub-module is used for calculating the coordinates of a first target point on the ellipse based on a preset ellipse coordinate calculating rule;
the second character coordinate submodule is used for determining the next character coordinate of the target character based on a preset elliptic correlation equation, the first target point coordinate and the character-to-seal contour distance;
the second calculation sub-module is used for calculating the coordinate distance between the target text coordinate and the next text coordinate;
the first comparison module is used for comparing the first coordinate distance with the text space; if the first coordinate distance is not equal to the text space, transferring to an adjustment sub-module; if the first coordinate distance is equal to the character spacing, taking the next character as a target character, and transferring the next character into a first calculation sub-module until all character coordinates on one side of the coordinate axis are calculated;
the adjusting submodule is used for adjusting the first target point coordinate based on an ellipse coordinate adjusting rule and executing the step of determining the next character coordinate of the target character based on a preset ellipse correlation equation, the first target point coordinate and the character-to-seal contour distance until the coordinate distance is equal to the character distance;
And the symmetrical processing module is used for symmetrically processing all the text coordinates on one side of the coordinate axis to obtain text coordinate information of the text in the elliptical seal.
In this alternative embodiment, the second text positioning sub-module includes:
the X coordinate determination submodule is used for determining the X coordinate of the (N/2+1) th character based on the character spacing and recording the (N/2+1) th character as the current character; wherein N is the word number of the characters;
the third calculation sub-module is used for calculating the coordinates of a second target point on the ellipse based on a preset ellipse coordinate calculation rule;
the third text coordinate positioning sub-module is used for calculating the Y coordinate of the current text based on a preset elliptic correlation equation and the second target point coordinate to obtain the current text coordinate;
a fourth calculation sub-module, configured to calculate a distance between the current text coordinate and the second target point coordinate;
the second comparison submodule is used for comparing the coordinate distance with the distance from the characters to the seal outline; if the coordinate distance is not equal to the text-to-seal contour distance, adjusting the coordinate of the second target point based on an ellipse coordinate adjustment rule, and executing the step of calculating the Y coordinate of the current text based on a preset ellipse correlation equation and the coordinate of the second target point to obtain the coordinate of the current text until the coordinate distance is equal to the text-to-seal contour distance;
If the coordinate distance is equal to the distance from the text to the seal outline, the current text coordinate is used as a target text coordinate; and executing the step of calculating the coordinates of the first target point on the ellipse based on the preset ellipse coordinate calculation rule.
Further, the first computing submodule is specifically configured to:
determining the vertex coordinates of the target ellipse based on the text drawing path;
determining an X coordinate range [ X ] of the first target point coordinate based on the target text coordinate, the target elliptical vertex coordinate and a preset elliptical coordinate range formula min ,X max ]The method comprises the steps of carrying out a first treatment on the surface of the The preset elliptic coordinate range formula is as follows:
X min =X 0 +a;X max =X a -a;
wherein X is 0 The X coordinate of the target text; x is X a Is the X coordinate of the vertex of the ellipse; a is a convergence coefficient;
determining an X coordinate of the first target point coordinate based on a dichotomy formula and an X coordinate range of the first target point coordinate; the dichotomy formula is:
X 1 =(X min +X max )/2;
wherein X is 1 An X coordinate which is a first target point coordinate;
and calculating the first target point coordinate based on the ellipse standard equation and the X coordinate of the first target point coordinate.
Further, the adjusting submodule is specifically configured to:
if the first coordinate distance is greater than the text space, the electronic device updates X by taking the X coordinate of the current first target point coordinate as the maximum value of the first target point coordinate max =X 1 Obtaining a new X coordinate range of the first target point coordinate;
if the first coordinate distance is smaller than the text space, the electronic equipment takes the X coordinate of the current first target point coordinate as the minimum value of the first target point coordinate, and updates X min =X 1, Obtaining a new X coordinate range of the first target point coordinate;
and repeatedly executing the step of determining the X coordinate of the first target point coordinate based on the dichotomy formula and the X coordinate range of the first target point coordinate.
As an optional implementation manner of this embodiment of the present application, the text positioning device 200 in the electronic seal further includes an electronic seal generating module, where the electronic seal generating module is configured to generate, after determining text coordinate information of text in the elliptical seal based on the seal text information, the elliptical vertex coordinate information, and a preset text positioning rule, an electronic seal in a vector format according to the seal text information, the seal shape information, and the text coordinate information of text in the elliptical seal.
In one example, a module in any of the above apparatuses may be one or more integrated circuits configured to implement the above methods, for example: one or more application specific integrated circuits (application specific integratedcircuit, ASIC), or one or more digital signal processors (digital signal processor, DSP), or one or more field programmable gate arrays (field programmable gate array, FPGA), or a combination of at least two of these integrated circuit forms.
For another example, when a module in an apparatus may be implemented in the form of a scheduler of processing elements, the processing elements may be general-purpose processors, such as a central processing unit (central processing unit, CPU) or other processor that may invoke a program. For another example, the modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).
Various objects such as various messages/information/devices/network elements/systems/devices/actions/operations/processes/concepts may be named in the present application, and it should be understood that these specific names do not constitute limitations on related objects, and that the named names may be changed according to the scenario, context, or usage habit, etc., and understanding of technical meaning of technical terms in the present application should be mainly determined from functions and technical effects that are embodied/performed in the technical solution.
It will be clearly understood by those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described system, apparatus and module may refer to corresponding procedures in the foregoing method embodiments, which are not repeated herein.
Those of ordinary skill in the art will appreciate that the various illustrative modules and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
Fig. 9 is a block diagram of an electronic device 300 according to an embodiment of the present application.
As shown in fig. 9, the electronic device 300 includes a processor 301 and a memory 302, and may further include one or more of an information input/information output (I/O) interface 303 and a communication component 304.
The processor 301 is configured to control the overall operation of the electronic device 300, so as to complete all or part of the steps in the text positioning method in the electronic seal; the memory 302 is used to store various types of data to support operation at the electronic device 300, which may include, for example, instructions for any application or method operating on the electronic device 300, as well as application-related data. The Memory 302 may be implemented by any type or combination of volatile or non-volatile Memory devices, such as one or more of static random access Memory (Static Random Access Memory, SRAM), electrically erasable programmable Read-Only Memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), erasable programmable Read-Only Memory (Erasable Programmable Read-Only Memory, EPROM), programmable Read-Only Memory (Programmable Read-Only Memory, PROM), read-Only Memory (ROM), magnetic Memory, flash Memory, magnetic disk, or optical disk.
The I/O interface 303 provides an interface between the processor 301 and other interface modules, which may be a keyboard, mouse, buttons, etc. These buttons may be virtual buttons or physical buttons. The communication component 304 is used to test wired or wireless communication between the electronic device 300 and other devices. Wireless communication, such as Wi-Fi, bluetooth, near field communication (Near Field Communication, NFC for short), 2G, 3G, or 4G, or a combination of one or more thereof, and accordingly the communication component 304 can include: wi-Fi part, bluetooth part, NFC part.
Communication bus 305 may include a pathway to transfer information between the aforementioned components. The communication bus 305 may be a PCI (Peripheral Component Interconnect, peripheral component interconnect standard) bus or an EISA (Extended Industry Standard Architecture ) bus, or the like. The communication bus 305 may be divided into an address bus, a data bus, a control bus, and the like.
Electronic device 300 may be implemented by one or more application specific integrated circuits (Application SpecificIntegrated Circuit, abbreviated as ASIC), digital signal processors (Digital Signal Processor, abbreviated as DSP), digital signal processing devices (Digital Signal Processing Device, abbreviated as DSPD), programmable logic devices (Programmable Logic Device, abbreviated as PLD), field programmable gate arrays (Field Programmable Gate Array, abbreviated as FPGA), controllers, microcontrollers, microprocessors, or other electronic components for performing the text-locating method in an electronic stamp as set forth in the above embodiments.
The electronic device 300 may include, but is not limited to, a mobile terminal such as a digital broadcast receiver, a PDA (personal digital assistant), a PMP (portable multimedia player), etc., and a fixed terminal such as a digital TV, a desktop computer, etc., and may also be a server, etc.
The following describes a computer readable storage medium provided in an embodiment of the present application, where the computer readable storage medium described below and the text positioning method described above in the electronic seal may be referred to correspondingly.
The application also provides a computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program realizes the steps of the character positioning method in the electronic seal when being executed by a processor.
The computer readable storage medium may include: a U-disk, a removable hard disk, a read-only memory (ROM), a random access memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus.
The foregoing description is only of the preferred embodiments of the present application and is presented as a description of the principles of the technology being utilized. It will be appreciated by persons skilled in the art that the scope of the application referred to in this application is not limited to the specific combinations of features described above, but it is intended to cover other embodiments in which any combination of features described above or their equivalents is possible without departing from the spirit of the application. Such as the above-mentioned features and the technical features having similar functions (but not limited to) applied for in this application are replaced with each other.

Claims (7)

1. A character positioning method in an electronic seal is characterized by comprising the following steps:
acquiring elliptical seal information; wherein, the elliptic seal information comprises seal character information and seal shape information; the seal text information comprises a text word number, a text space, a text-to-seal contour distance and a text drawing path;
taking the center of the ellipse as a coordinate origin, and determining ellipse vertex coordinate information based on the seal shape information;
determining character coordinate information of characters in the elliptical seal based on the seal character information, the elliptical vertex coordinate information and a preset character positioning rule;
The determining the character coordinate information of the characters in the elliptical seal based on the seal character information, the elliptical vertex coordinate information and the preset character positioning rule comprises the following steps:
if the number of the characters of the seal is singular, determining character coordinate information of the characters in the elliptical seal based on the character information of the seal, the coordinate information of the elliptical vertex and a first positioning algorithm;
if the number of the characters of the seal is double, determining character coordinate information of characters in the elliptical seal based on the character information of the seal, the coordinate information of the vertex of the ellipse and a second positioning algorithm;
the determining the character coordinate information of the characters in the elliptical seal based on the seal character information, the elliptical vertex coordinate information and the first positioning algorithm comprises the following steps:
determining intermediate character coordinates based on the ellipse vertex coordinates and the character-to-seal contour distance, and taking the intermediate character as a target character;
calculating a first target point coordinate on the ellipse based on a preset ellipse coordinate calculation rule;
determining the next character coordinate of the target character based on a preset ellipse correlation equation, the first target point coordinate and the character-to-seal contour distance;
calculating a first coordinate distance between the target text coordinate and the next text coordinate;
Comparing the first coordinate distance with the text space; if the first coordinate distance is not equal to the text space, adjusting the first target point coordinate based on an ellipse coordinate adjusting rule, and executing the step of determining the next text coordinate of the target text based on a preset ellipse correlation equation, the first target point coordinate and the text-to-seal contour distance until the first coordinate distance is equal to the text space;
if the first coordinate distance is equal to the character spacing, taking the next character as a target character, and executing the step of selecting the first target point coordinate on the ellipse based on a preset ellipse coordinate selection rule until all character coordinates on one side of the coordinate axis are calculated;
performing symmetrical processing on all the text coordinates on one side of the coordinate axis to obtain text coordinate information of the text in the elliptical seal; the determining the character coordinate information of the characters in the elliptical seal based on the seal character information, the elliptical vertex coordinate information and the second positioning algorithm comprises the following steps:
determining the X coordinate of the (N/2+1) th character based on the character spacing, and recording the (N/2+1) th character as the current character; wherein N is the word number of the characters;
Calculating coordinates of a second target point on the ellipse based on a preset ellipse coordinate calculation rule;
calculating the Y coordinate of the current text based on a preset ellipse correlation equation and the second target point coordinate to obtain the current text coordinate;
calculating a second coordinate distance between the current text coordinate and the second target point;
comparing the second coordinate distance with the text-to-seal contour distance; if the second coordinate distance is not equal to the text-to-seal contour distance, adjusting the second target point coordinate based on an ellipse coordinate adjustment rule, and executing the step of calculating the Y coordinate of the current text based on a preset ellipse correlation equation and the second target point coordinate to obtain the current text coordinate until the second coordinate distance is equal to the text-to-seal contour distance;
if the second coordinate distance is equal to the distance from the text to the seal outline, the current text coordinate is used as a target text coordinate; and executing the step of calculating the coordinates of the first target point on the ellipse based on the preset ellipse coordinate calculation rule.
2. The method of claim 1, wherein calculating the coordinates of the first target point on the ellipse based on the preset ellipse coordinate calculation rule comprises:
Determining the vertex coordinates of the target ellipse based on the text drawing path;
determining an X coordinate range [ X ] of the first target point coordinate based on the target text coordinate, the target elliptical vertex coordinate and a preset elliptical coordinate range formula min ,X max ]The method comprises the steps of carrying out a first treatment on the surface of the The preset elliptic coordinate range formula is as follows:
X min =X 0 +a;X max =X a -a;
wherein X is 0 The X coordinate of the target text; x is X a Is the X coordinate of the vertex of the ellipse; a is a convergence coefficient;
determining an X coordinate of the first target point coordinate based on a dichotomy formula and an X coordinate range of the first target point coordinate; the dichotomy formula is:
X 1 =(X min +X max )/2;
wherein X is 1 An X coordinate which is a first target point coordinate;
and calculating the first target point coordinate based on the ellipse standard equation and the X coordinate of the first target point coordinate.
3. The method of claim 2, wherein the adjusting the first target point coordinates based on an elliptical coordinate adjustment rule comprises:
if the first coordinate distance is greater than the text space, the electronic device updates X by taking the X coordinate of the current first target point coordinate as the maximum value of the first target point coordinate max =X 1 Obtaining a new X coordinate range of the first target point coordinate;
if the first coordinate distance is smaller than the text space, the electronic equipment takes the X coordinate of the current first target point coordinate as the minimum value of the first target point coordinate, and updates X min =X 1 Obtaining a new X coordinate range of the first target point coordinate; and repeatedly executing the step of determining the X coordinate of the first target point coordinate based on the dichotomy formula and the X coordinate range of the first target point coordinate.
4. The method according to claim 1, further comprising, after said determining text coordinate information of text in an elliptical stamp based on said stamp text information, said elliptical vertex coordinate information, and a preset text positioning rule:
and generating the electronic seal in a vector format according to the seal character information, the seal shape information and the character coordinate information of the characters in the elliptical seal.
5. A text positioning device in an electronic seal, comprising:
the acquisition module is used for acquiring elliptical seal information; wherein, the elliptic seal information comprises seal character information and seal shape information; the seal text information comprises a text word number, a text space, a text-to-seal contour distance and a text drawing path; the determining module is used for taking the center of the ellipse as a coordinate origin and determining ellipse vertex coordinate information based on the seal shape information; the character positioning module is used for determining character coordinate information of characters in the elliptical seal based on the seal character information, the elliptical vertex coordinate information and a preset character positioning rule;
The text positioning module is specifically used for: if the number of the characters of the seal is singular, determining character coordinate information of the characters in the elliptical seal based on the character information of the seal, the coordinate information of the elliptical vertex and a first positioning algorithm;
if the number of the characters of the seal is double, determining character coordinate information of characters in the elliptical seal based on the character information of the seal, the coordinate information of the vertex of the ellipse and a second positioning algorithm;
the determining the character coordinate information of the characters in the elliptical seal based on the seal character information, the elliptical vertex coordinate information and the first positioning algorithm comprises the following steps:
determining intermediate character coordinates based on the ellipse vertex coordinates and the character-to-seal contour distance, and taking the intermediate character as a target character;
calculating a first target point coordinate on the ellipse based on a preset ellipse coordinate calculation rule;
determining the next character coordinate of the target character based on a preset ellipse correlation equation, the first target point coordinate and the character-to-seal contour distance;
calculating a first coordinate distance between the target text coordinate and the next text coordinate;
comparing the first coordinate distance with the text space; if the first coordinate distance is not equal to the text space, adjusting the first target point coordinate based on an ellipse coordinate adjusting rule, and executing the step of determining the next text coordinate of the target text based on a preset ellipse correlation equation, the first target point coordinate and the text-to-seal contour distance until the first coordinate distance is equal to the text space;
If the first coordinate distance is equal to the character spacing, taking the next character as a target character, and executing the step of selecting the first target point coordinate on the ellipse based on a preset ellipse coordinate selection rule until all character coordinates on one side of the coordinate axis are calculated;
performing symmetrical processing on all the text coordinates on one side of the coordinate axis to obtain text coordinate information of the text in the elliptical seal; the determining the character coordinate information of the characters in the elliptical seal based on the seal character information, the elliptical vertex coordinate information and the second positioning algorithm comprises the following steps:
determining the X coordinate of the (N/2+1) th character based on the character spacing, and recording the (N/2+1) th character as the current character; wherein N is the word number of the characters;
calculating coordinates of a second target point on the ellipse based on a preset ellipse coordinate calculation rule;
calculating the Y coordinate of the current text based on a preset ellipse correlation equation and the second target point coordinate to obtain the current text coordinate;
calculating a second coordinate distance between the current text coordinate and the second target point;
comparing the second coordinate distance with the text-to-seal contour distance; if the second coordinate distance is not equal to the text-to-seal contour distance, adjusting the second target point coordinate based on an ellipse coordinate adjustment rule, and executing the step of calculating the Y coordinate of the current text based on a preset ellipse correlation equation and the second target point coordinate to obtain the current text coordinate until the second coordinate distance is equal to the text-to-seal contour distance;
If the second coordinate distance is equal to the distance from the text to the seal outline, the current text coordinate is used as a target text coordinate; and executing the step of calculating the coordinates of the first target point on the ellipse based on the preset ellipse coordinate calculation rule.
6. An electronic device comprising a processor coupled to a memory;
the processor is configured to execute a computer program stored in the memory to cause the electronic device to perform the method of any one of claims 1 to 4.
7. A computer readable storage medium comprising a computer program or instructions which, when run on a computer, cause the computer to perform the method of any of claims 1-4.
CN202310364339.9A 2023-04-07 2023-04-07 Text positioning method, device and equipment in electronic seal and storage medium Active CN116071755B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310364339.9A CN116071755B (en) 2023-04-07 2023-04-07 Text positioning method, device and equipment in electronic seal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310364339.9A CN116071755B (en) 2023-04-07 2023-04-07 Text positioning method, device and equipment in electronic seal and storage medium

Publications (2)

Publication Number Publication Date
CN116071755A CN116071755A (en) 2023-05-05
CN116071755B true CN116071755B (en) 2023-06-27

Family

ID=86183975

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310364339.9A Active CN116071755B (en) 2023-04-07 2023-04-07 Text positioning method, device and equipment in electronic seal and storage medium

Country Status (1)

Country Link
CN (1) CN116071755B (en)

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1635533A (en) * 2003-12-30 2005-07-06 刘瑞祯 Digital stamp system
CN109191059A (en) * 2018-07-20 2019-01-11 中国邮政储蓄银行股份有限公司 The generation method and device of E-seal
CN111950555B (en) * 2020-08-17 2024-02-09 北京字节跳动网络技术有限公司 Text recognition method and device, readable medium and electronic equipment
CN113934335B (en) * 2021-09-27 2022-11-11 深圳法大大网络科技有限公司 Electronic seal generation method and device, computer equipment and storage medium
CN114511614A (en) * 2021-11-03 2022-05-17 泰康保险集团股份有限公司 Elliptical seal generation method, device, equipment and medium
CN114782957A (en) * 2022-04-26 2022-07-22 中国建设银行股份有限公司 Method, device, electronic equipment and medium for determining text information in stamp image

Also Published As

Publication number Publication date
CN116071755A (en) 2023-05-05

Similar Documents

Publication Publication Date Title
US9646195B1 (en) Facial feature liquifying using face mesh
CN110096929A (en) Target detection neural network based
CN112015501A (en) Visual page generation method and device, computer equipment and storage medium
CN111061921B (en) Image layout implementation method, system, terminal equipment and storage medium
US20210312673A1 (en) Graphical Element Color Diffusion Techniques
CN113934335B (en) Electronic seal generation method and device, computer equipment and storage medium
US20210201441A1 (en) Method, apparatus, device and storage medium for transforming hairstyle
EP4009232A1 (en) Image generation method, device, and storage medium
CN110827301A (en) Method and apparatus for processing image
CN109829963B (en) Image drawing method and device, computing equipment and storage medium
CN111583264A (en) Training method for image segmentation network, image segmentation method, and storage medium
CN113378435B (en) Particle generation method, device, equipment and storage medium
CN116071755B (en) Text positioning method, device and equipment in electronic seal and storage medium
WO2024051639A1 (en) Image processing method, apparatus and device, and storage medium and product
CN111221827B (en) Database table connection method and device based on graphic processor, computer equipment and storage medium
CN111951349B (en) Method and device for adjusting graph vertex types and electronic equipment
CN111461965A (en) Picture processing method and device, electronic equipment and computer readable medium
CN108734665A (en) A kind of bearing calibration of image, device, equipment and storage medium
CN105335118B (en) The display methods and device of a kind of electronic equipment control
CN113360102B (en) Method and device for generating print file, computer equipment and storage medium
CN115457202A (en) Method and device for updating three-dimensional model and storage medium
CN111461969B (en) Method, device, electronic equipment and computer readable medium for processing picture
CN111767700B (en) Graph adjustment method and device
US10984173B2 (en) Vector-based glyph style transfer
CN108415981B (en) Data dimension generation method, device, equipment and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant