CN117745807A - Method and device for confirming marking position - Google Patents

Method and device for confirming marking position Download PDF

Info

Publication number
CN117745807A
CN117745807A CN202410181820.9A CN202410181820A CN117745807A CN 117745807 A CN117745807 A CN 117745807A CN 202410181820 A CN202410181820 A CN 202410181820A CN 117745807 A CN117745807 A CN 117745807A
Authority
CN
China
Prior art keywords
square
target graph
marking
value
dimensional array
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.)
Granted
Application number
CN202410181820.9A
Other languages
Chinese (zh)
Other versions
CN117745807B (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.)
Shanghai Fangling Computer Software Co ltd
Original Assignee
Shanghai Fangling Computer Software 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 Shanghai Fangling Computer Software Co ltd filed Critical Shanghai Fangling Computer Software Co ltd
Priority to CN202410181820.9A priority Critical patent/CN117745807B/en
Publication of CN117745807A publication Critical patent/CN117745807A/en
Application granted granted Critical
Publication of CN117745807B publication Critical patent/CN117745807B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Image Generation (AREA)

Abstract

The invention provides a method and a device for confirming marking positions, which are applied to the technical field of laser cutting and comprise the following steps: determining the auxiliary rectangle size of the outer contour line of the enveloping target graph; dividing grid units of the auxiliary rectangle according to the set precision and marking points on the grid; judging whether points on the grids in the auxiliary rectangle are inside the target graph or not, and marking all the points in the target graph; calculating the maximum inscribed square in the target graph; determining a central point O ((startX+endX)/2, (startY+endY)/2) of the maximum inscribed square according to the determined coordinate position; adding marking information in the largest inscribed square in the target graph; the marking position of laser cutting and the maximum size of the marking area can be determined according to the actual condition of the target graph, so that the marking characters or patterns are not overlapped or blocked with the inner hole when the marking characters or patterns are added into the closed graph with the inner hole.

Description

