A method for generating smooth contours based on pixel contour units

Through the merging of pixel contour units, concave point deletion and smoothing processing, a smooth guide contour is generated, which solves the problem of insufficient smoothness of the guide contour in the existing technology and achieves a fast and accurate contour generation effect.

CN116740104BActive Publication Date: 2024-09-06CHENGDU HUADA JIUTIAN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310785003.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-29
Publication Date
2024-09-06
Estimated Expiration
2043-06-29

AI Technical Summary

Technical Problem

The existing technology has problems with corners and insufficient smoothness when generating guide contours for display arrays, resulting in a cumbersome process and poor results.

Method used

Generate smooth guide contours by determining the merging of pixel contour units and process layers, deleting concave points, offset operations and smoothing processing. Specific steps include merging qualified pixels and process graphics, deleting concave points, processing according to preset thresholds and offset values, and finally calculating and inserting smooth points based on the smoothness value to generate smooth contours.

Benefits of technology

It realizes the rapid generation of smooth contour graphics, and the parametric control is more accurate and faster, which is suitable for display array and other panel designs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116740104B
    Figure CN116740104B
Patent Text Reader

Abstract

A method for generating a smooth contour based on a pixel contour unit includes: determining a layout pixel unit and a process layer for generating a contour, merging pixel graphics and process graphics that meet specified conditions; deleting concave points of the merged graphics; processing the graphics after deleting the concave points according to a preset groove depth threshold; performing an X-direction offset operation on the graphics according to a preset X-direction node offset value; performing a Y-direction offset operation on the graphics according to a preset Y-direction node offset value; and generating a smooth guide contour line based on a preset smoothness value. Compared with the existing method of manually adjusting the generated graphics after enlarging the appearance of a display array, the method of the present invention can quickly generate the required graphics, and can adjust different effects according to different parameters. The entire generation will be controlled by parameters, which is more accurate, convenient and fast.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular to a method for generating a smooth contour based on a pixel contour unit. Background Art

[0002] When the user designs the panel, a port is placed under the display area array to connect the IC port. A guide contour is required to connect the port and the IC port. The existing technical solution is to enlarge the shape of the display array and then manually adjust it. The process is relatively cumbersome, and the generated guide contour has problems such as large angles and lack of smoothness. Summary of the invention

[0003] In order to solve the defects of the prior art, the object of the present invention is to provide a method for generating a smooth contour based on a pixel contour unit, by specifying a pixel contour unit or a process layer, a smooth guide contour line (GuideLine) is generated under specified parameter settings.

[0004] In order to achieve the above object, the method for generating a smooth contour based on a pixel contour unit provided by the present invention comprises the following steps:

[0005] Determine the layout pixel units and process layers that need to generate outlines, and merge the pixel graphics and process graphics that meet the specified conditions;

[0006] Delete the concave points of the merged graphics;

[0007] Processing the image after deleting the concave points according to a preset groove depth threshold;

[0008] According to the preset node offset value in the X direction, the graph is offset in the X direction;

[0009] According to the preset node offset value in the Y direction, the graph is offset in the Y direction;

[0010] Generates a smooth guide contour based on a preset smoothness value.

[0011] Furthermore, the step of determining the layout pixel units and process layers for which contours need to be generated, and merging the pixel graphics and process graphics that meet the specified conditions, further includes:

[0012] If the merged shape is a single polygon or a large polygon containing a small polygon, the merged result is retained;

[0013] If multiple non-intersecting polygons appear after merging, recursively process the multiple non-intersecting polygons, take the lower left corner vertex and upper left corner vertex of the left polygon, the lower right corner vertex and upper right corner vertex of the right polygon respectively, and retain the upper and lower edges.

[0014] Furthermore, the step of deleting the concave points of the merged graphics further includes:

[0015] Traverse the contour points of the figure, and for three consecutive contour points, calculate the vector from the first contour point to the second contour point and the vector from the second contour point to the third contour point respectively. If the product of the two vectors is less than zero, the second contour point is a concave point and is deleted.

