CN114549550A - Method, device and medium for pruning graph based on space geometry - Google Patents

Method, device and medium for pruning graph based on space geometry Download PDF

Info

Publication number
CN114549550A
CN114549550A CN202210135417.3A CN202210135417A CN114549550A CN 114549550 A CN114549550 A CN 114549550A CN 202210135417 A CN202210135417 A CN 202210135417A CN 114549550 A CN114549550 A CN 114549550A
Authority
CN
China
Prior art keywords
point
line segment
graph
intersection
trimming
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.)
Pending
Application number
CN202210135417.3A
Other languages
Chinese (zh)
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.)
Tongen Shanghai Engineering Technology Co ltd
Original Assignee
Tongen Shanghai Engineering Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tongen Shanghai Engineering Technology Co ltd filed Critical Tongen Shanghai Engineering Technology Co ltd
Priority to CN202210135417.3A priority Critical patent/CN114549550A/en
Publication of CN114549550A publication Critical patent/CN114549550A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/20Drawing from basic elements, e.g. lines or circles
    • G06T11/203Drawing of straight lines or curves
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image
    • G06T2207/10012Stereo images
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20112Image segmentation details
    • G06T2207/20132Image cropping

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Generation (AREA)

Abstract

The invention provides a graph pruning method based on space geometry, which comprises the following steps: s1, acquiring the graph to be trimmed and acquiring the input trimmed graph; s2, the trimmed graphs are straight line segments, intersection points of all the trimmed graphs and the straight line segments are calculated, and then the distance from the intersection points to the starting point of the straight line segments is calculated; then recording the distance from the trimming point to the starting point of the straight line segment; sequencing all distances from small to large, and acquiring a graph intersection point adjacent to the trimming point according to the distance from the straight line segment starting point; using the start point and the left intersection point of the straight line segment as the start point and the end point of a new straight line segment, using the right intersection point and the end point of the straight line segment as the start point and the end point, and redrawing the new straight line segment; s3, placing the new graph generated after pruning into the pruned graph to perform the next intersection point calculation until pruning is finished; and S4, finishing the trimming and releasing the trimmed graph. The method provided by the invention can be used for pruning according to the geometric attributes of the graph and can be suitable for various scenes.

Description