Method and device for confirming marking position
Technical Field
The invention belongs to the technical field of marking, and particularly relates to a method and a device for confirming marking positions.
Background
Marking is divided into three types of pneumatic marking, laser marking and electric corrosion marking, wherein the pneumatic marking is controlled by a computer, and a printing needle performs high-frequency impact movement under the action of compressed air, so that a mark with a certain depth is printed on a workpiece, and the marking is characterized by a larger depth; the laser marking is to mark the surfaces of various substances permanently by laser beams, and the laser marking is to expose deep substances through the evaporation of surface substances so as to etch exquisite patterns, trademarks and characters; the electric corrosion marking mainly prints fixed trademarks, and the printing content is inconvenient to change.
In the laser cutting industry, a part is usually used as a minimum unit for cutting, and one part can be a closed outer contour or a closed outer contour comprising a plurality of closed inner contours. In the cutting process, some marked text, trademark and pattern information is usually added, and the information can be manually moved to an ideal position or calculated by a computer according to the graphic information of the part to find a reasonable position.
The following problems are typically encountered in the laser cutting industry to automatically calculate the position of text within a part:
the sizes of the marking area and the marking characters cannot be adjusted according to the actual conditions of the sizes and the shapes of the parts, and the unreasonable marking positions and the too small marking characters, trademarks and patterns play a small role in preventing the false of the marks.
In addition, when calculating the reasonable position of the marking word, the condition that the part exists in the inner contour can be ignored, and the traditional mark adding method cannot always consider the position of the inner hole in the closed graph, so that the position of the marking mark adding can be overlapped with the inner hole or be too close to the edge of the inner hole, and the definition of the marking word is affected.
Disclosure of Invention
In view of the above problems in the prior art, the present invention aims to provide a method for confirming a marking position, which can determine the maximum size and the marking position of a marking area of a part according to the actual condition of a target graph, and adjust the sizes of marking characters, trademarks and patterns according to the size of the marking area, so as to improve the anti-counterfeiting effect of a mark.
A method of confirming a marking location, comprising the steps of:
determining the auxiliary rectangle size of the outer contour line of the enveloping target graph; the target graph is a graph surrounded by a closed outer contour line;
dividing grid units of the auxiliary rectangle according to the set precision and marking points on the grid;
judging whether the points on the grids in the auxiliary rectangle are inside the target graph or not, and marking all the points inside the target graph;
calculating the maximum inscribed square inside the target graph according to all the points inside the target graph;
determining a central point O ((startX+endX)/2, (startY+endY)/2) of the maximum inscribed square according to the determined coordinate position of the maximum inscribed square;
adding marking information into the maximum inscribed square in the target graph, wherein the center of the marking information is positioned at the center point O of the maximum inscribed square in the target graph, and the size of the marking information is matched with the side length of the corresponding maximum inscribed square;
the method for calculating the maximum inscribed square inside the target graph comprises the following steps: defining a variable largest, startX, endX, startY, endY, wherein larget is the side length of the maximum inscribed square, and E (startX, startY), F (startX, endY), G (endX, startY), H (endX, endY) are the coordinate positions of four vertexes of the maximum inscribed square;
defining two-dimensional array dp [ i ] [ j ] for recording side length of inscribed square;
traversing row by row or column by column in turn, determining dp [ i ] [ j ] of each point in the target graph, comparing the dp [ i ] [ j ] with the larget, if the value of dp [ i ] [ j ] is larger than the value of the larget, giving the value of dp [ i ] [ j ] to the larget, storing the larget, and updating the coordinate of the E, F, G, H vertex; if the value of dp [ i ] [ j ] is not greater than the value of the larget, reserving the coordinates of the current larget and E, F, G, H vertexes;
after the traversal is completed, the variables largest, startX, endX, startY, endY are determined, thereby determining the side length and coordinate position of the largest inscribed square.
Preferably, the target pattern includes a closed outer contour and a plurality of closed inner contours, the inner contours being located in a pattern surrounded by the outer contour.
Preferably, the specific steps of determining the auxiliary rectangle size of the outer contour line of the enveloping target graph are as follows: and traversing the coordinates of each point in the outer contour line of the target graph, and determining the minimum X coordinate Xmin, the maximum X coordinate Xmax, the minimum Y coordinate Ymin and the maximum Y coordinate Ymax of the coordinates of each point in the outer contour line of the target graph, thereby determining the vertex coordinates of the auxiliary rectangle as A (Xmin, ymin), B (Xmin, ymax), C (Xmax, ymin) and D (Xmax, ymax).
Preferably, the method for dividing the auxiliary rectangle into grid cells and marking the points on the grid according to the setting precision comprises the following steps: after setting the required precision, the points on the grid are marked by a two-dimensional array or matrix.
Preferably, marking points on the grid by a two-dimensional array comprises the steps of: and recording a two-dimensional array A [ r ] [ c ] for marking points on a grid, wherein the parameters of the grid unit comprise grid length L and grid width W, the number r of the grid unit is (Ymax-Ymin)/W, the number c of the grid unit is (Xmax-Xmin)/L, and the numerical values of the grid length L and the grid width W are equal.
Preferably, when the target pattern is a pattern surrounded by a closed outer contour line, traversing and judging whether the points represented by the two-dimensional array A [ r ] [ c ] are inside the outer contour line by using an ignition method, and marking the points positioned inside the outer contour line by using the two-dimensional array B [ r ] [ c ].
Preferably, when the target graph comprises a closed outer contour line and a plurality of closed inner contour lines, and the inner contour lines are positioned in the graph surrounded by the outer contour lines, traversing and judging whether the points represented by the two-dimensional array A [ r ] [ c ] are positioned inside the outer contour lines and outside the inner contour lines by using a ray-induced method, and marking the points positioned inside the outer contour lines and outside the inner contour lines by using the two-dimensional array B [ r ] [ c ].
Preferably, the calculating the maximum inscribed square inside the target graph according to all the points inside the target graph comprises the following specific steps:
the arrangement is from bottom to top and from left to rightTraversing line by line to the right, and when traversing to the ith line, taking the point with the minimum X value of the ith line in the target graph asThe point in the target graph where the X value of the ith row is maximum is +.>Record startx= = ->Recording two-dimensional array dp [ i ]][j]=1, in two-dimensional array dp [ i ]][j]The value of (2) is the side length, square is selected from the upper right square, and whether the square is positioned in the target graph is judged;
if the square is positioned in the target graph, judging whether the value of the two-dimensional array dp [ i ] [ j ] is larger than the value of the larget, if so, giving the value of dp [ i ] [ j ] to the larget, storing the larget, and updating the coordinate of the vertex E, F, G, H; if the value of dp [ i ] [ j ] is not greater than the value of the larget, reserving the coordinates of the current larget and E, F, G, H vertexes; meanwhile, recording the two-dimensional array dp [ i ] [ j ] =dp [ i ] +1, continuing to take the value of the two-dimensional array dp [ i ] [ j ] as the side length, selecting a square from the upper right square, and judging whether the square is positioned in the target graph;
if the square is not inside the target graph, then startx=+1, recording two-dimensional array dp [ i ]][j]=1, in two-dimensional array dp [ i ]][j]The value of (2) is the side length, square is selected from the upper right square, and whether the square is positioned in the target graph is judged;
when startx=When the i-th row is traversed, starting traversing the i+1th row;
until the cycle traversal of each point inside the target graph is finished, the value of largest, startX, endX, startY, endY is determined, and therefore the side length and the coordinate position of the maximum inscribed square are determined.
Preferably, the calculating the maximum inscribed square inside the target graph according to all the points inside the target graph comprises the following specific steps:
setting the minimum Y value point of the jth column in the target graph asThe point in the target graph where the j-th column Y value is maximum is +.>Record starty= = ->Recording two-dimensional array dp [ i ]][j]=1, in two-dimensional array dp [ i ]][j]The value of (2) is the side length, square is selected from the upper right square, and whether the square is positioned in the target graph is judged;
if the square is positioned in the target graph, judging whether the value of the two-dimensional array dp [ i ] [ j ] is larger than the value of the larget, if so, giving the value of dp [ i ] [ j ] to the larget, storing the larget, and updating the coordinate of the vertex E, F, G, H; if the value of dp [ i ] [ j ] is not greater than the value of the larget, reserving the coordinates of the current larget and E, F, G, H vertexes; meanwhile, recording the two-dimensional array dp [ i ] [ j ] =dp [ i ] +1, continuing to take the value of the two-dimensional array dp [ i ] [ j ] as the side length, selecting a square from the upper right square, and judging whether the square is positioned in the target graph;
if the square is not inside the target graph, then record starty=+1, recording two-dimensional array dp [ i ]][j]=1, in two-dimensional array dp [ i ]][j]The value of (2) is the side length, square is selected from the upper right square, and whether the square is positioned in the target graph is judged;
when starty=When the traversal of the j-th column is finished, starting to traverse the j+1th column;
until the cycle traversal of each point inside the target graph is finished, the final largest, startX, endX, startY, endY value is determined, and therefore the side length and the coordinate position of the maximum inscribed square are determined.
Another object of the present invention is to provide an apparatus for confirming a marking position, comprising:
the auxiliary module is used for determining the size of an auxiliary rectangle enveloping the outer contour line of the target graph;
the marking module is used for dividing grid cells of the auxiliary rectangle according to the set precision and marking points on the grid;
the judging module is used for judging whether the points on the grid in the auxiliary rectangle are inside the target graph or not and marking all the points inside the target graph;
the calculation module is used for calculating the maximum inscribed square inside the target graph according to all the points inside the target graph;
the positioning module is used for determining a central point O ((startX+endX)/2, (startY+endY)/2) of the maximum inscribed square according to the determined coordinate position of the maximum inscribed square;
the adding module is used for adding marking information in the maximum inscribed square in the target graph, the center of the marking information is positioned at the center point O of the maximum inscribed square in the target graph, and the size of the marking information is matched with the side length of the corresponding maximum inscribed square.
The beneficial effects of the invention are as follows: according to the method and the device for confirming the marking position, the maximum size of the marking area and the position of the marking area are confirmed by calculating the maximum inscribed square of the internal area of the target graph, and the center position of marking information is further confirmed by confirming the center point of the maximum inscribed square, so that the marking area and the position are more reasonable, and the improvement of the marking anti-counterfeiting effect is facilitated.
Secondly, the sizes of the marking characters, the marking patterns and the marking trademarks are automatically adjusted according to the size of the maximum inscribed square, so that the sizes of the marking characters, the marking patterns and the marking trademarks are matched with the size of the maximum marking area, the actual requirements are met, and the marking effect can be improved.
In addition, according to the actual condition of the target pattern, when the target pattern has an inner hole, the position and the size of the inner hole of the closed pattern can be determined, the position of the inner hole is considered during marking, marking information and the edge of the inner hole are prevented from being interfered, and marking effect is prevented from being influenced.
Drawings
The accompanying drawings are included to provide a further understanding of the invention and are incorporated in and constitute a part of this specification, illustrate the invention and together with the embodiments of the invention, serve to explain the invention. In the drawings:
FIG. 1 is a flow chart of the present invention;
FIG. 2 is a schematic diagram of a grid cell in step two of the first embodiment of the present invention;
FIG. 3 is a schematic diagram of a grid cell in step three in accordance with an embodiment of the present invention;
FIG. 4 is a schematic diagram of the largest inscribed square in step four in the first embodiment of the present invention;
FIG. 5 is a schematic diagram of the marking information in step six in the first embodiment of the present invention;
FIG. 6 is a schematic diagram of a grid cell in step two of the second embodiment of the present invention;
FIG. 7 is a schematic diagram of a grid cell in step three in a second embodiment of the present invention;
FIG. 8 is a schematic diagram of the largest inscribed square in step four in the second embodiment of the present invention;
FIG. 9 is a diagram of a second embodiment of the present invention in which information is marked in step six;
fig. 10 is a schematic diagram of a line-by-line traversal process in accordance with an embodiment of the invention.
Detailed Description
Example 1
As shown in fig. 1 to 5, a method for confirming a marking position includes the steps of:
step one: an auxiliary rectangle size that envelopes the object graph outline is determined. The target pattern is a pattern surrounded by a closed outer contour line.
Specifically, the specific steps of determining the auxiliary rectangle size of the outer contour line of the enveloping target graph are as follows: and traversing coordinates of each point in the outline of the target graph, and determining the minimum X coordinate Xmin, the maximum X coordinate Xmax, the minimum Y coordinate Ymin and the maximum Y coordinate Ymax of the coordinates of each point in the outline of the graph, thereby determining vertex coordinates of the auxiliary rectangle as A (Xmin, ymin), B (Xmin, ymax), C (Xmax, ymin) and D (Xmax, ymax).
Step two: the auxiliary rectangle is divided into grid units according to the set precision and points on the grid are marked. The method comprises the following specific steps: after setting the required precision, the points on the grid are marked by a two-dimensional array or matrix. The setting precision can adjust the size of the grid unit and control the distance between each point on the grid.
Taking the example of marking the points on the grid through a two-dimensional array, marking the points on the grid through a two-dimensional array A [ r ] [ c ], wherein the parameters of the grid unit comprise grid length L and grid width W, the number r of the grid unit is (Ymax-Ymin)/W, the number c of the grid unit is (Xmax-Xmin)/L, and the maximum inscribed square inside the target graph is required to be found, so that the numerical value settings of the grid length L and the grid width W are equal, and the side length of the maximum inscribed square inside the target graph is conveniently determined through the grid side length.
Step three: and judging whether the points on the grids in the auxiliary rectangle are inside the target graph or not, and marking all the points inside the target graph. Specifically, whether the points represented by the two-dimensional array A [ r ] [ c ] are inside the outer contour line or not is judged through traversal of an extraction line method, and the points located inside the outer contour line are marked through the two-dimensional array B [ r ] [ c ].
Judging whether the target point is in the target graph, starting from the target point, guiding a ray, calculating the number of intersection points of the ray and all sides of the target graph, if the intersection points are odd, indicating that the target point is in the target graph, and if the intersection points are even, indicating that the target point is outside the target graph.
In addition, the target point can be judged by methods such as an area and judging method, an included angle and judging method, and whether the point is in the target graph or not can be judged.
Step four: and calculating the maximum inscribed square inside the target graph according to all the points inside the target graph.
The method specifically comprises the following steps: firstly, defining a variable largest, startX, endX, startY, endY, wherein the larget is the side length of the maximum inscribed square, and the initial value of the variable larget is 0; e (startX, startY), F (startX, endY), G (endX, startY), H (endX, endY) are the positions of the four vertices of the largest inscribed square, and the position and size of the largest inscribed square can be determined by determining the value of the variable startX, endX, startY, endY.
Secondly, defining a two-dimensional array dp [ i ] [ j ] for recording the side length of the inscribed square;
then traversing row by row or column by column in turn, determining dp [ i ] [ j ] of each point in the target graph, comparing with the larget, if the value of dp [ i ] [ j ] is larger than the value of larget, giving the value of dp [ i ] [ j ] to the larget, storing the larget, and updating the coordinate of the E, F, G, H vertex; if the value of dp [ i ] [ j ] is not greater than the value of larget, then the coordinates of the current larget and E, F, G, H vertices are preserved.
Taking a row-by-row traversal as an example:
setting the point with the smallest X value of the ith row in the target graph as the following traversal from bottom to top and from left to rightThe point in the target graph where the X value of the ith row is maximum is +.>Record startx= = ->Recording two-dimensional array dp [ i ]][j]=1, in two-dimensional array dp [ i ]][j]The value of (2) is the side length, square is selected to the upper right square, and whether the square is positioned in the target graph is judged, namely whether each point in the square is positioned in a two-dimensional array B [ r ]][c]And (3) inner part.
If the square is positioned in the target graph, judging whether the value of the two-dimensional array dp [ i ] [ j ] is larger than the value of the larget, if so, giving the value of dp [ i ] [ j ] to the larget, storing the larget, and updating the coordinate of the vertex E, F, G, H; if the value of dp [ i ] [ j ] is not greater than the value of the larget, reserving the coordinates of the current larget and E, F, G, H vertexes; meanwhile, the two-dimensional array dp [ i ] [ j ] =dp [ i ] [ j ] +1 is recorded, the value of the two-dimensional array dp [ i ] [ j ] is taken as the side length, a square is selected from the upper right square frame, and whether the square is positioned in the target graph is judged.
If the square is not inside the target graph, then startx=+1, recording two-dimensional array dp [ i ]][j]=1, in two-dimensional array dp [ i ]][j]And (3) selecting a square from the upper right square frame, and judging whether the square is positioned in the target graph or not.
Repeating the above operation when startx=When the i-th line is traversed, the i+1th line is traversed.
And traversing row by row until the circulation traversing of each point in the target graph is finished, and determining the final largest, startX, endX, startY, endY value.
Specifically, as shown in fig. 10, the enclosed pattern of the enclosed outline is a target pattern, the auxiliary rectangle encapsulates the target pattern, the points in the auxiliary rectangle are located in the two-dimensional array A [ r ] [ c ], and the points in the target pattern are represented by the hollow points, namely, the hollow points are located in the two-dimensional array B [ r ] [ c ].
Performing a row-by-row traversal from bottom to top and from left to right, performing a first row traversal with the dots of the first rowThe traversal is started.
First, record two-dimensional array dp [ i ]][j]=1, square is selected with 1 grid width at side length to upper right square frame to obtain rectangular structure as shown in fig. 10 (1), at this time, it is necessary to determine whether the points on the rectangular structure are all inside the target graph, and since the points on the rectangular structure as shown in fig. 10 (1) are all inside the target graph, dp [ i ] is compared][j]Value size of 1 and current larget, since the larget initial value is 0, pointDp [ i ] of (2)][j]A value greater than the current larget, record larsget=1, updating vertex coordinates of E (startX, startY), F (startX, endY), G (endX, startY), H (endX, endY).
Due to the dotsThe points on the rectangular structure selected by the current frame are all in the target graph, so that dp [ i ] is achieved][j]=dp[i][j]+1, square is boxed right up with a side length of 2 grid widths, a rectangular structure as shown in (2) in FIG. 10 is obtained, at this time, it is judged that there is a point outside the target pattern at the point on the rectangular structure, and thus the end point ∈>Is used for traversing.
In dotsFor the target point, the largest square framed in the target graph is a rectangular structure as shown in fig. 10 (1), where the value of the larget is 1 and the vertex coordinates are the coordinates of the rectangular structure in fig. 10 (1).
When the point isAfter the traversal is finished, start point->Traversal of +1, similarly, record two-dimensional array dp [ i ]][j]=1, square is square-framed right up with a side length of 1 grid width, and a rectangular structure as shown in (3) in 10 is obtained at this time, and at this time, it is judged that there is a point located outside the target pattern at the point on the rectangular structure, so the end point ∈>Traversal of +1, where the value of larget is 1, the vertex coordinates are the coordinates of the rectangular structure in fig. 10 (1).
Since the first line has only two points located in the target graph, the second line is traversed after the two points of the first line are traversed, and the second line is traversed by the points of the second lineThe traversal is started.
And (2) marking a two-dimensional array dp [ i ] [ j ] =1, and selecting a square with a side length of 1 grid width to an upper right square frame to obtain a rectangular structure shown in (4) in fig. 10, comparing the value of dp [ i ] [ j ] =1 with the value of the current larget because each point on the rectangular structure shown in (4) in fig. 10 is in the target graph, and reserving the value of the current larget and the vertex coordinates in (1) in fig. 10 because the value of dp [ i ] [ j ] is the same as the value of the current larget.
Due to the dotsThe points on the rectangular structure selected by the current frame are all in the target graph, so that dp [ i ] is achieved][j]=dp[i][j]+1, square is selected to the right upper square frame by the grid width with the side length of 2, and the rectangular structure shown in (5) in fig. 10 is obtained, and since each point on the rectangular structure shown in (5) in fig. 10 is in the target graph, dp [ i ] is compared][j]Value size of =2 and current larget, due to dp [ i ]][j]Greater than the current value of larget, let larget = 2 and update the vertex coordinates to the vertex of (5) in fig. 10.
Due to the dotsThe points on the rectangular structure selected by the current frame are all in the target graph, so that dp [ i ] is achieved][j]=dp[i][j]+1, square is boxed right up with a side length of 3 mesh widths, to obtain a rectangular structure as shown in (6) of FIG. 10, ending point +.>The value of the larget is 2 at this time, and the vertex coordinates are the coordinates of the rectangular structure in fig. 10 (5).
Starting pointTraversing +1 square is boxed right up with a side length of 1 grid width, resulting in a rectangular structure as shown in (7) of FIG. 10, due to the rectangular junctions shown in (7) of FIG. 10Each point on the structure is in the target graph, and the dp [ i ] is compared][j]Value size of =1 and current larget, due to dp [ i ]][j]Less than the current value of larget, then the value of larget=2 and the vertex coordinates of (5) in fig. 10 are preserved.
Then square is boxed right up with a side length of 2 grid widths to obtain a rectangular structure as shown in (8) in fig. 10, and the points on the rectangular structure are points outside the target graph, so that the points are endedTraversal of +1, start point +.>And (2) traversing, and square selection is performed by a square frame with a side length of 1 grid width to the right upper frame, so as to obtain a rectangular structure shown in (9) in fig. 10.
And the like until all the points in the target graph are traversed, and finally determining the size and the position of the largest inscribed square selected by the frame, thereby further confirming the marking position and the marking size.
Further, taking a column-wise traversal as an example:
setting the minimum Y value point of the jth column in the target graph asThe point in the target graph where the j-th column Y value is maximum is +.>Record starty= = ->Recording two-dimensional array dp [ i ]][j]=1, in two-dimensional array dp [ i ]][j]The value of (2) is the side length, square is selected from the upper right square, and whether the square is positioned in the target graph is judged;
if the square is positioned in the target graph, judging whether the value of the two-dimensional array dp [ i ] [ j ] is larger than the value of the larget, if so, giving the value of dp [ i ] [ j ] to the larget, storing the larget, and updating the coordinate of the vertex E, F, G, H; if the value of dp [ i ] [ j ] is not greater than the value of the larget, reserving the coordinates of the current larget and E, F, G, H vertexes; meanwhile, recording the two-dimensional array dp [ i ] [ j ] =dp [ i ] +1, continuing to take the value of the two-dimensional array dp [ i ] [ j ] as the side length, selecting a square from the upper right square, and judging whether the square is positioned in the target graph;
if the square is not inside the target graph, then record starty=+1, recording two-dimensional array dp [ i ]][j]=1, in two-dimensional array dp [ i ]][j]The value of (2) is the side length, square is selected from the upper right square, and whether the square is positioned in the target graph is judged;
when starty=When the traversal of the j-th column is finished, starting to traverse the j+1th column;
until the cycle traversal of each point inside the target graph is finished, the final largest, startX, endX, startY, endY value is determined, and therefore the side length and the coordinate position of the maximum inscribed square are determined.
It should be noted that: traversing line by line, namely traversing line by line from bottom to top and from right to left, wherein a rectangular structure needs to be selected for the upper left square frame of the target point; traversing line by line, namely traversing line by line from top to bottom and from left to right, wherein a rectangular structure needs to be selected for a lower right square frame of a target point; a row-by-row traversal may be provided from top to bottom and right to left, where a rectangular structure needs to be selected for the bottom left box of the target point. The specific process is the same as the above-mentioned line-by-line traversal process, and will not be described here.
Traversing column by column, namely traversing column by column from left to right and from top to bottom, wherein a rectangular structure needs to be selected for a lower right square frame of a target point; traversing column by column, namely traversing column by column from right to left and from bottom to top, wherein a rectangular structure needs to be selected for the upper left square frame of the target point; column-wise traversal may be set from right to left and top to bottom, where a rectangular structure needs to be selected for the bottom left box of the target point. The specific process is the same as the above-mentioned column-by-column traversal process, and will not be described here.
Step five: the center point O ((startx+endx)/2, (starty+endy)/2) of the largest inscribed square is determined from the determined coordinate position. The center of the marking characters is arranged at the center point O of the maximum inscribed square, so that marking information is positioned at the center of the maximum inscribed square, and interference between the marking information and an inner hole or an outer contour is avoided, and the marking information is not clear.
Step six: marking information is added in the largest inscribed square in the target graph. Furthermore, the size of the marking information is in direct proportion to the side length of the corresponding maximum inscribed square, and the size of the marking information can be adaptively adjusted according to the determined side length of the maximum inscribed square, so that the marking information is more suitable for the size and the proportion of the target graph.
The marking information comprises marking characters, marking patterns and marking trademarks, the characters, the patterns and the trademarks mainly play a role in marking anti-counterfeiting, and the characters, the patterns and the trademarks can be selected according to actual demands.
Example two
As shown in fig. 1, 6 to 9, the structure of the present embodiment is substantially the same as that of the first embodiment, except that: the target pattern of this embodiment includes a closed outer contour and a plurality of closed inner contours, the inner contours being located in the pattern enclosed by the outer contours.
Compared with the specific operation of the third step in the first embodiment, the method in this embodiment determines whether the points on the grid in the auxiliary rectangle are inside the target graph, and marks all the points inside the target graph, and specifically includes the following steps: and traversing and judging whether the points represented by the two-dimensional array A [ r ] [ c ] are inside the outer contour and outside the inner contour by using an ignition method, and marking the points positioned inside the outer contour and outside the inner contour by using the two-dimensional array B [ r ] [ c ].
Example III
In a second aspect of the present invention, a device for confirming a marking position is provided, including an auxiliary module, a marking module, a judging module, a calculating module, a positioning module and an adding module. The auxiliary module is used for determining the auxiliary rectangle size of the outer contour line of the enveloping target graph; the marking module is used for dividing grid cells of the auxiliary rectangle according to the set precision and marking points on the grid; the judging module is used for judging whether the points on the grid in the auxiliary rectangle are inside the target graph or not and marking all the points inside the target graph; the calculation module is used for calculating the maximum inscribed square inside the target graph according to all the points inside the target graph; the positioning module is used for determining a center point O ((startX+endX)/2, (startY+endY)/2) of the maximum inscribed square according to the determined coordinate position of the maximum inscribed square; the adding module is used for adding marking information in the maximum inscribed square in the target graph, the center of the marking information is positioned at the center point O of the maximum inscribed square in the target graph, and the size of the marking information is matched with the side length of the corresponding maximum inscribed square.
The foregoing description is only a preferred embodiment of the present invention, and the present invention is not limited thereto, but it is to be understood that modifications and equivalents of some of the technical features described in the foregoing embodiments may be made by those skilled in the art, although the present invention has been described in detail with reference to the foregoing embodiments. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (9)

