A method, device and equipment for generating a security pattern based on graphic filling
By generating anti-counterfeiting background patterns based on graphic filling, and using the closed areas formed by the intersection of curves to deform and fill the graphic elements, the problem of existing anti-counterfeiting background patterns being easily scanned or copied is solved, achieving a more efficient anti-counterfeiting effect.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- XIAMEN UNIV MALAYSIA BRANCH
- Filing Date
- 2026-04-30
- Publication Date
- 2026-06-26
Smart Images

Figure CN122289417A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to a method, apparatus and equipment for generating anti-counterfeiting background patterns based on graphic filling. Background Technology
[0002] Anti-counterfeiting backgrounds are widely used in printing, documents, invoices, certificates, and other fields. However, existing anti-counterfeiting backgrounds, such as mosaic images or other images, can be decoded by scanning or photographing, thus reducing their anti-counterfeiting effectiveness. Summary of the Invention
[0003] This invention provides a method, apparatus, and device for generating anti-counterfeiting background patterns based on graphic filling. It can generate anti-counterfeiting background patterns through graphic deformation, which are anti-scanning, anti-copying, anti-reproduction, and difficult to counterfeit, thereby improving anti-counterfeiting performance.
[0004] To solve the above-mentioned technical problems, the technical solution of the present invention is as follows: A method for generating anti-counterfeiting background patterns based on graphic filling, comprising: Obtain the target primitive and two sets of intersecting lines. Each set of intersecting lines includes a horizontal line and a vertical line. Both the horizontal and vertical lines are curves. Each curve includes multiple straight line segments and / or curved segments connected end to end. Based on the intersection points between the intersecting lines, the target enclosed area formed by the two sets of intersecting lines is determined. Determine the path of the target enclosed area based on the trajectory of the target enclosed area; Based on the path of the target enclosed region, each point in the target primitive is mapped to the target position of the target enclosed region to obtain the coordinates of the mapped point after the target primitive is deformed; Based on the coordinates of the mapping point corresponding to each point in the target primitive, the anti-counterfeiting background pattern filled by the deformed target primitive is obtained, and the minimum bounding box of the deformed target primitive is the path of the target closed region.
[0005] Optionally, based on the intersection points between the intersecting wires, the target enclosed area formed by the two sets of intersecting wires is determined, including: Iterate through each straight line or curved line in the intersecting cabling; Determine the intersection point of any two straight or curved segments between the cabling; When any one of the intersecting horizontal lines intersects with both of the other two vertical lines, the two sets of intersecting lines are determined to form a target closed area, and the four anchor points of the target closed area are the intersection points between the intersecting lines.
[0006] Optionally, determine the intersection point of any two straight or curved segments between the cabling sections, including: When the two line segments between the ribbon cables are straight line segments, establish the equations of the two straight line segments respectively; establish a system of equations based on the equations of the two straight line segments, solve the system of equations, and obtain the intersection point of the two straight line segments; When one line segment between the lines is a straight line segment and the other is a curved line segment, establish the straight line equation and the curve matrix respectively; construct the target polynomial equation based on the straight line equation and the curve matrix; solve the roots of the target polynomial equation to obtain the intersection point of the straight line segment and the curved line segment; When the two line segments between the ribbon cables are curved segments, the intersection point of the two curved segments can be obtained by the intersection point of the tangents of the two curved segments and the other curved segment.
[0007] Optionally, when the two line segments between the cabling are curved segments, the intersection point of the two curved segments is obtained based on the intersection point of the tangents of the two curved segments and the other curved segment, including: When the two line segments between the ribbon cables are curved segments, respectively establish the curve matrices of the first and second curved segments; The coordinates of multiple points on the lines uniformly inserted in the first curve segment are obtained based on the curve matrix. Traverse each point on the first curve segment, determine the first intersection point of the tangent line of the first curve segment and the second intersection point of the tangent line of the first intersection point and the first curve segment; The intersection point of the two curve segments is obtained based on the distance between the first intersection point and the second intersection point.
[0008] Optionally, determining the path of the target enclosed region based on its trajectory includes: Based on the trajectory of the target enclosed region, determine the curve segments located between the intersection points within the target enclosed region; The coordinates of the points on the curve segment and the control points are determined based on the intersection points. The path to the target enclosed area is obtained based on the coordinates of the points on the curve segment and the control points.
[0009] Optionally, based on the path of the target enclosed region, each point in the target primitive is mapped to the target position within the target enclosed region to obtain the mapped point coordinates after the target primitive is deformed, including: Map each point in the target primitive to the target closed region to obtain the points within the region corresponding to each point; Reverse the direction of some paths in the target closed region to obtain a set of line segments corresponding to each sub-path of the target closed region; Based on the set of line segments corresponding to each sub-path, determine the points on the line within each set of line segments; Based on the coordinates of the points on the line determined in each line segment set and the coordinates of the points in the region, the points in the region are mapped to the target position to obtain the coordinates of the mapped points after the target primitive is deformed.
[0010] Optionally, each point in the target primitive is mapped to the target enclosed region to obtain the points within the region corresponding to each point, including: Through formula Map each point in the target primitive to the closed region of the target to obtain the points within the region corresponding to each point. in, The x-coordinates of points within the region, The ordinates of points within the region, The x-coordinate of the point in the target primitive, The ordinate of the point in the target primitive, The left boundary of the path to the target closed region, The right boundary of the path to the target closed region, The upper boundary of the path to the target closed region, The lower boundary of the path to the target closed region.
[0011] Embodiments of the present invention also provide an apparatus for generating anti-counterfeiting background patterns based on graphic filling, comprising: The acquisition module is used to acquire the target graphic element and two sets of intersecting lines. Each set of intersecting lines includes a horizontal line and a vertical line. Both the horizontal and vertical lines are curves. Each curve includes multiple straight line segments and / or curved segments connected end to end. The processing module is used to determine the target closed area formed by the two sets of intersecting lines based on the intersection points between the lines; determine the path of the target closed area based on the trajectory of the target closed area; map each point in the target graphic element to the target position of the target closed area based on the path of the target closed area to obtain the coordinates of the mapped point after the target graphic element is deformed; and obtain the anti-counterfeiting background filled by the deformed target graphic element based on the coordinates of the mapped point corresponding to each point in the target graphic element, wherein the minimum bounding box of the deformed target graphic element is the path of the target closed area.
[0012] The present invention also provides a computing device, comprising: a processor and a memory storing a computer program, wherein the computer program, when executed by the processor, performs the method described above.
[0013] The present invention also provides a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the method described above.
[0014] The above-described solution of the present invention has at least the following beneficial effects: The above-mentioned solution of the present invention determines whether two horizontal lines and two vertical lines can form a closed area by finding the intersection of curves; then, the trajectory of the closed area is obtained by curve calculation, and the trajectory is used as the new bounding box of the graphic element; finally, the graphic element is twisted into the closed graphic frame by the envelope deformation method, thereby generating the anti-counterfeiting background filling the target graphic element. Since the deformation of the graphic involves the intersection of curve groups, the distortion of scanning and re-photographing is improved, thereby improving the anti-counterfeiting effect of the anti-counterfeiting background. Attached Figure Description
[0015] Figure 1 This is a flowchart illustrating the method for generating anti-counterfeiting background patterns based on graphic filling according to an embodiment of the present invention. Figure 2 This is a schematic diagram of the Bézier curve for generating anti-counterfeiting background patterns based on graphic filling, according to an embodiment of the present invention. Figure 3 This is a schematic diagram of the target closed area of the method for generating anti-counterfeiting background patterns based on graphic filling according to an embodiment of the present invention. Figure 4 This is a schematic diagram of the method for generating anti-counterfeiting background patterns based on graphic filling according to an embodiment of the present invention, after adding points to the Bézier curve; Figure 5 This is a schematic diagram of the line filling result of the method for generating anti-counterfeiting background patterns based on graphic filling according to an embodiment of the present invention; Figure 6 This is a structural diagram of the anti-counterfeiting background generation device based on graphic filling according to an embodiment of the present invention. Detailed Implementation
[0016] Exemplary embodiments of the invention will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this invention will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.
[0017] like Figure 1 As shown, an embodiment of the present invention proposes a method for generating anti-counterfeiting background patterns based on graphic filling, including: Step 11: Obtain the target graphic element and two sets of intersecting lines. Each set of intersecting lines includes a horizontal line and a vertical line. Both the horizontal and vertical lines are curves. Each curve includes multiple straight segments and / or curved segments connected end to end. Here, the target graphic element can be any type of shape to be filled; the two sets of intersecting lines are as follows: Figure 3 As shown, it includes two horizontal lines. and Two vertical lines and It should be noted that the curve segment described in this invention is a Bézier curve, which consists of two points on the line and two control points.
[0018] Step 12: Determine the target enclosed area formed by the two sets of intersecting wires based on the intersection points between the wires in the intersecting wires. Here, if the four curves can enclose a closed area, then any one horizontal curve will intersect with the other two vertical curves, and vice versa. Therefore, the intersection of the curves can be used to determine whether the intersecting curves have enclosed the target closed area.
[0019] Step 13: Determine the path of the target closed area based on the trajectory of the target closed area; Here, the path to the target closed area is obtained based on the determined intersection points. Starting from one of the intersection points, the coordinates of the points on the line and the coordinates of the control points of each straight line or curved line segment are determined in sequence.
[0020] Step 14: Based on the path of the target closed region, map each point in the target primitive to the target position of the target closed region to obtain the coordinates of the mapped point after the target primitive is deformed; Here, the target primitive is deformed by point mapping so that the deformed target primitive conforms to the shape of the hatching and fills the closed target area.
[0021] Step 15: Based on the coordinates of the mapping point corresponding to each point in the target primitive, obtain the anti-counterfeiting background filling of the deformed target primitive. The minimum bounding box of the deformed target primitive is the path of the target closed region.
[0022] In this embodiment, a set of target primitives and two sets of intersecting lines are input. A series of geometric transformations are used to distort the target primitives into the closed target area formed by the intersection of the lines. In the specific implementation process, firstly, the intersection points of the curves are used to determine whether two horizontal lines and two vertical lines can form a closed area; then, curve calculations are used to obtain the trajectory of the closed area, which serves as the new bounding box of the primitive; finally, the primitives are deformed to distort them into the target closed area, thereby generating an anti-scanning, anti-copying, anti-reproduction, and difficult-to-counterfeit anti-counterfeiting background.
[0023] In an optional embodiment of the present invention, step 12, determining the target enclosed area formed by the two sets of intersecting wires based on the intersection points between the wires in the intersecting wires, may include: Step 121: Traverse each straight line segment or curved line segment in each of the intersecting lines. Step 122: Determine the intersection point of any two straight or curved segments between the cabling; Step 123: When any one of the intersecting horizontal lines intersects with the other two vertical lines, the two sets of intersecting lines are determined to form a target closed area. The four anchor points of the target closed area are the intersection points between the intersecting lines.
[0024] In this embodiment, for the two horizontal cabling lines and Two vertical lines and If the four curves can enclose a closed region, then any horizontal cabochon will intersect with the other two vertical cabochons. Since the cabochon is a continuous curve and consists of a series of straight line segments and / or Bézier curve segments connected end to end, finding the intersection of the curves is transformed into finding the intersection of straight line segments or curve segments. The method is to traverse the straight line segments or curve segments on each cabochon and determine whether two line segments intersect.
[0025] In an optional embodiment of the present invention, step 122, determining the intersection point of any two straight or curved segments between the cabling segments, may include: Step 1221: When the two line segments between the wiring lines are straight line segments, establish the straight line equations of the two straight line segments respectively; establish a system of equations based on the straight line equations of the two straight line segments, solve the system of equations, and obtain the intersection point of the two straight line segments. Here, let the two line segments be respectively and The method to determine whether two line segments intersect is to rearrange the two line segments into the form shown in Equation 1, where a, b, and c are parameters: Formula 1 Solve the system of equations by combining the two equations.
[0026] If the system of equations has a root Explain the line segment and The lines intersect at .like If the two points are located between the two endpoints of a line segment, it means that the two line segments intersect.
[0027] Step 1222: When one line segment between the cabling is a straight line segment and the other line segment is a curved line segment, establish the straight line equation and the curve matrix respectively; Construct the objective polynomial equation based on the given linear equation and curve matrix; Solve for the roots of the target polynomial equation to obtain the intersection points of the line segment and the curve segment; Here, let a straight line segment be... The equation of the line it lies on is ,in , and For parameters.
[0028] Bézier curves, for example Figure 2 As shown, where , Let them be two points on the curve. , These are the two control points of the curve. Let be a point on the curve.
[0029] The curve matrix M is established using Equation 2 as shown below:
[0030] in: Formula 2 like Figure 2 As shown, there is a point on the curve. If the curve segment is known The length of the entire curve If the ratio of their lengths is t, then coordinates ( It can be calculated using Equation 3: Formula 3 Let vector = With the curve If the tangent vectors at a point have the same direction, then the vectors... It can be calculated using Equation 4: Formula 4 Therefore, to calculate the intersection point of the straight line segment and the curve, that is, to calculate the t value corresponding to the intersection point, the method is to first construct the coefficients using Equation 5. : Formula 5 when When there is an intersection with the curve segment, the proportionality coefficient t at the intersection is a root of the equation shown in Equation 6.
[0031] Formula 6 Solve equation 6 when there exists a root between [0,1]. When, it indicates that there is an intersection point between the line containing the line segment and the curve, then... Substituting into Equation 3, the coordinates of the intersection point can be obtained. If the intersection point Located on a straight segment If the two endpoints are between the line segment and the curve segment, it means that there is an intersection point between the line segment and the curve segment.
[0032] Step 1223: When the two line segments between the ribbon cables are curved segments, the intersection point of the two curved segments is obtained based on the intersection point of the tangents of the two curved segments and the other curved segment.
[0033] Specifically, step 1223 may include: Step 12231: When the two line segments between the ribbon cables are curved segments, establish the curve matrices of the first and second curved segments respectively. Here, let the two Bézier curves be the first curve segment. and the second curve segment The curve matrices constructed using Equation 2 are M1 and M2, respectively.
[0034] Step 12232: Obtain the coordinates of multiple points on the lines uniformly inserted in the first curve segment according to the curve matrix; Here, in the first curve segment N points are evenly inserted (e.g., N=20) to form a point array. Equation 3 can be used to calculate each insertion point in the point sequence. The coordinates; Step 12233: Traverse each point on the line in the first curve segment, determine the first intersection point of the tangent line of the first curve segment and the second intersection point of the tangent line of the first intersection point and the first curve segment. Here, for one of the insertion points The first curve segment can be obtained using Equation 4. lie in The direction vector of the tangent at that point .structure lie in Tangent equation at point + . judge With the second curve segment Does a first intersection point exist? If not, use the next insertion point. Perform the same check. If it exists, proceed to the next step of the loop; Set tangent With the second curve segment The first intersection point is The second curve segment exist The direction vector of the tangent at point is Construct a curve using a point on a straight line and the slope of the line. exist Find the equation of the tangent line at the point, and calculate the intersection of the tangent line and the first curve segment. Second intersection The coordinates; Steps 12234: Based on the distance between the first intersection point and the second intersection point, obtain the intersection point of the two curve segments.
[0035] Repeat steps 1, 2, 2, 3, and 3 until two consecutive intersection points are obtained. and The distance is less than a preset threshold. Then and The midpoint is taken as the intersection point of the first curve segment and the second curve segment.
[0036] like Figure 3 As shown, let's assume we obtain the horizontal cabling. and Vertical lines and The intersection points are respectively If the four curves can form a closed region, then the path of the closed region needs to be determined.
[0037] In an optional embodiment of the present invention, step 13, determining the path of the target enclosed region based on the trajectory of the target enclosed region, may include: Step 131: Based on the trajectory of the target closed area, determine the curved line segments located between the intersection points in the target closed area; Step 132: Determine the coordinates of the points on the curve segment and the control points based on the intersection points; Step 133: Obtain the path of the target closed area based on the coordinates of the points on the curve segment and the control points.
[0038] In this embodiment, as Figure 3As shown, the horizontal and vertical cabling intersect at four points. Connecting these intersection points with the points on the lines between them forms a closed path. The path begins at the bottom left intersection. Begin by proceeding counter-clockwise in sequence. Finally returned Let the curve segment be... and Intersect at curve segment It was divided into and Two curve segments, curve segment It was divided into and Two curves, the goal is to... Figure 4 After adding a new point to the Bézier curve shown, find the control points on both sides of the new point. The coordinates of the control points that existed before the addition but have been repositioned. The coordinates.
[0039] The detailed method is as follows: like Figure 4 As shown, in the curve of Add one online point and two control points at the location. and At the same time, adjust the control points and The position ensures that the two continuous curves remain smooth.
[0040] Let curve The curve matrix constructed according to Equation 2 is M, where the curve segments arrive Length and curve segment arrive The ratio of their lengths is .
[0041] First, calculate the first segment of the curve, i.e., the curve segment. The coordinates of each point are obtained as follows: Construct a new curve matrix :
[0042] in: Formula 7 Curve matrix constructed using Equation 7 After getting the points and The coordinates of each point are shown in Equation 8: Formula 8 The first online point after adding points The position remains unchanged, but control points on the right The position needs to be adjusted. Also, since adding points transforms a single Bézier curve into two separate Bézier curves, the calculation of the first curve segment... By obtaining the coordinates of each point, the points on the line can be obtained. The coordinates of the control point on the left.
[0043] Secondly, calculate the latter part of the curve, i.e., the curve segment. The coordinates of each point are obtained as follows: Construct a new curve matrix
[0044]
[0045] in: Formula 9 Curve matrix constructed using Equation 9 After getting the points , The coordinates of each point are shown in Equation 10: Formula 10 Using Equations 9 and 10, we obtain the online points. The position coordinates of the control point on the right and the control point after adjustment The coordinates.
[0046] like Figure 3 As shown, the points on the closed region's contour curve include four intersection points, points on the sub-curve segments obtained by dividing the curve by these four intersection points, and points on the original curve located between the intersection points. The intersection point at the lower left corner is considered the intersection point. Starting from the curve segment That is, curve Intersection The latter part of the curve is obtained after segmentation, and then the curve is followed. The upper part is located at the intersection. and The point between, passing counterclockwise , and Afterwards, Intersection The first segment curve obtained after segmentation is finally returned to After traversing all points, the path to the target enclosed region can be obtained. .
[0047] In an optional embodiment of the present invention, step 14, mapping each point in the target primitive to the target position in the target closed region according to the path of the target closed region, to obtain the coordinates of the mapped point after the target primitive is deformed, may include: Step 141: Map each point in the target primitive to the target closed region to obtain the points within the region corresponding to each point; Here, let the target primitive to be filled be... Its minimum bounding rectangle is The width and height of the minimum bounding rectangle are respectively and This embodiment requires a series of geometric transformations to make... The path from the minimum bounding box to the target closed region ,set up The four boundaries are: top, bottom, left, and right. , , and ; Traversal For each point in the path, map the point's coordinates to the path. In a specific area.
[0048] Let the coordinates of the currently traversed point be... By using Equation 11, the point Mapping to the target closed region yields the corresponding points within the region. .
[0049] Formula 11 in, The x-coordinates of points within the region, The ordinates of points within the region, The x-coordinate of the point in the target primitive, The ordinate of the point in the target primitive, The left boundary of the path to the target closed region, The right boundary of the path to the target closed region, The upper boundary of the path to the target closed region, The lower boundary of the path to the target closed region.
[0050] Step 142: Reverse the direction of some paths in the target closed area to obtain a set of line segments corresponding to each sub-path of the target closed area; Remember Figure 3 The four intersection points shown , , , There are four anchor points, from Initially, record the set of line segments formed by all line segments between every two adjacent anchor points. For straight line segments, each set object records the first and last endpoints; for Bézier curve segments, each set object records two line points and two control points, ultimately forming four line segment sets. .
[0051] Then, for the first and last sets, i.e. and For each recorded data point, the coordinates of two line points and two control points are swapped, which means that the original curve is reversed by changing the order of the recorded points.
[0052] Step 143: Determine the points on the line within each line segment set according to the line segment set corresponding to each sub-path; Here, in the line segment set The center represents the points within the region to be mapped. Determine two online points and Let the set of line segments be... The number of line segments is The parameters are obtained through Equation 12. The value of, that is: Formula 12 in, This indicates rounding down.
[0053] Extract the set of line segments The Middle Segment curve ,point and Determined according to the following three different situations: when or When =-1, and Take the set The second point on the first line segment; when When approximately equal to 1, and Take the set The Middle Segment curve The second online point; In the remaining cases, Pick The first point on the first line segment in the middle. Take on the curve segment of The point on the line corresponding to the insertion of a point is calculated as shown in Equation 3.
[0054] Let the set of line segments be... The number of line segments is Use the same method as above for line segment sets Determine online points and .
[0055] Set of line segments The first point on the first line segment is determined as Let the set of line segments be... The number of objects in Calculated using Equation 13 Value: Formula 13 Extract the set of line segments The Segment curve , will In The point on the line inserted at the location is determined as a point. .
[0056] set The second point on the last segment of the curve is determined as Let set The number of objects in the middle is Calculated using Equation 14 Value: Formula 14 Take out the set The Segment curve , will In The point on the line inserted at the location is determined as a point. .
[0057] Step 144: Based on the coordinates of the points on the line determined in each line segment set and the coordinates of the points in the region, map the points in the region to the target position to obtain the coordinates of the mapped points after the target primitive is deformed.
[0058] Here, the points within the region The calculation method for mapping to the target location is as follows:
[0059] in, The x-coordinate of the mapping point, For point x-coordinate For point x-coordinate For point x-coordinate For point x-coordinate For point x-coordinate For point x-coordinate For point x-coordinate For point The x-coordinate.
[0060]
[0061] in, The ordinate of the mapping point, For point ordinate, For point ordinate, For point ordinate, For point ordinate, For point ordinate, For point ordinate, For point ordinate, For point The ordinate.
[0062] Finally, the points within the region are obtained. Mapped points .
[0063] Multiplying a floating-point number by a coordinate point means multiplying the horizontal and vertical coordinates by the floating-point number respectively to obtain the final point coordinates.
[0064] Step 15: Based on the coordinates of the mapped points corresponding to each point in the target primitive, obtain the anti-counterfeiting background pattern filled by the deformed target primitive, which may include: target primitives The coordinates of the mapped point corresponding to each point in the image are used to determine the anti-counterfeiting background pattern of the target primitive after transformation.
[0065] Figure 5 The image shows the result of twisting the letters CMYK into the intersection area of the two sets of ribbon cables.
[0066] In the above embodiments of the present invention, it is determined whether two horizontal lines and two vertical lines can form a closed area by finding the intersection of curves; then, the trajectory of the closed area is obtained by curve calculation, and this trajectory is used as the new bounding box of the graphic element; finally, the graphic element is twisted into the closed graphic frame by using envelope deformation, thereby generating an anti-counterfeiting background filled with the target graphic element. Since the deformation of the graphic involves the intersection of curve groups, the distortion of scanning and re-photographing is improved, thereby improving the anti-counterfeiting effect of the anti-counterfeiting background.
[0067] like Figure 6 As shown, embodiments of the present invention also provide a device 60 for generating anti-counterfeiting background patterns based on graphic filling, comprising: The acquisition module 61 is used to acquire the target graphic element and two sets of intersecting lines. Each set of intersecting lines includes a horizontal line and a vertical line. Both the horizontal and vertical lines are curves. Each curve includes multiple straight segments and / or curved segments connected end to end. Processing module 62 is used to determine the target closed area formed by the two sets of intersecting lines based on the intersection points between the lines; determine the path of the target closed area based on the trajectory of the target closed area; map each point in the target graphic element to the target position of the target closed area based on the path of the target closed area to obtain the coordinates of the mapped point after the target graphic element is deformed; and obtain the anti-counterfeiting background filled by the deformed target graphic element based on the coordinates of the mapped point corresponding to each point in the target graphic element, wherein the minimum bounding box of the deformed target graphic element is the path of the target closed area.
[0068] Optionally, based on the intersection points between the intersecting wires, the target enclosed area formed by the two sets of intersecting wires is determined, including: Iterate through each straight line or curved line in the intersecting cabling; Determine the intersection point of any two straight or curved segments between the cabling; When any one of the intersecting horizontal lines intersects with both of the other two vertical lines, the two sets of intersecting lines are determined to form a target closed area, and the four anchor points of the target closed area are the intersection points between the intersecting lines.
[0069] Optionally, determine the intersection point of any two straight or curved segments between the cabling sections, including: When the two line segments between the ribbon cables are straight line segments, establish the equations of the two straight line segments respectively; establish a system of equations based on the equations of the two straight line segments, solve the system of equations, and obtain the intersection point of the two straight line segments; When one line segment between the lines is a straight line segment and the other is a curved line segment, establish the straight line equation and the curve matrix respectively; construct the target polynomial equation based on the straight line equation and the curve matrix; solve the roots of the target polynomial equation to obtain the intersection point of the straight line segment and the curved line segment; When the two line segments between the ribbon cables are curved segments, the intersection point of the two curved segments can be obtained by the intersection point of the tangents of the two curved segments and the other curved segment.
[0070] Optionally, when the two line segments between the cabling are curved segments, the intersection point of the two curved segments is obtained based on the intersection point of the tangents of the two curved segments and the other curved segment, including: When the two line segments between the ribbon cables are curved segments, respectively establish the curve matrices of the first and second curved segments; The coordinates of multiple points on the lines uniformly inserted in the first curve segment are obtained based on the curve matrix. Traverse each point on the first curve segment, determine the first intersection point of the tangent line of the first curve segment and the second intersection point of the tangent line of the first intersection point and the first curve segment; The intersection point of the two curve segments is obtained based on the distance between the first intersection point and the second intersection point.
[0071] Optionally, determining the path of the target enclosed region based on its trajectory includes: Based on the trajectory of the target enclosed region, determine the curve segments located between the intersection points within the target enclosed region; The coordinates of the points on the curve segment and the control points are determined based on the intersection points. The path to the target enclosed area is obtained based on the coordinates of the points on the curve segment and the control points.
[0072] Optionally, based on the path of the target enclosed region, each point in the target primitive is mapped to the target position within the target enclosed region to obtain the mapped point coordinates after the target primitive is deformed, including: Map each point in the target primitive to the target closed region to obtain the points within the region corresponding to each point; Reverse the direction of some paths in the target closed region to obtain a set of line segments corresponding to each sub-path of the target closed region; Based on the set of line segments corresponding to each sub-path, determine the points on the line within each set of line segments; Based on the coordinates of the points on the line determined in each line segment set and the coordinates of the points in the region, the points in the region are mapped to the target position to obtain the coordinates of the mapped points after the target primitive is deformed.
[0073] Optionally, each point in the target primitive is mapped to the target enclosed region to obtain the points within the region corresponding to each point, including: Through formula Map each point in the target primitive to the closed region of the target to obtain the points within the region corresponding to each point. in, The x-coordinates of points within the region, The ordinates of points within the region, The x-coordinate of the point in the target primitive, The ordinate of the point in the target primitive, The left boundary of the path to the target closed region, The right boundary of the path to the target closed region, The upper boundary of the path to the target closed region, The lower boundary of the path to the target closed region.
[0074] It should be noted that this device is the same as the method described above. All implementations in the above method embodiments are applicable to the embodiments of this device and can achieve the same technical effect.
[0075] Embodiments of the present invention also provide a computing device, including: a processor and a memory storing a computer program, wherein the computer program, when executed by the processor, performs the method as described above. All implementations in the above method embodiments are applicable to this embodiment and can achieve the same technical effects.
[0076] Embodiments of the present invention also provide a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the method as described above. All implementations in the above method embodiments are applicable to this embodiment and can achieve the same technical effects.
[0077] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0078] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0079] In the embodiments provided by this invention, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0080] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0081] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0082] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.
[0083] Furthermore, it should be noted that in the apparatus and method of the present invention, it is obvious that the components or steps can be decomposed and / or recombined. These decompositions and / or recombinations should be considered equivalent solutions of the present invention. Moreover, the steps performing the above series of processes can naturally be executed in the order described, but are not necessarily required to be executed in chronological order; some steps can be executed in parallel or independently of each other. Those skilled in the art will understand that all or any step or component of the method and apparatus of the present invention can be implemented in any computing device (including processors, storage media, etc.) or network of computing devices, in hardware, firmware, software, or a combination thereof. This is something that those skilled in the art can achieve by using their basic programming skills after reading the description of the present invention.
[0084] Therefore, the object of the present invention can also be achieved by running a program or a set of programs on any computing device. The computing device can be a known general-purpose device. Therefore, the object of the present invention can also be achieved simply by providing a program product containing program code implementing the method or apparatus. That is, such a program product also constitutes the present invention, and the storage medium storing such a program product also constitutes the present invention. Obviously, the storage medium can be any known storage medium or any storage medium developed in the future. It should also be noted that in the apparatus and method of the present invention, it is obvious that the components or steps can be decomposed and / or recombined. These decompositions and / or recombinations should be considered equivalent to the present invention. Furthermore, the steps performing the above series of processes can naturally be performed in the order described, but are not necessarily required to be performed in chronological order. Some steps can be performed in parallel or independently of each other.
[0085] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method for generating anti-counterfeiting background patterns based on graphic filling, characterized in that, include: Obtain the target primitive and two sets of intersecting lines. Each set of intersecting lines includes a horizontal line and a vertical line. Both the horizontal and vertical lines are curves. Each curve includes multiple straight line segments and / or curved segments connected end to end. Based on the intersection points between the intersecting lines, the target enclosed area formed by the two sets of intersecting lines is determined. Determine the path of the target enclosed area based on the trajectory of the target enclosed area; Based on the path of the target enclosed region, each point in the target primitive is mapped to the target position of the target enclosed region to obtain the coordinates of the mapped point after the target primitive is deformed; Based on the coordinates of the mapping point corresponding to each point in the target primitive, the anti-counterfeiting background pattern filled by the deformed target primitive is obtained, and the minimum bounding box of the deformed target primitive is the path of the target closed region.
2. The method for generating anti-counterfeiting background patterns based on graphic filling according to claim 1, characterized in that, Based on the intersection points between the intersecting wires, the target enclosed area formed by the two sets of intersecting wires is determined, including: Iterate through each straight line or curved line in the intersecting cabling; Determine the intersection point of any two straight or curved segments between the cabling; When any one of the intersecting horizontal lines intersects with both of the other two vertical lines, the two sets of intersecting lines are determined to form a target closed area, and the four anchor points of the target closed area are the intersection points between the intersecting lines.
3. The method for generating anti-counterfeiting background patterns based on graphic filling according to claim 2, characterized in that, Determine the intersection point of any two straight or curved segments between the cabling sections, including: When the two line segments between the ribbon cables are straight line segments, establish the equations of the two straight line segments respectively; establish a system of equations based on the equations of the two straight line segments, solve the system of equations, and obtain the intersection point of the two straight line segments; When one line segment between the lines is a straight line segment and the other is a curved line segment, establish the straight line equation and the curve matrix respectively; construct the target polynomial equation based on the straight line equation and the curve matrix; solve the roots of the target polynomial equation to obtain the intersection point of the straight line segment and the curved line segment; When the two line segments between the ribbon cables are curved segments, the intersection point of the two curved segments can be obtained by the intersection point of the tangents of the two curved segments and the other curved segment.
4. The method for generating anti-counterfeiting background patterns based on graphic filling according to claim 3, characterized in that, When two line segments between the cabling are curved segments, the intersection point of the two curved segments is obtained by finding the intersection point of the tangents of the two curved segments with the other curved segment, including: When the two line segments between the ribbon cables are curved segments, respectively establish the curve matrices of the first and second curved segments; The coordinates of multiple points on the lines uniformly inserted in the first curve segment are obtained based on the curve matrix. Traverse each point on the first curve segment, determine the first intersection point of the tangent line of the first curve segment and the second intersection point of the tangent line of the first intersection point and the first curve segment; The intersection point of the two curve segments is obtained based on the distance between the first intersection point and the second intersection point.
5. The method for generating anti-counterfeiting background patterns based on graphic filling according to claim 1, characterized in that, Determining the path of the target enclosed region based on its trajectory includes: Based on the trajectory of the target enclosed region, determine the curve segments located between the intersection points within the target enclosed region; The coordinates of the points on the curve segment and the control points are determined based on the intersection points. The path to the target enclosed area is obtained based on the coordinates of the points on the curve segment and the control points.
6. The method for generating anti-counterfeiting background patterns based on graphic filling according to claim 1, characterized in that, Based on the path of the target enclosed region, each point in the target primitive is mapped to the target position within the target enclosed region to obtain the coordinates of the mapped points after the target primitive is deformed, including: Map each point in the target primitive to the target closed region to obtain the points within the region corresponding to each point; Reverse the direction of some paths in the target closed region to obtain a set of line segments corresponding to each sub-path of the target closed region; Based on the set of line segments corresponding to each sub-path, determine the points on the line within each set of line segments; Based on the coordinates of the points on the line determined in each line segment set and the coordinates of the points in the region, the points in the region are mapped to the target position to obtain the coordinates of the mapped points after the target primitive is deformed.
7. The method for generating anti-counterfeiting background patterns based on graphic filling according to claim 6, characterized in that, Mapping each point in the target primitive to the target enclosed region yields the points within the region corresponding to each point, including: Through formula Map each point in the target primitive to the closed region of the target to obtain the points within the region corresponding to each point. in, The x-coordinates of points within the region, The ordinates of points within the region, The x-coordinate of the point in the target primitive, The ordinate of the point in the target primitive, The left boundary of the path to the target closed region, The right boundary of the path to the target closed region, The upper boundary of the path to the target closed region, The lower boundary of the path to the target closed region.
8. A device for generating anti-counterfeiting background patterns based on graphic filling, characterized in that, include: The acquisition module is used to acquire the target graphic element and two sets of intersecting lines. Each set of intersecting lines includes a horizontal line and a vertical line. Both the horizontal and vertical lines are curves. Each curve includes multiple straight line segments and / or curved segments connected end to end. The processing module is used to determine the target closed area formed by the two sets of intersecting lines based on the intersection points between the lines; determine the path of the target closed area based on the trajectory of the target closed area; map each point in the target graphic element to the target position of the target closed area based on the path of the target closed area to obtain the coordinates of the mapped point after the target graphic element is deformed; and obtain the anti-counterfeiting background filled by the deformed target graphic element based on the coordinates of the mapped point corresponding to each point in the target graphic element, wherein the minimum bounding box of the deformed target graphic element is the path of the target closed area.
9. A computing device, characterized in that, include: A processor, a memory storing a computer program, wherein the computer program, when executed by the processor, performs the method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, A storage instruction that, when executed on a computer, causes the computer to perform the method as described in any one of claims 1 to 7.