Method, device and medium for pruning graph based on space geometry
Technical Field
The invention relates to the technical field of graphics, in particular to a method, a device and a medium for trimming a graph based on space geometry.
Background
The pattern trimming means trimming a portion between any two intersection points when there are a plurality of intersection points with other patterns on the pattern with respect to any two-dimensional pattern in space. The trimming of complex graphs can be decomposed into trimming of basic graphs such as straight line segments and the like, so the trimming of the basic graphs is always a research hotspot, for example, the Liang-Barsky algorithm, the Sutherland-hodgman algorithm and the like, the trimming polygons of the algorithms require to be rectangles, and the trimming polygons of the Greiner-Hormann algorithm, the Weiler algorithm and the like can be general polygons, and the algorithms can effectively remove the parts of two-dimensional graphs beyond the trimming polygons, but can not realize the problem of local trimming of any two-dimensional graphs when any two-dimensional graphs are used as the trimming graphs.
Due to the diversity of two-dimensional polygons, the existing graph pruning method cannot meet the pruning requirements of various graphs when all types of graphs are used as pruning graphs together.
The background description provided herein is for the purpose of generally presenting the context of the disclosure. Unless otherwise indicated herein, the material described in this section is not prior art to the claims in this application and is not admitted to be prior art by inclusion in this section.
Disclosure of Invention
Aiming at the technical problems in the related art, the invention provides a graph pruning method based on space geometry, which comprises the following steps:
s1, acquiring the graph to be trimmed and acquiring the input trimmed graph;
s2, the trimmed graphs are straight line segments, intersection points of all the trimmed graphs and the straight line segments are calculated, and then the distance from the intersection points to the starting point of the straight line segments is calculated; then recording the distance from the trimming point to the starting point of the straight line segment; sequencing all distances from small to large, and acquiring a graph intersection point adjacent to the trimming point according to the distance from the straight line segment starting point; using the start point and the left intersection point of the straight line segment as the start point and the end point of a new straight line segment, using the right intersection point and the end point of the straight line segment as the start point and the end point, and redrawing the new straight line segment;
s3, placing the new graph generated after pruning into the pruned graph to perform the next intersection point calculation until pruning is finished;
and S4, finishing the trimming and releasing the trimmed graph.
Specifically, step S2 further includes:
s21, the clipped graph is a multi-line segment, each straight-line segment of the multi-line segment is traversed, the graph intersection point on the straight-line segment is calculated according to the method of solving the intersection point of the straight-line segment and other graphs, and then the distance and the number of the intersection point to the starting point of the multi-line segment are recorded; calculating the distance from the trimming point to the starting point of the multi-line segment, sequencing the distances from all the graph intersection points to the starting point of the multi-line segment from small to large, and acquiring the graph intersection points adjacent to the trimming point according to the distances from the graph intersection points to the starting point of the multi-line segment; and finally, changing the endpoint list of the multi-line segment and redrawing a new multi-line segment.
Specifically, step S2 further includes:
s22, the trimmed graph is a circle, and the angle between the connecting line of the trimming point and the circle center and the X axis is recorded; recording all intersection points of the trimmed circles and the trimmed graph, and calculating angles between connecting lines of all the intersection points and the circle center and the X axis; and sequencing all angles from small to large, acquiring adjacent graph intersection points of the trimming points, and drawing a new circular arc by taking two adjacent intersection points of the trimming points as a starting point and an end point of the new circular arc.
Specifically, step S22 further includes:
and S23, judging whether the clipped graph is an arc, and if the intersection point is not on the arc, the intersection point is not used as the calculation intersection point.
Specifically, step S1 specifically includes obtaining the trimming graph by a frame selection method.
In a second aspect, another embodiment of the present invention discloses a device for pruning a graph based on space geometry, which comprises the following units:
the clipped graph acquisition unit is used for acquiring a graph to be clipped and acquiring an input clipped graph;
the pruning unit is used for calculating the intersection points of all the pruned graphs and the straight line segments when the pruned graphs are straight line segments, and then calculating the distance from the intersection points to the starting point of the straight line segments; then recording the distance from the trimming point to the starting point of the straight line segment; sequencing all distances from small to large, and acquiring a graph intersection point adjacent to the trimming point according to the distance from the straight line segment starting point; using the start point and the left intersection point of the straight line segment as the start point and the end point of a new straight line segment, using the right intersection point and the end point of the straight line segment as the start point and the end point, and redrawing the new straight line segment;
the new graph generating unit is used for generating a new graph after trimming, and then placing the new graph into the selected two-dimensional graph to perform the next intersection point calculation until the trimming is finished;
and a release unit for ending the trimming and releasing the selected two-dimensional graph.
Specifically, the multi-line segment trimming unit is used for trimming the trimmed graph into multi-line segments, traversing each straight line segment of the multi-line segments, calculating the graph intersection point on the straight line segment according to a method for solving the intersection point of the straight line segment and other graphs, and then recording the distance and the number of the intersection point to the starting point of the multi-line segment; calculating the distance from the trimming point to the starting point of the multi-line segment, sequencing the distances from all the graph intersection points to the starting point of the multi-line segment from small to large, and acquiring the graph intersection points adjacent to the trimming point according to the distances from the graph intersection points to the starting point of the multi-line segment; and finally, changing the endpoint list of the multi-line segment and redrawing a new multi-line segment.
Specifically, the circle trimming unit is used for recording the angle between the connecting line of the trimming point and the circle center and the X axis, wherein the trimmed figure is a circle; recording all intersection points of the trimmed circles and the trimmed graph, and calculating angles between connecting lines of all the intersection points and the circle center and the X axis; and sequencing all angles from small to large, acquiring adjacent graph intersection points of the trimming points, and drawing a new circular arc by taking two adjacent intersection points of the trimming points as a starting point and an end point of the new circular arc.
Specifically, the arc trimming unit determines whether the intersection point is on the arc based on the calculation that the trimmed pattern is a circle, and if the intersection point is not on the arc, the intersection point is not used as the calculated intersection point.
In a third aspect, another embodiment of the present invention discloses a non-volatile storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the above method.
The embodiment can realize the trimming of any number of any type of trimmed graphs when any number of any type of two-dimensional graphs are used as the trimmed graphs. The embodiment prunes according to the geometric attributes of the graph, and can adapt to various scenes.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings needed in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
FIG. 1 is a schematic flow chart of a space-based graph pruning method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a user interface for a to-be-cropped graphic provided by an embodiment of the present invention;
FIG. 3 is a schematic diagram of clipping points and clipped graphs provided by the embodiment of the present invention;
FIG. 4 is a schematic diagram of a new pattern generated after trimming provided by an embodiment of the present invention;
FIG. 5 is a schematic diagram of the intersection of a straight line segment and a trim pattern provided by an embodiment of the present invention;
FIG. 6 is a schematic diagram of a starting point and a clipping point of a straight line segment according to an embodiment of the present invention;
FIG. 7 is a schematic diagram of adjacent intersections provided by embodiments of the present invention;
FIG. 8 is a schematic diagram of creating a straight line segment provided by an embodiment of the invention;
FIG. 9 is a schematic diagram of 7 straight line segments of a multi-line segment provided by an embodiment of the present invention;
FIG. 10 is a schematic diagram of an intersection on the 4 th and 5 th straight line segments provided by the embodiment of the present invention;
FIG. 11 is a schematic diagram of the distance between the intersection point and the starting point provided by the embodiment of the invention;
FIG. 12 is a schematic diagram of a distance from a trimming point to a starting point according to an embodiment of the present invention;
FIG. 13 is a schematic diagram of the creation of a new multi-line segment provided by an embodiment of the present invention;
FIG. 14 is a schematic view of an angle from a connecting line between a trimming point and a circle center to an x-axis according to an embodiment of the present invention;
FIG. 15 is a schematic diagram of the intersection of a circle being trimmed and a trim pattern provided by an embodiment of the present invention;
FIG. 16 is a schematic view of the connection of all the intersection points with the center of a circle at an angle from the X-axis according to an embodiment of the present invention;
FIG. 17 is a schematic diagram of adjacent intersections provided by embodiments of the present invention;
FIG. 18 is a schematic diagram of creating a new arc provided by an embodiment of the present invention;
FIG. 19 is a schematic view of a calculated intersection point of arcs provided by an embodiment of the present invention;
FIG. 20 is a schematic diagram of a release trim and trimmed pattern provided by an embodiment of the present invention;
FIG. 21 is a schematic diagram of a spatial geometry based image cropping system according to an embodiment of the present invention;
fig. 22 is a schematic diagram of a space geometry-based image cropping device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments that can be derived by one of ordinary skill in the art from the embodiments given herein are intended to be within the scope of the present invention.
Example one
Referring to fig. 1, the present embodiment discloses a method for pruning a graph based on space geometry, which includes the following steps:
s1, obtaining the graph to be trimmed and obtaining the input trimmed graph;
specifically, the method for pruning a graph based on space geometry according to this embodiment may be applied to a graph system with a graphical user interface, and referring to fig. 2, fig. 2 shows a schematic diagram of a user interface of a graph to be pruned, which includes different graphs, such as a circle, a straight line segment, and the like.
In this embodiment, a trimming instruction of a user is obtained first, where the trimming instruction may be entered by clicking a command or entering a shortcut key, and this embodiment is not limited in particular.
Specifically, after a trimming command is input, a trimming mode is entered. The user may enter the trim graphic, for example by selecting a box to capture the trim graphic. More generally, it is also possible to not input a trimming graphic, and default all the graphics in the current display interface as trimming graphics.
In addition, the user may also obtain the trimming graph by clicking or double-clicking, and the embodiment is not limited in particular.
Furthermore, the user may input the clipped figure, for example, the user may click to obtain the clipped figure, and referring to fig. 3, the user clicks (the cross mark in fig. 3) one point in the figure to clip the clipped point, and the clipped point is located on the straight line 1, so that the straight line 1 is the clipped figure. And the other selected images are trim graphics.
S2, the clipped graph is a straight line segment, the intersection points of all the clipped graphs (shown in figure 5) and the straight line segment are calculated, and then the distance from the intersection points to the starting point of the straight line segment is calculated (shown in figure 6); the distance from the cut point to the start of the straight line segment is again recorded (see figure 7). Sequencing all the distances from small to large, and acquiring a graph intersection point (see figure 8) adjacent to the trimming point according to the distance from the starting point of the straight line segment; using the start point and the left intersection point of the straight line segment as the start point and the end point of a new straight line segment, using the right intersection point and the end point of the straight line segment as the start point and the end point, and redrawing a new straight line segment (see fig. 9);
in the embodiment, intersection points of a straight line segment and a straight line segment, intersection points of a straight line segment and a plurality of line segments and intersection points of a straight line segment and a circle are calculated according to space geometry, the intersection points of the straight line segment and a character are intersection points of four sides formed by four angular points of the straight line segment and the character, when the intersection points of the straight line segment and the arc are calculated, the intersection points of the straight line segment and the circle are calculated firstly, whether the intersection points are on the arc or not is judged according to angles of starting points and end points of the arc, and if the intersection points are on the arc, the intersection points are the intersection points of the straight line segment and the arc
And S3, placing the new graph generated after pruning into the pruned graph to perform the next intersection point calculation (see FIG. 4) until pruning is finished.
S4, ending the trimming, releasing the trimmed figure (see fig. 20).
The specific step S2 further includes:
s21, the clipped graph is a multi-line segment, each straight line segment of the multi-line segment is traversed (see figure 10), the graph intersection point (see figure 11) on the straight line segment is calculated according to the method of solving the intersection point of the straight line segment and other graphs, and then the distance and the number of the intersection point to the starting point of the multi-line segment are recorded (see figure 12); calculating the distance from the pruning point to the starting point of the multi-line segment, sequencing the distances from all the graph intersection points to the starting point of the multi-line segment from small to large, and acquiring the graph intersection points adjacent to the pruning point according to the distances from the graph intersection points to the starting point of the multi-line segment (see figure 13); finally, the endpoint list of the multiline segment is changed and a new multiline segment is redrawn (see fig. 14).
In the embodiment, the intersection point of the multi-line segment and the straight line segment, the intersection point of the multi-line segment and the multi-line segment, the intersection point of the multi-line segment and the circle, the intersection point of the multi-line segment and the character and the intersection point of the multi-line segment and the circular arc are calculated according to space geometry.
The specific step S2 further includes:
and S22, the clipped graph is a circle, and the angle between the connecting line of the clipping point and the circle center and the X axis is recorded (see figure 15). All the intersections of the circle (the clipped figure) and the clipped figure are recorded (see fig. 16), and the angles between the connecting lines of all the intersections and the circle center and the X axis are calculated (see fig. 17). And (3) sequencing all angles from small to large, acquiring adjacent graph intersection points of the pruning points (see fig. 18), and drawing a new circular arc by taking two adjacent intersection points of the pruning points as a starting point and an end point of the new circular arc (see fig. 19).
In the embodiment, the intersection point of a circle and a straight line segment and the intersection point of the circle and a multi-line segment are calculated according to space geometry, the intersection point of the circle and the circle is calculated according to three conditions of coplanarity (separation, tangency, intersection), non-coplanarity parallel, non-coplanarity and non-parallel, the intersection point calculation of the circle and the circular arc is carried out, whether the graphic intersection point is on the circular arc or not is increased on the basis of the calculation of the intersection point of the circle and the circle, and the calculation of the circle and the character is converted into the calculation of four edges of the circle and the character.
The specific step S2 further includes:
s23, the clipped figure is a circular arc, that is, the determination of whether the intersection is on the circular arc is added on the basis of the calculation that the clipped figure is a circle, and if the intersection is not on the circular arc, the intersection is not regarded as the calculated intersection (see fig. 20).
The embodiment can realize the trimming of any number of any type of two-dimensional graphs when any number of any type of two-dimensional graphs are used as the trimming graphs. The embodiment prunes according to the geometric attributes of the graph, and can adapt to various scenes.
Example two
Referring to fig. 21, the present embodiment discloses a spatial geometry-based pattern cropping device, which includes the following units:
the clipped graph acquisition unit is used for acquiring a graph to be clipped and acquiring an input clipped graph;
specifically, the method for pruning a graph based on space geometry according to this embodiment may be applied to a graphical system with a graphical user interface, and referring to fig. 2, fig. 2 shows a schematic diagram of a graphical user interface with pruning, which includes different graphs, such as circles, straight segments, etc.
In this embodiment, a trimming instruction of a user is obtained first, where the trimming instruction may be entered by clicking a command or entering a shortcut key, and this embodiment is not limited in particular.
Specifically, after a trimming command is input, a trimming mode is entered. The user may enter the trim graphic, for example by selecting a box to capture the trim graphic. More generally, it is also possible to not input the trimming graphics, and default all the graphics in the current display interface as the trimming graphics.
In addition, the user may also obtain the trimming graph by clicking or double-clicking, and the embodiment is not limited in particular.
Furthermore, the user may input the clipped figure, for example, the user may click to obtain the clipped figure, and referring to fig. 3, the user clicks (the cross mark in fig. 3) one point in the figure to clip the clipped point, and the clipped point is located on the straight line 1, so that the straight line 1 is the clipped figure. And the other selected images are trim graphics.
The pruning unit is used for calculating the intersection points of all the pruned graphs and the straight line segments when the pruned graphs are straight line segments, and then calculating the distance from the intersection points to the starting point of the straight line segments; and recording the distance from the trimming point to the starting point of the straight line segment. Sequencing all distances from small to large, and acquiring a graph intersection point adjacent to the trimming point according to the distance from the straight line segment starting point; using the start point and the left intersection point of the straight line segment as the start point and the end point of a new straight line segment, using the right intersection point and the end point of the straight line segment as the start point and the end point, and redrawing the new straight line segment;
in the embodiment, intersection points of a straight line segment and a straight line segment, intersection points of a straight line segment and a plurality of line segments and intersection points of a straight line segment and a circle are calculated according to space geometry, the intersection points of the straight line segment and a character are intersection points of four sides formed by four angular points of the straight line segment and the character, when the intersection points of the straight line segment and the arc are calculated, the intersection points of the straight line segment and the circle are calculated firstly, whether the intersection points are on the arc or not is judged according to angles of starting points and end points of the arc, and if the intersection points are on the arc, the intersection points are the intersection points of the straight line segment and the arc
And the new graph generating unit is used for generating a new graph after pruning, and then putting the new graph into the pruned graph to perform the next intersection point calculation until the pruning is finished.
And releasing the unit, finishing the trimming and releasing the trimmed graph.
The specific trimming unit further comprises:
the multi-line segment trimming unit is used for traversing each line segment of the multi-line segment, calculating the intersection point of the graph on the line segment according to a method for solving the intersection point of the line segment and other graphs, and then recording the distance and the number of the intersection point to the starting point of the multi-line segment; calculating the distance from the trimming point to the starting point of the multi-line segment, sequencing the distances from all the graph intersection points to the starting point of the multi-line segment from small to large, and acquiring the graph intersection points adjacent to the trimming point according to the distances from the graph intersection points to the starting point of the multi-line segment; and finally, changing the endpoint list of the multi-line segment and redrawing a new multi-line segment.
In the embodiment, the intersection point of the multi-line segment and the straight line segment, the intersection point of the multi-line segment and the multi-line segment, the intersection point of the multi-line segment and the circle, the intersection point of the multi-line segment and the character and the intersection point of the multi-line segment and the circular arc are calculated according to space geometry.
The specific trimming unit further comprises:
and a circle trimming unit, wherein the trimmed graph is a circle, and the angle between the connecting line of the trimming point and the circle center and the X axis is recorded. All the intersection points of the circle (the trimmed graph) and the trimmed graph are recorded, and then the angles between the connecting lines of all the intersection points and the circle center and the X axis are calculated. And sequencing all angles from small to large, acquiring adjacent graph intersection points of the trimming points, and drawing a new circular arc by taking two adjacent intersection points of the trimming points as a starting point and an end point of the new circular arc.
In the embodiment, the intersection point of a circle and a straight line segment and the intersection point of the circle and a multi-line segment are calculated according to space geometry, the intersection point of the circle and the circle is calculated according to three conditions of coplanarity (separation, tangency, intersection), non-coplanarity parallel, non-coplanarity and non-parallel, the intersection point calculation of the circle and the circular arc is carried out, whether the graphic intersection point is on the circular arc or not is increased on the basis of the calculation of the intersection point of the circle and the circle, and the calculation of the circle and the character is converted into the calculation of four edges of the circle and the character.
The specific trimming unit further comprises:
and the arc trimming unit is used for determining whether the trimmed graph is an arc or not, namely, judging whether the intersection point is on the arc or not is added on the basis of the calculation that the trimmed graph is a circle, and if the intersection point is not on the arc, the intersection point is not taken as the calculated intersection point.
The embodiment can realize the trimming of any number of any type of trimmed graphs when any number of any type of two-dimensional graphs are used as the trimmed graphs. The embodiment prunes according to the geometric attributes of the graph, and can adapt to various scenes.
EXAMPLE III
Referring to fig. 22, fig. 22 is a schematic structural diagram of an image cropping device based on space geometry according to the present embodiment. The image cropping device 20 based on spatial geometry of this embodiment comprises a processor 21, a memory 22 and a computer program stored in said memory 22 and executable on said processor 21. The processor 21 realizes the steps in the above-described method embodiments when executing the computer program. Alternatively, the processor 21 implements the functions of the modules/units in the above-described device embodiments when executing the computer program.
Illustratively, the computer program may be divided into one or more modules/units, which are stored in the memory 22 and executed by the processor 21 to accomplish the present invention. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions for describing the execution process of the computer program in the image cropping device 20 based on spatial geometry. For example, the computer program may be divided into the modules in the second embodiment, and for the specific functions of the modules, reference is made to the working process of the apparatus in the foregoing embodiment, which is not described herein again.
The image cropping device 20 based on spatial geometry may include, but is not limited to, a processor 21 and a memory 22. It will be appreciated by those skilled in the art that the schematic diagram is merely an example of the image cropping device 20 based on spatial geometry, and does not constitute a limitation of the image cropping device 20 based on spatial geometry, and may include more or less components than those shown, or some components may be combined, or different components, e.g., the image cropping device 20 based on spatial geometry may further include an input-output device, a network access device, a bus, etc.
The Processor 21 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, etc. The general purpose processor may be a microprocessor or the processor may be any conventional processor or the like, and the processor 21 is a control center of the space-geometry based image cropping device 20, and various interfaces and lines are used to connect various parts of the entire space-geometry based image cropping device 20.
The memory 22 may be used to store the computer programs and/or modules, and the processor 21 implements various functions of the image cropping device 20 based on spatial geometry by running or executing the computer programs and/or modules stored in the memory 22 and invoking data stored in the memory 22. The memory 22 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the cellular phone, and the like. In addition, the memory 22 may include high speed random access memory, and may also include non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), at least one magnetic disk storage device, a Flash memory device, or other volatile solid state storage device.
Wherein, the integrated modules/units of the image cropping device 20 based on space geometry can be stored in a computer readable storage medium if implemented in the form of software functional units and sold or used as independent products. Based on such understanding, all or part of the flow of the method according to the above embodiments may be implemented by a computer program, which may be stored in a computer readable storage medium and used by the processor 21 to implement the steps of the above embodiments of the method. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
It should be noted that the above-described device embodiments are merely illustrative, where the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. In addition, in the drawings of the embodiment of the apparatus provided by the present invention, the connection relationship between the modules indicates that there is a communication connection between them, and may be specifically implemented as one or more communication buses or signal lines. One of ordinary skill in the art can understand and implement it without inventive effort.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