1. A method of identifying a marking location, comprising the steps of:
determining the auxiliary rectangle size of the outer contour line of the enveloping target graph; the target graph is a graph surrounded by a closed outer contour line or comprises a closed outer contour line and a plurality of closed inner contour lines, and the inner contour lines are positioned in the graph surrounded by the outer contour lines;
dividing grid units of the auxiliary rectangle according to the set precision and marking points on the grid;
judging whether the points on the grids in the auxiliary rectangle are inside the target graph or not, and marking all the points inside the target graph;
calculating the maximum inscribed square inside the target graph according to all the points inside the target graph;
determining a central point O ((startX+endX)/2, (startY+endY)/2) of the maximum inscribed square according to the determined coordinate position of the maximum inscribed square;
adding marking information into the maximum inscribed square in the target graph, wherein the center of the marking information is positioned at the center point O of the maximum inscribed square in the target graph, and the size of the marking information is matched with the side length of the corresponding maximum inscribed square;
the method for calculating the maximum inscribed square inside the target graph comprises the following steps: defining a variable largest, startX, endX, startY, endY, wherein larget is the side length of the maximum inscribed square, and E (startX, startY), F (startX, endY), G (endX, startY), H (endX, endY) are the coordinate positions of four vertexes of the maximum inscribed square;
defining two-dimensional array dp [ i ] [ j ] for recording side length of inscribed square;
traversing row by row or column by column in turn, determining dp [ i ] [ j ] of each point in the target graph, comparing the dp [ i ] [ j ] with the larget, if the value of dp [ i ] [ j ] is larger than the value of the larget, giving the value of dp [ i ] [ j ] to the larget, storing the larget, and updating the coordinate of the E, F, G, H vertex; if the value of dp [ i ] [ j ] is not greater than the value of the larget, reserving the coordinates of the current larget and E, F, G, H vertexes;
after the traversal is finished, determining a variable largest, startX, endX, startY, endY, so as to determine the side length and the coordinate position of the maximum inscribed square;
when the target graph comprises a closed outer contour line and a plurality of closed inner contour lines, the inner contour lines are positioned in the graph surrounded by the outer contour lines, whether points represented by the two-dimensional array A [ r ] [ c ] are positioned inside the outer contour lines and outside the inner contour lines or not is judged through traversal of an induced ray method, and the points positioned inside the outer contour lines and outside the inner contour lines are marked through the two-dimensional array B [ r ] [ c ].
2. The method of determining the location of a marking of claim 1, wherein the target graphic includes a closed outer contour and a plurality of closed inner contours, the inner contours being located in a graphic enclosed by the outer contour.
3. The method for confirming a marking location according to claim 1 or 2, wherein the specific step of determining the auxiliary rectangle size of the envelope object figure outline is: and traversing the coordinates of each point in the outer contour line of the target graph, and determining the minimum X coordinate Xmin, the maximum X coordinate Xmax, the minimum Y coordinate Ymin and the maximum Y coordinate Ymax of the coordinates of each point in the outer contour line of the target graph, thereby determining the vertex coordinates of the auxiliary rectangle as A (Xmin, ymin), B (Xmin, ymax), C (Xmax, ymin) and D (Xmax, ymax).
4. A method of confirming a marking position according to claim 1 or 2, wherein the dividing of the auxiliary rectangle into grid cells and marking points on the grid according to the set accuracy comprises the steps of: after setting the required precision, the points on the grid are marked by a two-dimensional array or matrix.
5. The method of determining a marking location of claim 4, wherein marking the points on the grid by a two-dimensional array comprises the steps of: and recording a two-dimensional array A [ r ] [ c ] for marking points on a grid, wherein the parameters of the grid unit comprise grid length L and grid width W, the number r of the grid unit is (Ymax-Ymin)/W, the number c of the grid unit is (Xmax-Xmin)/L, and the numerical values of the grid length L and the grid width W are equal.
6. The method of confirming a marking position according to claim 5, wherein when the target pattern is a pattern enclosed by a closed outer contour, it is judged by an indexing method that whether the point represented by the two-dimensional array ar [ c ] is inside the outer contour and the point located inside the outer contour is marked by the two-dimensional array B [ r ] [ c ].
7. The method for confirming a marking position according to claim 1 or 2, wherein the calculating the maximum inscribed square inside the target pattern based on all the points inside the target pattern comprises the following steps:
setting the point with the smallest X value of the ith row in the target graph as the following traversal from bottom to top and from left to rightThe point in the target graph where the X value of the ith row is maximum is +.>Record startx= = ->Recording two-dimensional array dp [ i ]][j]=1, in two-dimensional array dp [ i ]][j]The value of (2) is the side length, square is selected from the upper right square, and whether the square is positioned in the target graph is judged;
if the square is positioned in the target graph, judging whether the value of the two-dimensional array dp [ i ] [ j ] is larger than the value of the larget, if so, giving the value of dp [ i ] [ j ] to the larget, storing the larget, and updating the coordinate of the vertex E, F, G, H; if the value of dp [ i ] [ j ] is not greater than the value of the larget, reserving the coordinates of the current larget and E, F, G, H vertexes; meanwhile, recording the two-dimensional array dp [ i ] [ j ] =dp [ i ] +1, continuing to take the value of the two-dimensional array dp [ i ] [ j ] as the side length, selecting a square from the upper right square, and judging whether the square is positioned in the target graph;
if the square is not inside the target graph, then startx=+1, recording two-dimensional array dp [ i ]][j]=1, in two-dimensional array dp [ i ]][j]The value of (2) is the side length, square is selected from the upper right square, and whether the square is positioned in the target graph is judged;
when startx=When the i-th row is traversed, starting traversing the i+1th row;
until the cycle traversal of each point inside the target graph is finished, the value of largest, startX, endX, startY, endY is determined, and therefore the side length and the coordinate position of the maximum inscribed square are determined.
8. The method for confirming a marking position according to claim 1 or 2, wherein the calculating the maximum inscribed square inside the target pattern based on all the points inside the target pattern comprises the following steps:
setting the minimum Y value point of the jth column in the target graph asThe point in the target graph where the j-th column Y value is maximum is +.>Record starty= = ->Recording two-dimensional array dp [ i ]][j]=1, in two-dimensional array dp [ i ]][j]The value of (2) is the side length, square is selected from the upper right square, and whether the square is positioned in the target graph is judged;
if the square is positioned in the target graph, judging whether the value of the two-dimensional array dp [ i ] [ j ] is larger than the value of the larget, if so, giving the value of dp [ i ] [ j ] to the larget, storing the larget, and updating the coordinate of the vertex E, F, G, H; if the value of dp [ i ] [ j ] is not greater than the value of the larget, reserving the coordinates of the current larget and E, F, G, H vertexes; meanwhile, recording the two-dimensional array dp [ i ] [ j ] =dp [ i ] +1, continuing to take the value of the two-dimensional array dp [ i ] [ j ] as the side length, selecting a square from the upper right square, and judging whether the square is positioned in the target graph;
if the square is not inside the target graph, then record starty=+1, recording two-dimensional array dp [ i ]][j]=1, in two-dimensional array dp [ i ]][j]The value of (2) is the side length, upward rightSquare is selected by the square box, and whether the square is positioned in the target graph is judged;
when starty=When the traversal of the j-th column is finished, starting to traverse the j+1th column;
until the cycle traversal of each point inside the target graph is finished, the final largest, startX, endX, startY, endY value is determined, and therefore the side length and the coordinate position of the maximum inscribed square are determined.
9. An apparatus for confirming a marking location, comprising:
the auxiliary module is used for determining the size of an auxiliary rectangle enveloping the outer contour line of the target graph;
the marking module is used for dividing grid cells of the auxiliary rectangle according to the set precision and marking points on the grid;
the judging module is used for judging whether the points on the grid in the auxiliary rectangle are inside the target graph or not and marking all the points inside the target graph;
the calculation module is used for calculating the maximum inscribed square inside the target graph according to all the points inside the target graph;
the positioning module is used for determining a central point O ((startX+endX)/2, (startY+endY)/2) of the maximum inscribed square according to the determined coordinate position of the maximum inscribed square;
the adding module is used for adding marking information in the maximum inscribed square in the target graph, the center of the marking information is positioned at the center point O of the maximum inscribed square in the target graph, and the size of the marking information is matched with the side length of the corresponding maximum inscribed square.
CN202410181820.9A 2024-02-19 2024-02-19 Method and device for confirming marking position Active CN117745807B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410181820.9A CN117745807B (en) 2024-02-19 2024-02-19 Method and device for confirming marking position

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410181820.9A CN117745807B (en) 2024-02-19 2024-02-19 Method and device for confirming marking position