[0016] Furthermore, the step of processing the graphics after deleting the concave points according to the preset groove depth threshold value further includes:

[0017] Start traversing from any three consecutive contour points on the graph;

[0018] If the vector of three contour points is a convex point, record the first contour point as X, and continue to search forward until the vector of three contour points appears again as a convex point, and record the last contour point as Y;

[0019] Calculate the distance between the contour points of X and Y to the XY line segment respectively;

[0020] Delete contour points whose distance to the XY line segment is less than the groove depth threshold.

[0021] Furthermore, the step of generating a smooth guide contour line based on a preset smoothness value further includes:

[0022] According to the degree of smoothness, the corresponding t value is obtained. <t<1;

[0023] Traverse the contour points on the graph, and for the n+1 contour points P0~Pn on the graph, use the following formula to calculate the position of the smooth point that needs to be inserted:

[0024]

[0025] Where B(t) is the coordinate of the smooth point, i is an integer from 0 to n, n is a positive integer greater than 0, and the value of Pi is [x i ,y i ], x i is the horizontal coordinate of the contour point Pi, y i is the ordinate of the contour point Pi;

[0026] Insert the calculated smooth points between P0 and Pn, connect the smooth points and contour points between P0 and Pn, and obtain a smooth guide contour line from P0 to Pn;

[0027] Repeat the above steps to finally obtain a smooth guide contour line of the entire figure.

[0028] In order to achieve the above object, the present invention also provides an electronic device, including a memory and a processor, wherein the memory stores a program running on the processor, and when the processor runs the program, the steps of the method for generating a smooth contour based on a pixel contour unit as described above are executed.

[0029] In order to achieve the above object, the present invention further provides a computer-readable storage medium having a computer program stored thereon, wherein when the program is executed by a processor, the method for generating a smooth contour based on a pixel contour unit as described above is implemented.

[0030] Compared with the prior art, the method for generating a smooth contour based on a pixel contour unit provided by the present invention has the following advantages:

[0031] Beneficial effects:

[0032] Through parameterized settings and using specific algorithms, the required smooth contour graphics can be quickly generated, and the generation effect can be adjusted by adjusting the corresponding parameters;

[0033] The generation of smooth contours will be controlled by parameters, which is more accurate, convenient and fast.

[0034] Other features and advantages of the present invention will be set forth in the description which follows, and in part will be apparent from the description, or may be learned by practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:

[0036] Figure 1 A flow chart of a method for generating a smooth contour based on a pixel contour unit according to the present invention;

[0037] Figure 2 A schematic diagram showing that an outer contour polygon according to the present invention includes a plurality of inner polygons;

[0038] Figure 3 A schematic diagram of an outer contour graphic according to the present invention;

[0039] Figure 4 A schematic diagram of a pattern after groove processing according to the present invention;

[0040] Figure 5 A schematic diagram of concave and convex points according to the present invention;

[0041] Figure 6 A schematic diagram of a graph after an offset operation according to the present invention;

[0042] Figure 7 is a schematic diagram of an operation interface according to the present invention;

[0043] Figure 8 is a smooth contour effect diagram according to the present invention;

[0044] Fig. 9 A partial enlarged view of the smooth contour effect diagram according to the present invention;

[0045] Fig.10 is another partial enlarged view of the smooth contour effect diagram according to the present invention;

[0046] Fig.11 This is a comparison diagram of the effects of different smoothness levels according to the present invention;

[0047] Fig.12 FIG. 2 is a schematic diagram of the structure of an electronic device according to the present invention. DETAILED DESCRIPTION

[0048] The preferred embodiments of the present invention are described below in conjunction with the accompanying drawings. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention.

[0049] Embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present invention. It should be understood that the drawings and embodiments of the present invention are only for exemplary purposes and are not intended to limit the scope of protection of the present invention.

[0050] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.

[0051] Figure 1 The flowchart of the method for generating a smooth contour based on a pixel contour unit according to the present invention is shown below. Figure 1 , embodiments of the present invention are described in detail.