Claims (10)

1. A method for pruning a graph based on space geometry comprises the following steps:
s1, acquiring the graph to be trimmed and acquiring the input trimmed graph;
s2, the trimmed graphs are straight line segments, intersection points of all the trimmed graphs and the straight line segments are calculated, and then the distance from the intersection points to the starting point of the straight line segments is calculated; then recording the distance from the trimming point to the starting point of the straight line segment; sequencing all distances from small to large, and acquiring a graph intersection point adjacent to the trimming point according to the distance from the straight line segment starting point; using the start point and the left intersection point of the straight line segment as the start point and the end point of a new straight line segment, using the right intersection point and the end point of the straight line segment as the start point and the end point, and redrawing the new straight line segment;
s3, placing the new graph generated after pruning into the pruned graph to perform the next intersection point calculation until pruning is finished;
and S4, finishing the trimming and releasing the trimmed graph.
2. The method of claim 1, step S2 further comprising:
s21, the clipped graph is a multi-line segment, each straight-line segment of the multi-line segment is traversed, the graph intersection point on the straight-line segment is calculated according to the method of solving the intersection point of the straight-line segment and other graphs, and then the distance and the number of the intersection point to the starting point of the multi-line segment are recorded; calculating the distance from the trimming point to the starting point of the multi-line segment, sequencing the distances from all the graph intersection points to the starting point of the multi-line segment from small to large, and acquiring the graph intersection points adjacent to the trimming point according to the distances from the graph intersection points to the starting point of the multi-line segment; and finally, changing the endpoint list of the multi-line segment and redrawing a new multi-line segment.
3. The method of claim 1, step S2 further comprising:
s22, the trimmed graph is a circle, and the angle between the connecting line of the trimming point and the circle center and the X axis is recorded; recording all intersection points of the trimmed circles and the trimmed graph, and calculating angles between connecting lines of all the intersection points and the circle center and the X axis; and sequencing all angles from small to large, acquiring adjacent graph intersection points of the trimming points, and drawing a new circular arc by taking two adjacent intersection points of the trimming points as a starting point and an end point of the new circular arc.
4. The method of claim 3, step S22 further comprising:
and S23, judging whether the clipped graph is an arc, and if the intersection point is not on the arc, the intersection point is not used as the calculation intersection point.
5. The method according to claim 1, wherein the step S1 specifically includes obtaining the trimming graph by a frame selection method.
6. A device for pruning a graph based on space geometry comprises the following units:
the clipped graph acquisition unit is used for acquiring a graph to be clipped and acquiring an input clipped graph;
the pruning unit is used for calculating the intersection points of all the pruned graphs and the straight line segments when the pruned graphs are straight line segments, and then calculating the distance from the intersection points to the starting point of the straight line segments; then recording the distance from the trimming point to the starting point of the straight line segment; sequencing all distances from small to large, and acquiring a graph intersection point adjacent to the trimming point according to the distance from the straight line segment starting point; using the start point and the left intersection point of the straight line segment as the start point and the end point of a new straight line segment, using the right intersection point and the end point of the straight line segment as the start point and the end point, and redrawing the new straight line segment;
the new graph generating unit is used for generating a new graph after trimming, and then placing the new graph into the selected two-dimensional graph to perform the next intersection point calculation until the trimming is finished;
and a release unit for ending the trimming and releasing the selected two-dimensional graph.
7. The device of claim 6, wherein the multi-line segment clipping unit is used for clipping the multi-line segment, traversing each line segment of the multi-line segment, calculating the intersection point of the graph on the line segment according to the intersection point solving method of the line segment and other graphs, and recording the distance and the number of the intersection point to the starting point of the multi-line segment; calculating the distance from the trimming point to the starting point of the multi-line segment, sequencing the distances from all the graph intersection points to the starting point of the multi-line segment from small to large, and acquiring the graph intersection points adjacent to the trimming point according to the distances from the graph intersection points to the starting point of the multi-line segment; and finally, changing the endpoint list of the multi-line segment and redrawing a new multi-line segment.
8. The apparatus of claim 6, wherein the circle trimming unit is configured to trim the pattern of the circle by recording an angle from the X-axis connecting the trimming point and the center of the circle; recording all intersection points of the trimmed circles and the trimmed graph, and calculating angles between connecting lines of all the intersection points and the circle center and the X axis; and sequencing all angles from small to large, acquiring adjacent graph intersection points of the trimming points, and drawing a new circular arc by taking two adjacent intersection points of the trimming points as a starting point and an end point of the new circular arc.
9. The apparatus according to claim 6, wherein the arc trimming unit is configured to determine whether the intersection is on the arc based on the calculation that the trimmed pattern is a circle, and if the intersection is not on the arc, the intersection is not regarded as the calculated intersection.
10. A non-volatile storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the method of any of claims 1 to 5.
CN202210135417.3A 2022-02-14 2022-02-14 Method, device and medium for pruning graph based on space geometry Pending CN114549550A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210135417.3A CN114549550A (en) 2022-02-14 2022-02-14 Method, device and medium for pruning graph based on space geometry

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210135417.3A CN114549550A (en) 2022-02-14 2022-02-14 Method, device and medium for pruning graph based on space geometry