Publications (2)

Publication Number Publication Date
CN117745807A true CN117745807A (en) 2024-03-22
CN117745807B CN117745807B (en) 2024-04-26

Family

ID=90277630

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410181820.9A Active CN117745807B (en) 2024-02-19 2024-02-19 Method and device for confirming marking position

Country Status (1)

Country Link
CN (1) CN117745807B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH05225326A (en) * 1992-01-13 1993-09-03 Nec Corp Graphic skeleton detection method and device
CN108520121A (en) * 2018-03-27 2018-09-11 信利半导体有限公司 Lattice generation method and device and computer installation and readable storage medium storing program for executing
CN110968112A (en) * 2019-12-12 2020-04-07 哈尔滨工程大学 Unmanned aerial vehicle autonomous landing system and method based on monocular vision
CN115631347A (en) * 2022-12-21 2023-01-20 济南邦德激光股份有限公司 Plate stock layout method, equipment and storage medium
CN116050123A (en) * 2023-01-07 2023-05-02 中国航空制造技术研究院 Method for processing position of web mark and computer readable storage medium
CN116090126A (en) * 2023-01-06 2023-05-09 西北工业大学 DXF-based complex sheet contour topology reconstruction method

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH05225326A (en) * 1992-01-13 1993-09-03 Nec Corp Graphic skeleton detection method and device
CN108520121A (en) * 2018-03-27 2018-09-11 信利半导体有限公司 Lattice generation method and device and computer installation and readable storage medium storing program for executing
CN110968112A (en) * 2019-12-12 2020-04-07 哈尔滨工程大学 Unmanned aerial vehicle autonomous landing system and method based on monocular vision
CN115631347A (en) * 2022-12-21 2023-01-20 济南邦德激光股份有限公司 Plate stock layout method, equipment and storage medium
CN116090126A (en) * 2023-01-06 2023-05-09 西北工业大学 DXF-based complex sheet contour topology reconstruction method
CN116050123A (en) * 2023-01-07 2023-05-02 中国航空制造技术研究院 Method for processing position of web mark and computer readable storage medium