[0052] First, in step 101, the layout pixel units and process layers for which contours need to be generated are determined, and the pixel graphics and process graphics that meet the specified conditions are merged.

[0053] In the embodiment of the present invention, pixel patterns meeting specified conditions and process patterns meeting the process layer are searched in the pixel pattern matrix, and the pixel patterns meeting the specified conditions and the process patterns are merged.

[0054] If the merged shape is a single polygon or a large polygon containing a small polygon, the merged result is retained. Figure 2 , showing the situation where the merged figure A is a large outer contour polygon containing small inner polygons.

[0055] If multiple non-intersecting polygons appear after merging, these polygons are processed recursively.

[0056] Specifically, take the lower left corner vertex and upper left corner vertex of the left polygon, the lower right corner vertex and upper right corner vertex of the right polygon, and keep the upper and lower edges to ensure that the merged figure will not cross itself, and the result is a merged figure. Repeat the merging operation in this way, and the figure B obtained is a large polygon or a large polygon containing a small polygon.

[0057] refer to Figure 3 , showing the outer contour figure of figure B.

[0058] It should be understood that although the present invention uses "big", "small", etc. to describe various polygonal figures, it is illustrative rather than restrictive. The use of these terms is merely to distinguish the figures from the perspective of relative size. The size of the figures is not limited without departing from the scope of the exemplary embodiments.

[0059] In step 102, the concave points of the merged graphics are deleted.

[0060] Generally speaking, Figure B (or Figure A) is an irregular polygon, which has both convex angles and concave angles.

[0061] In the embodiment of the present invention, the operation of deleting concave points is performed on the largest figure in figure B (or figure A) (excluding the small figures inside it). Specifically: the contour points of the entire large figure are traversed, and for the three consecutive contour points P1, P2, and P3 that are traversed, the vector from point P1 to point P2 is calculated and recorded as P12, and the vector from point P2 to point P3 is recorded as P23. If: P12×P23<0, then point P2 is the current concave point and is deleted. Repeat this operation to delete the concave points of the largest figure in figure B (or figure A) to obtain figure C. Figure C refers to Figure 4 shown.

[0062] Figure 5 Schematic diagram of concave and convex points according to the present invention.

[0063] In step 103, the pattern after the concave points are deleted is processed according to a preset groove depth threshold.

[0064] In the embodiment of the present invention, the graph C obtained by deleting the concave points of the largest graph in the graph B (or graph A) may still have a large concave arc. The large concave arc is retained or deleted according to a preset groove depth threshold.

[0065] Specifically, traverse the points on the contour of the graph C, starting from any three consecutive contour points of the graph C and traversing in one direction. If the vectors of the current three contour points are convex points (refer to Figure 5 ), and the vectors of the next set of 3 contour points are concave points (ref. Figure 5 ), then continue searching forward until the vector of the three contour points appears again as a convex point. At this time, the first contour point among the three points where the vector is a convex point for the first time is recorded as X, and the contour point when it stops is recorded as Y.

[0066] Calculate the distance between all contour points between X and Y and the XY line segment respectively: For the contour point p between X and Y in the search process just now, calculate the distance between the contour point p and the XY line segment, and search in a loop to get the value with the maximum distance. In the graph, keep the contour points whose distance to the XY line segment exceeds the groove depth threshold, delete the points whose distance to the XY line segment is less than the groove depth threshold, and get the graph D, refer to Figure 4 shown.

[0067] In step 104, an offset operation in the X direction is performed on the graph according to a preset node offset value in the X direction.

[0068] In the embodiment of the present invention, a node offset value in the X direction is preset, and an X-direction offset operation (enlargement) is performed on the graph D obtained by the above processing according to the node offset value to obtain a graph E.

[0069] In step 105, an offset operation is performed on the graph in the Y direction according to a preset node offset value in the Y direction.

[0070] In the embodiment of the present invention, a node offset value in the Y direction is preset, and a Y-direction offset operation (enlargement) is performed on the graph E obtained by the above processing according to the node offset value to obtain a graph F.

[0071] Figure 6 is a schematic diagram of a graph after an offset operation according to the present invention, as shown in Figure 6 As shown, the graph D is enlarged in the X direction and the Y direction respectively.