Publications (1)

Publication Number Publication Date
CN114549550A true CN114549550A (en) 2022-05-27

Family

ID=81675939

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210135417.3A Pending CN114549550A (en) 2022-02-14 2022-02-14 Method, device and medium for pruning graph based on space geometry

Country Status (1)

Country Link
CN (1) CN114549550A (en)

Similar Documents

Publication Publication Date Title
US8194974B1 (en) Merge and removal in a planar map of an image
US5615317A (en) Method for blending edges of a geometric object in a computer-aided design system
CN109544658B (en) Map rendering method and device, storage medium and electronic device
CN109410213A (en) Polygon pel method of cutting out, computer readable storage medium, electronic equipment based on bounding box
CN116738579B (en) Automatic construction method and system for parting line of automobile panel
EP0538715B1 (en) Graphics processing system
CN114429535A (en) Smooth cutting method and device for triangular mesh curved surface
CN113744401A (en) Terrain splicing method and device, electronic equipment and storage medium
CN114549550A (en) Method, device and medium for pruning graph based on space geometry
CN111158840B (en) Image carousel method and device
CN115779424B (en) Navigation grid path finding method, device, equipment and medium
CN109727184B (en) Three-dimensional clipping circuit of graphic processor
CN115514945A (en) Doodling method and device, terminal equipment and storage medium
CN113844034B (en) Three-dimensional model punching processing method, printing method, related equipment and storage medium
JP3138933B2 (en) Modeling system
CN114627225A (en) Method and device for rendering graphics and storage medium
CN113867371A (en) Path planning method and electronic equipment
CN108446064B (en) Writing whiteboard-based area saving method and device, terminal equipment and medium
JP2021099792A (en) Method of selecting multiple edges and faces in modeled object
CN111784695A (en) Pattern cutting method and device, electronic equipment and storage medium
CN112837416A (en) Triangulation-based polygon rendering method and device and storage medium
CN106909721B (en) Editable section obtaining method and device
CN110704561A (en) Map edge pasting method, terminal device and storage medium
CN114296452B (en) Automatic parking path planning method, equipment and computer readable storage medium
CN113763508B (en) Vector data processing method, device and medium based on virtual engine

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