Also Published As

Publication number Publication date
CN117745807B (en) 2024-04-26

Similar Documents

Publication Publication Date Title
Anderson Detecting and eliminating collisions in NC machining
JP3010293B1 (en) Method of forming two-dimensional code
CN102423831B (en) Mould cavity curved surface texture etching method and device
EP1901059B1 (en) Method for forming master data for inspecting protruding and recessed figure
CN108817695A (en) Laser cutting method, device and digital control system
JP2009524862A (en) Cutting method for parts assembly
PT1663567E (en) Method and device for removing material from a three-dimensional surface in a multi-layered manner by means of a laser, using a polygon network which is described by a mathematical function and represents the surface
CN117745807B (en) Method and device for confirming marking position
CN114022370B (en) Galvanometer laser processing distortion correction method and system
CN107914397A (en) A kind of 3D objects determine area's Method of printing and system
CN115555648A (en) Numerical control cutting method, system, equipment and medium
CN1088869C (en) Character processing apparatus and character processing method
JP3421995B2 (en) Method related to numerical controller
CN112809191A (en) Laser marking method and device and computer readable storage medium
CN115213737A (en) Material increase and decrease manufacturing cutter interference detection method based on minimum process decomposition times
CN115870629A (en) Laser lettering method, device, equipment and medium for single-line font
CN115194555A (en) Method for carving along with randomly placed workpiece directions
US7933675B2 (en) Machining apparatus for drilling printed circuit board
JPH04339581A (en) Laser marking device
JPH03166039A (en) Method and device for deciding method of machining inner diameter in function of generating information on numerical control
JP4454264B2 (en) Two-dimensional code forming method and two-dimensional code forming apparatus
CN114111613B (en) Method for measuring electron beam spot deformation of electron beam selective melting technology
CN109918750A (en) A kind of full-automatic modeling method of the erosion of the accurate control points on H profile steel column range
CN101916318A (en) Scale value outline overstriking drawing method of sign plate
JPH03288197A (en) Character processor

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