[0072] In step 106 , a smoothed guide contour line is generated based on a preset smoothness value.

[0073] In an embodiment of the present invention, the graphic F is smoothed and fitted according to the set smoothness value of the guiding contour line to obtain the final smooth guiding contour line (GuideLine).

[0074] The process of smooth fitting is as follows:

[0075] Traverse the contour points on the graphic F. For the n + 1 contour points P0 to Pn on the graphic F, obtain the corresponding t value according to the smoothness value, and use the following formula to calculate the positions of the smooth points to be inserted:

[0076]

[0077] where B(t) is the coordinate of the smooth point, i is an integer from 0 to n, 0 < t < 1, n is the number of contour points, and the value of Pi is [x i , y i , x i is the abscissa of the contour point Pi, and y i is the ordinate of the contour point Pi.

[0078] Insert the calculated smooth points into the corresponding positions between P0 and Pn respectively, and connect the contour points and smooth points between P0 and Pn, then the smooth processing between P0 and Pn is completed. Repeat the above steps to smooth the entire graphic F, and finally obtain the complete smooth guiding contour line (GuideLine).

[0079] In an embodiment of the present invention, the value range of the smoothness value is [0, 1, 2, 3, 4, 5]. The higher the smoothness value, the smaller the corresponding t value, the more smooth points are calculated, and the smoother the processed contour line is.

[0080] Compared with the existing method of manually adjusting and generating a graphic after magnifying the shape of the display array, the method of the present invention can quickly generate the required graphic, and can adjust different effects according to different parameters. The generation of the smooth contour line will be parametrically controlled, which is more accurate, convenient and fast.

[0081] In another embodiment of the present invention, an operation panel is also provided, which is used to set multiple parameters involved in the method of the present invention, and then generate a smooth guiding contour line according to the set parameters.

[0082] Figure 7 As the schematic diagram of the operation interface according to the present invention, such as Figure 7As shown in the figure, determine the layout pixel unit or process layer for which the contour needs to be generated, set the node offset value in the X direction (X-Offset) and the node offset value in the Y direction (Y-Offset) in the operation interface, select the guide contour line smoothing level (Smooth Level), and set the groove depth threshold (KeepConcave Depth>=). After the parameter settings are completed, click "OK" to generate a smooth guide contour line (GuideLine).

[0083] Figure 8 This is a smooth contour effect diagram according to the present invention.

[0084] Fig. 9 A local enlarged view of the smooth contour effect diagram according to the present invention is shown in FIG. Fig. 9 As shown, the small squares are pixel points, and the edge line on the lower left is the generated GuideLine (guide contour line).

[0085] Fig.10 is another partial enlarged view of the smooth contour effect diagram according to the present invention, as shown in Fig.10 As shown in the figure, the X-direction offset and the Y-direction offset represent the offset of the GuideLine relative to the vertex, and the threshold represents that if the distance from the GuideLine to the vertex is greater than the threshold, the GuideLine will not pass through the vertex. The threshold is added to ensure that the generated result will not be affected by some relatively concave vertices. When the threshold is set to be greater than a certain value, the vertices in the internal concave arc will not be passed by the GuideLine, so that the generated GuideLine is smoother and more in line with the requirements.

[0086] In the embodiment of the present invention, different smoothing levels correspond to different smoothing effects. The higher the smoothing level, the smoother the generated GuideLine is. The smoothing level has 6 levels from 0 to 5.

[0087] Fig.11 The smoothing effect comparison diagram of different smoothing levels according to the present invention is as follows: Fig.11 As shown, the left side is the contour effect diagram of smoothness level 1, and the right side is the contour effect diagram of smoothness level 5. Compared with the two, it is obvious that the guiding contour line obtained by smoothness level 5 is smoother.

[0088] The method of the present invention can simulate the layout of the panel area to generate the peripheral guide contour line (GuideLine); it can also be used for the panel layout of liquid crystal displays, mobile phone screens, etc. to generate the guide contour line (GuideLine).

[0089] In an embodiment of the present invention, an electronic device is also provided. Fig.12 Schematic diagram of the structure of an electronic device according to an embodiment of the present invention. Fig.11As shown, the electronic device of the present invention includes a processor 1201 and a memory 1202, wherein:

[0090] The memory 1202 stores a computer program. When the computer program is read and executed by the processor 1201 , the computer program executes the steps in the embodiment of the semiconductor device model lifetime estimation method including multiple degradation effects as described above.

[0091] In an embodiment of the present invention, a computer-readable storage medium is further provided, in which a computer program is stored, wherein the computer program is configured to execute the steps in the embodiment of the semiconductor device model lifetime estimation method including multiple degradation effects as described above when running.

[0092] In this embodiment, the above-mentioned computer-readable storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.

[0093] Those skilled in the art can understand that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention is described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions recorded in the aforementioned embodiments or replace some of the technical features therein by equivalents. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for generating a smooth contour based on a pixel contour unit, characterized in that: The following steps are involved: Determine the layout pixel units and process layers that need to generate outlines, and merge the pixel graphics and process graphics that meet the specified conditions; Delete the concave points of the merged graphics; Processing the image after deleting the concave points according to a preset groove depth threshold; According to the preset node offset value in the X direction, the graph is offset in the X direction; According to the preset node offset value in the Y direction, the graph is offset in the Y direction; Generate a smooth guide contour line based on a preset smoothness value; The step of processing the graphics after deleting the concave points according to the preset groove depth threshold value also includes: Start traversing from any three consecutive contour points on the graph; If the vector of three contour points is a convex point, record the first contour point as X, and continue to search forward until the vector of three contour points appears again as a convex point, and record the last contour point as Y; Calculate the distance between the contour points of X and Y to the XY line segment respectively; Delete contour points whose distance to the XY line segment is less than the groove depth threshold.

2. The method for generating a smooth contour based on a pixel contour unit according to claim 1, characterized in that: The step of determining the layout pixel units and process layers for which the outline needs to be generated, and merging the pixel graphics and process graphics that meet the specified conditions, further includes: If the merged shape is a single polygon or a large polygon containing a small polygon, the merged result is retained; If multiple non-intersecting polygons appear after merging, recursively process the multiple non-intersecting polygons, take the lower left corner vertex and upper left corner vertex of the left polygon, the lower right corner vertex and upper right corner vertex of the right polygon respectively, and retain the upper and lower edges.

3. The method for generating a smooth contour based on a pixel contour unit according to claim 1, characterized in that: The step of deleting the concave points of the merged graphics also includes: Traverse the contour points of the figure, and for three consecutive contour points, calculate the vector from the first contour point to the second contour point and the vector from the second contour point to the third contour point respectively. If the product of the two vectors is less than zero, the second contour point is a concave point and is deleted.

4. The method for generating a smooth contour based on a pixel contour unit according to claim 1, characterized in that: The step of generating a smooth guide contour line based on a preset smoothness value further includes: According to the degree of smoothness, the corresponding t value is obtained. <t<1; Traverse the contour points on the graph, and for the n+1 contour points P0~Pn on the graph, use the following formula to calculate the position of the smoothing point that needs to be inserted: , Where B(t) is the coordinate of the smooth point, i is an integer from 0 to n, n is a positive integer greater than 0, and the value of Pi is [x i ,y i ], x i is the horizontal coordinate of the contour point Pi, y i is the ordinate of the contour point Pi; Insert the calculated smooth points between P0 and Pn, connect the smooth points and contour points between P0 and Pn, and obtain a smooth guide contour line from P0 to Pn; Repeat the above steps to finally obtain a smooth guide contour line of the entire figure.

5. An electronic device, characterized in that: The invention comprises a memory and a processor, wherein the memory stores a program running on the processor, and the processor executes the steps of the method for generating a smooth contour based on a pixel contour unit according to any one of claims 1 to 4 when running the program.

6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method for generating a smooth contour based on a pixel contour unit according to any one of claims 1 to 4 is implemented.