CN108257079B - Method and device for graphics conversion - Google Patents

Method and device for graphics conversion Download PDF

Info

Publication number
CN108257079B
CN108257079B CN201611250163.0A CN201611250163A CN108257079B CN 108257079 B CN108257079 B CN 108257079B CN 201611250163 A CN201611250163 A CN 201611250163A CN 108257079 B CN108257079 B CN 108257079B
Authority
CN
China
Prior art keywords
graph
path
nodes
position information
determining
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201611250163.0A
Other languages
Chinese (zh)
Other versions
CN108257079A (en
Inventor
王一卜
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Gridsum Technology Co Ltd
Original Assignee
Beijing Gridsum 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 Beijing Gridsum Technology Co Ltd filed Critical Beijing Gridsum Technology Co Ltd
Priority to CN201611250163.0A priority Critical patent/CN108257079B/en
Publication of CN108257079A publication Critical patent/CN108257079A/en
Application granted granted Critical
Publication of CN108257079B publication Critical patent/CN108257079B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/18Image warping, e.g. rearranging pixels individually

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The invention provides a graph transformation method and a device, which realize the graph transformation between any two graphs, and particularly obtain corresponding compensation parameters by obtaining the number of path nodes in a first graph and a second graph and the position information of each path node and performing path node compensation calculation on the graph with less path node number, thereby realizing the graph transformation between the first graph and the second graph by utilizing the position information of each path node in the first graph and the second graph and the compensation parameters according to a preset animation algorithm without depending on a specific graph editing tool, and having simple process and wide application range.

Description

Method and device for graphics conversion
Technical Field
The invention relates to the field of computer drawing, in particular to a graph transformation method and a graph transformation device.
Background
The vector graph is composed of a straight line and a curve, and is drawn by a vector method by adopting a drawing form based on a mathematical mode. Each object in the vector graphics has attributes of color, outline, size, shape, and the like. In practical applications, in order to improve the graphic drawing efficiency, vector drawing software, such as Adobe Illustrator, i.e. AI tool, is usually used to perform vector graphic drawing to meet the actual needs. Therefore, when a new graph needs to be obtained, the prior art usually redraws the new graph by using vector drawing software, and cannot obtain the needed new graph by using the existing graph transformation, which affects the experience of a user when the user uses the vector drawing software to draw the graph.
Disclosure of Invention
In view of the above, the present invention provides a method and apparatus for graphics transformation that overcomes, or at least partially solves, the above problems.
The invention provides a graph transformation method, which comprises the following steps:
determining a first graph and a second graph to be processed;
acquiring the number of path nodes in the first graph and the second graph and the position information of each path node;
performing path node compensation calculation on the graph with less path node number in the first graph and the second graph, and determining a compensation parameter, wherein the compensation parameter comprises the number of path nodes to be compensated and the position information of each path node to be compensated;
and realizing graph transformation between the first graph and the second graph according to a preset animation algorithm based on the compensation parameters and the position information of each path node in the first graph and the second graph.
Preferably, after the determining the first graph and the second graph to be processed and before the acquiring the number of path nodes in the first graph and the second graph and the location information of each path node, the method further includes:
judging whether the first graph and the second graph are vector graphs or not, wherein the vector graphs are graphs drawn based on path nodes;
and converting the graphics which are not vector graphics in the first graphics and the second graphics into vector graphics based on the judgment result.
Preferably, the performing path node compensation calculation on the graph with the smaller number of path nodes in the first graph and the second graph, and determining a compensation parameter includes:
judging whether the number of the path nodes in the first graph is equal to that of the path nodes in the second graph;
if not, acquiring a difference value between the number of the path nodes in the first graph and the number of the path nodes in the second graph;
determining a compensation parameter based on the difference value and the position information of each of the path nodes in the first graph and the second graph.
Preferably, the determining a compensation parameter based on the difference value and the position information of each path node in the first graph and the second graph includes:
determining the difference as the number of path nodes to be compensated in the graph with less path node number in the first graph and the second graph;
determining a positional relationship between each of the path nodes in the first graph and the second graph based on the positional information of each of the path nodes in the first graph and the second graph;
determining position information of each path node to be compensated in a graph with a smaller number of path nodes in the first graph and the second graph based on a position relationship between each path node in the graph with a larger number of path nodes in the first graph and the second graph;
and determining the number of the path nodes to be compensated and the position information of each path node to be compensated as compensation parameters.
Preferably, the determining, based on a position relationship between each path node in a graph having a larger number of path nodes in the first graph and the second graph, position information of each path node to be compensated in a graph having a smaller number of path nodes in the first graph and the second graph, includes:
when the number of path nodes in the converted graph is more than that of the converted graph in the first graph and the second graph, determining position information corresponding to any position on the path in the converted graph as position information of each path node to be compensated;
and when the number of path nodes in the transformed graph is less than that of the transformed graph in the first graph and the second graph, selecting two path nodes in the transformed graph based on the position relationship between each path node in the graph with the larger number of path nodes in the first graph and the second graph, and determining the position information of one path node needing to be compensated on the extension line of the selected two path nodes until the position information of each path node needing to be compensated is determined.
Preferably, the implementing, according to a preset animation algorithm, a graph transformation between the first graph and the second graph based on the compensation parameter and the position information of each path node in the first graph and the second graph includes:
determining a position corresponding to position information of each path node to be compensated in a graph with a smaller number of path nodes in the first graph and the second graph based on the compensation parameter, and inserting the corresponding path node to be compensated at each corresponding position;
obtaining position change information between corresponding path nodes in a graph with the current inserted path node and a graph without the inserted path node;
and realizing graph transformation between the first graph and the second graph according to a preset animation algorithm based on the position change information.
A graphics translation device, the device comprising:
the graph determining module is used for determining a first graph and a second graph to be processed;
a path node obtaining module, configured to obtain the number of path nodes in the first graph and the second graph and location information of each path node;
the compensation calculation module is used for performing path node compensation calculation on the graph with less path node number in the first graph and the second graph and determining a compensation parameter, wherein the compensation parameter comprises the number of path nodes to be compensated and the position information of each path node to be compensated;
and the graph transformation module is used for realizing the graph transformation between the first graph and the second graph according to a preset animation algorithm based on the compensation parameters and the position information of each path node in the first graph and the second graph.
Preferably, the apparatus further comprises:
the judging module is used for judging whether the first graph and the second graph are vector graphs or not, and the vector graphs are graphs drawn based on path nodes;
and the graph conversion module is used for converting the graph which is not the vector graph in the first graph and the second graph into the vector graph based on the judgment result.
Preferably, the compensation calculating module includes:
the judging unit is used for judging whether the number of the path nodes in the first graph is equal to that of the path nodes in the second graph;
a difference value obtaining unit, configured to obtain a difference value between the number of path nodes in the first graph and the number of path nodes in the second graph when the determination results of the determining unit are unequal;
a compensation parameter determination unit configured to determine a compensation parameter based on the difference value and position information of each of the path nodes in the first graph and the second graph.
Preferably, the compensation parameter determination unit includes:
a compensation number determining subunit, configured to determine the difference as the number of path nodes to be compensated in a graph with a smaller number of path nodes in the first graph and the second graph;
a positional relationship determination subunit configured to determine a positional relationship between each of the path nodes in the first graph and the second graph based on positional information of each of the path nodes in the first graph and the second graph;
a compensation position information determining subunit, configured to determine, based on a position relationship between each path node in a graph with a larger number of path nodes in the first graph and the second graph, position information of each path node to be compensated in a graph with a smaller number of path nodes in the first graph and the second graph;
and the compensation parameter determining subunit is used for determining the number of the path nodes to be compensated and the position information of each path node to be compensated as the compensation parameters.
Preferably, the graphics transformation module includes:
a path node insertion unit, configured to determine, based on the compensation parameter, a position corresponding to position information of each path node to be compensated in a graph having a smaller number of path nodes in the first graph and the second graph, and insert the corresponding path node to be compensated at each corresponding position;
a position change information obtaining unit, configured to obtain position change information between corresponding path nodes in a graph into which a path node is currently inserted and a graph into which a path node is not inserted;
and the graph transformation unit is used for realizing the graph transformation between the first graph and the second graph according to a preset animation algorithm based on the position change information.
By means of the technical scheme, the invention provides a graph transformation method and a graph transformation device, which are used for realizing graph transformation between any two graphs, and particularly, the number of path nodes in a first graph and a second graph and the position information of each path node are obtained, path node compensation calculation is carried out on the graph with less path node number, and corresponding compensation parameters, such as the number of the path nodes needing to be compensated and the position information of each path node needing to be compensated, are obtained, so that the position information of each path node in the first graph and the second graph and the compensation parameters are utilized, the graph transformation between the first graph and the second graph is realized according to a preset animation algorithm, a specific graph editing tool is not required, and the process is simple and wide in application range.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
FIG. 1 is a flow chart illustrating one embodiment of a method for graph transformation provided by the present invention;
FIG. 2 is a flow chart illustrating another embodiment of a method for graph transformation provided by the present invention;
3(a) -3 (d) are schematic diagrams illustrating a graph transformation process provided by the present invention;
FIG. 4 is a block diagram illustrating an embodiment of a graphics converter provided in the present invention;
FIG. 5 is a block diagram of another embodiment of a graphics converter apparatus according to the present invention;
FIG. 6 is a block diagram illustrating a portion of another embodiment of a graphics converter;
FIG. 7 is a block diagram illustrating a portion of another embodiment of a graphics converter;
FIG. 8 is a block diagram illustrating a portion of another embodiment of a graphics converter;
fig. 9 is a schematic diagram illustrating a hardware structure of a graphics converter according to the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
As shown in fig. 1, which is a flowchart of an embodiment of a method for transforming a graph provided in the present invention, the method may include:
step S11, determining a first graph and a second graph to be processed;
the application can realize the transformation between any two figures, so the first figure and the second figure can be any regular figure or irregular figure, such as simple square, circle, triangle, or complex figures such as various animals, people, scenery or buildings. The present application does not limit the specific contents of the first graphic and the second graphic.
It should be noted that the first graphic and the second graphic are two different graphics.
Step S12, acquiring the number of path nodes in the first graph and the second graph and the position information of each path node;
it should be noted that, in the present application, a specific manner for calculating the number of path nodes of a graph is not limited, and SVG (Scalable Vector Graphics) animation algorithm may be used for calculation, or of course, other animation algorithm may be used for calculation, and this application is not listed here.
In practical application, each path of the graph is generally composed of a plurality of path nodes, and the unit for determining one path node can be different according to different requirements.
In addition, in the present application, after determining a position reference point (e.g., an origin of coordinates), the position information of each path node in the image relative to the position reference point may be determined, that is, the position information of each path node in the first graph and the second graph is determined, such as determining the position coordinates of each path node.
In practical applications, the position information of each path node in the graph may be input by a user, the method for determining the position information of the path node is not limited in the present application, and the specific shapes of the first graph and the second graph may be represented by the position relationship between the position information of each path node.
Step S13, path node compensation calculation is carried out on the graph with less path node number in the first graph and the second graph, and compensation parameters are determined;
since the path nodes of the two graphs subjected to graph transformation are required to be the same, the number of the path nodes of the first graph is compared with the number of the path nodes of the second graph, and after the number of the path nodes of the first graph is determined to be different from the number of the path nodes of the second graph, the compensation algorithm can be used for compensating the path nodes of the graphs with fewer path nodes, so that the compensated graph is the same as the path nodes of the other uncompensated graph.
It should be noted that, in the present application, the compensation algorithm used for path node compensation of the graph is not limited. Alternatively, the present application may implement the path node compensation calculation for the graph with fewer path nodes by using an interpolation algorithm, as described in the following embodiments, but is not limited to this implementation. Based on the above analysis, the compensation parameters obtained by the present invention may include the number of path nodes to be compensated and the location information of each path node to be compensated. Specifically, the number of path nodes to be inserted into the graph with fewer path nodes and the position of each path node to be inserted into the graph can be determined in the above manner, so that the path node insertion operation can be realized according to the information.
It can be seen that the compensation reference determined above can be used as a transformation parameter when transforming the first graph with the second graph. The method is not limited to the above list, and especially when the graph transformation between complex graphs is performed, the method may further include information of a change trend of the path, such as a path radian, which may be determined according to actual needs, and this application is not listed here.
And step S14, realizing graph transformation between the first graph and the second graph according to a preset animation algorithm based on the compensation parameters and the position information of each path node in the first graph and the second graph.
In the practical application of the embodiment, each electronic device usually has an animation processing function, that is, a corresponding animation algorithm is built in, so that the graphic transformation scheme of the invention can be realized on any interface of the electronic device; of course, the graphic transformation scheme provided by the invention can also be applied to various graphic editing tools, and has strong applicability.
The preset animation algorithm can be an SVG animation algorithm or other animation algorithms, and the specific algorithm content is not limited in the application.
Optionally, in this embodiment, the calculation results of the path nodes of the first graph and the second graph may be written into a path of a preset animation algorithm, and an animation tag and corresponding attributes are added, and meanwhile, animation movement parameters, such as path node position change information and the like, for converting the first graph into the second graph may be determined based on the compensation parameters and the position information of each path node in the first graph and the second graph, and then, the animation tag, the animation attributes, and the animation movement parameters of the preset animation algorithm may be updated, and the updated preset animation algorithm may be executed, so as to convert the first graph into the second graph.
Wherein, animation is an animation element in the SVG animation algorithm, and represents that the standard attribute and the value of the attribute value can be changed in real time; the path may indicate that SVG allows path attributes of SVG to specify a path attribute for an animation element, which is also an animation element in the SVG animation algorithm, indicating that the element is moved along an animation path.
Therefore, in the process of transforming the first graph into the second graph, the information such as the label and the attribute determined by the path node information of the second graph can be used as the target animation element and the target attribute of animation transformation, so that the preset animation drawing method can be executed to realize the transformation between the two graphs.
As shown in fig. 2, which is a flowchart of another embodiment of a method for transforming a graph provided by the present invention, the method may include:
step S21, determining a first graph and a second graph to be processed;
step S22, judging whether the first graph and the second graph are vector graphs or not;
the vector graph in the present application refers to a vector graph drawn based on a path node.
A step S23 of converting the graphics other than the vector graphics of the first graphics and the second graphics into vector graphics based on the judgment result;
specifically, in this embodiment, a graph that is not a path in the first graph and the second graph may be converted into a path, and a specific implementation process of converting an image into a path is not limited in the present invention.
Step S24, acquiring the number of path nodes in the first graph and the second graph and the position information of each path node;
step S25, judging whether the number of the path nodes of the first graph is larger than that of the path nodes of the second graph, if not, entering step S26; if yes, go to step S27;
step S26, performing compensation calculation on the path node of the first graph, and determining a first compensation parameter aiming at the first graph;
as can be seen from the description of the compensation parameters in the foregoing embodiments, the first compensation parameter may include the number of path nodes to be compensated of the first graph, and the location information of each path node to be compensated.
Step S27, performing compensation calculation on the path node of the second graph, and determining a second compensation parameter aiming at the second graph;
similarly, the second compensation parameter may include the number of path nodes to be compensated for by the second graph, and the location information of each path node to be compensated.
It should be noted that, for the compensation calculation process for the path node of the graph in this embodiment, reference may be made to the description of the corresponding part of the foregoing embodiment, and this embodiment is not described herein again.
For example, when the first graph is a square and the second graph is a triangle, obviously, the path node of the square is larger than the path node of the triangle, and at this time, if the vertices of the square are named as a1, a2, a3 and a4 once, and the corresponding triangle only has a1, a2 and a3, in order to obtain the triangle, a point can be determined to be a4 on any path of the triangle, that is, any point can be determined to be a4 on a connecting line between a1, a2 and a3 of the square, so that in the process of transforming the square into the triangle, the determined a1, a2, a3 and a4 on the connecting line between any two nodes thereof can be used as a reference to transform to obtain the triangle. It should be noted that the three path nodes of the triangle selected from the four path nodes of the square are not limited, and may be a1, a2, and a 3; a1, a2 and a 4; a2, a3, a4, and the like.
It can be seen that, in this embodiment, the determined compensation reference may include the number of path nodes to be inserted by the triangle, the position information thereof, and the like.
Of course, the above-mentioned square is still converted into a triangle as an example for explanation, except that the compensation parameter is determined in the above-mentioned manner, the present application may determine, according to the specific shape of the graph, which two path node coordinates the path node to be compensated should be inserted between after determining the coordinate position of each path node of the graph, and reestablish the corresponding relationship between each path node after the triangle is inserted and the path node in the square.
In contrast to the above-described embodiment, that is, when it is necessary to transform a triangle into a square, referring to fig. 3(d), in the above analysis manner, based on the graph shape of the square (which may be determined based on the positional relationship between each path node in the square), two path nodes may be selected in the triangle, and on the extended lines of the two selected path nodes (e.g., the dashed lines in fig. 3 (d)), the positional information of one path node to be compensated, e.g., point a4 in fig. 3(d), is determined.
In the process of determining the compensation parameters in the above manner, when the specific graph shapes of the first graph and the second graph and the difference between the number of path nodes included in the first graph and the second graph are different, the manner of determining the position information of the path node to be compensated may be adaptively adjusted, and particularly, when the position information of the path node to be compensated needs to be determined on the extension lines of two path nodes, only the position information of one path node to be compensated is generally determined on each extension line of the path node, so in this case, a plurality of extension lines of the path node may be determined, so as to determine the position information of a corresponding plurality of path nodes to be compensated, the process is similar to the determination process shown in fig. 3(d), and details are not described herein.
And step S28, converting the first graph into the second graph according to a preset animation algorithm based on the position information of each path node in the first graph and the second graph and the first compensation parameter or the second compensation parameter.
Still taking the example that the first graph is square and the second graph is triangle as an example, the graph transformation process shown in fig. 3(a) to 3(c) shows a transformation process from square to triangle. Wherein, the first graph, the second graph and the graph transformation process are sequentially marked from left to right in the figure.
As shown in fig. 3(a) to 3(c), in the process of transforming the square into the triangle, the square can be rotated as a whole, and the position of the fourth path node of the square and the two sides where the fourth path node is located are gradually moved by taking three path nodes as the vertices of the triangle, so as to finally obtain the required triangle.
As shown in fig. 3(d), after the position information of the path node to be compensated is determined in the above manner in the process of converting the triangle into the square, the path node on the path between a2 and a3 may be moved to the compensated path node according to the square graph shape by using this as a reference, and the required square is finally obtained in the graph conversion process from left to right in fig. 3 (d).
In summary, when another graph different from the existing graph needs to be obtained, the graph transformation method can be adopted to transform the existing graph into the required graph without newly making a new graph, so that the storage space is saved, and the graph transformation process does not need to depend on a specific graph editing tool, and is convenient, convenient and flexible.
Referring to fig. 4, a block diagram of an embodiment of a graphics conversion apparatus provided in the present invention is shown, where the apparatus may include:
a graph determining module 41, configured to determine a first graph and a second graph to be processed;
optionally, as shown in fig. 5, the apparatus may further include:
a judging module 45, configured to judge whether the first graph and the second graph are vector graphs;
and a graph conversion module 46, configured to convert, based on the determination result, a graph that is not a vector graph of the first graph and the second graph into a vector graph.
In practical applications, after determining that the first graph and the second graph to be converted are vector graphs, the subsequent path node calculation module 42 is triggered to calculate the number of path nodes of each graph.
A path node obtaining module 42, configured to obtain the number of path nodes in the first graph and the second graph and position information of each path node;
as described in the corresponding part of the above embodiment of the method, the present invention does not limit the specific process of calculating the number of path nodes of the graph and obtaining the location information of each path node.
A compensation calculation module 43, configured to perform path node compensation calculation on a graph with a smaller number of path nodes in the first graph and the second graph, and determine a compensation parameter;
in this embodiment, the determined compensation parameter may include the number of path nodes to be compensated, the location information of each path node to be compensated, and the like, and the specific content included in the compensation parameter is not limited in this application.
In the present embodiment, as shown in fig. 6, the compensation calculating means 43 may include:
a determining unit 431, configured to determine whether the number of path nodes in the first graph is equal to that in the second graph;
a difference obtaining unit 432, configured to obtain a difference between the number of path nodes in the first graph and the number of path nodes in the second graph when the determination result of the determining unit is unequal;
a compensation parameter determining unit 433, configured to determine a compensation parameter based on the difference and the location information of each of the path nodes in the first graph and the second graph.
A graph transformation module 44, configured to implement, based on the compensation parameter and the location information of each path node in the first graph and the second graph, a graph transformation between the first graph and the second graph according to a preset animation algorithm.
Optionally, as shown in fig. 7, the compensation parameter determining unit 433 in the above embodiment may include:
a compensation number determining subunit 4331, configured to determine the difference as the number of path nodes to be compensated in a graph with a smaller number of path nodes in the first graph and the second graph;
a positional relationship determining subunit 4332, configured to determine a positional relationship between each of the path nodes in the first graph and the second graph based on the positional information of each of the path nodes in the first graph and the second graph;
a compensation position information determining subunit 4333, configured to determine, based on a position relationship between each path node in a graph with a larger number of path nodes in the first graph and the second graph, position information of each path node to be compensated in a graph with a smaller number of path nodes in the first graph and the second graph;
in practical application of this embodiment, when the number of path nodes in the converted graph is greater than the number of path nodes in the converted graph in the first graph and the second graph, the position information corresponding to any position on the path in the converted graph is determined as the position information of each path node to be compensated; and when the number of path nodes in the transformed graph is less than that of the transformed graph in the first graph and the second graph, selecting two path nodes in the transformed graph based on the position relationship between each path node in the graph with the larger number of path nodes in the first graph and the second graph, and determining the position information of one path node needing to be compensated on the extension line of the selected two path nodes until the position information of each path node needing to be compensated is determined. A subunit 4334, configured to determine, as compensation parameters, the number of path nodes to be compensated and the position information of each path node to be compensated
Optionally, on the basis of the foregoing embodiment, as shown in fig. 8, the graphics transformation module 44 may include:
a path node insertion unit 441, configured to determine, based on the compensation parameter, a position corresponding to position information of each path node to be compensated in a graph having a smaller number of path nodes in the first graph and the second graph, and insert the corresponding path node to be compensated at each corresponding position;
a location change information obtaining unit 442, configured to obtain location change information between corresponding path nodes in a graph with a currently inserted path node and a graph with no inserted path node;
and a graph transformation unit 443, configured to implement graph transformation between the first graph and the second graph according to a preset animation algorithm based on the position change information.
Referring to fig. 9, the present invention further provides a schematic diagram of a hardware structure for implementing the graphics conversion apparatus, where the apparatus may include: a processor 91 and a memory 92, wherein each functional module in the device embodiment described in the functional architecture can be stored in the memory 92 as a program unit, and each program unit stored in the memory 92 is executed by the processor 91, so as to realize the corresponding function.
The hardware configuration of the graphics conversion apparatus is not limited to the processor 91 and the memory 92, and may include a communication interface, a communication bus, and the like that implement the above functions.
The processor 91 may include a kernel, and the kernel calls the corresponding program unit from the memory 92. The kernel may be set to be one or more than one, and animation transformation between any two graphs is implemented by adjusting kernel parameters, and the specific implementation process may refer to the description of the corresponding part of the above method embodiment, which is not described herein again.
The memory 92 may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip.
In summary, in this embodiment, the number of path nodes in the first graph and the second graph and the position information of each path node are obtained, and path node compensation calculation is performed on the graph with the smaller number of path nodes to obtain corresponding compensation parameters, so that graph transformation between the first graph and the second graph (i.e., any two different graphs) is realized according to a preset animation algorithm by using the position information of each path node in the first graph and the second graph and the compensation parameters, without depending on a specific graph editing tool, and the process is simple and has a wide application range.
The invention also provides a computer program product, which, when performing a graph transformation, is able to execute the program code of the following method steps:
determining a first graph and a second graph to be processed;
acquiring the number of path nodes in the first graph and the second graph and the position information of each path node;
performing path node compensation calculation on the graph with less path node number in the first graph and the second graph, and determining a compensation parameter, wherein the compensation parameter may include path node data to be compensated and position information of each path node to be compensated;
and realizing graph transformation between the first graph and the second graph according to a preset animation algorithm based on the compensation parameters and the position information of each path node in the first graph and the second graph.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (5)

1. A method of graphics transformation, the method comprising:
determining a first graph and a second graph to be processed;
acquiring the number of path nodes in the first graph and the second graph and the position information of each path node;
performing path node compensation calculation on the graph with less path node number in the first graph and the second graph, and determining a compensation parameter, wherein the compensation parameter comprises the number of path nodes to be compensated and the position information of each path node to be compensated;
based on the compensation parameters and the position information of each path node in the first graph and the second graph, realizing graph transformation between the first graph and the second graph according to a preset animation algorithm;
wherein the performing path node compensation calculation on the graph with the smaller number of path nodes in the first graph and the second graph and determining a compensation parameter includes:
judging whether the number of the path nodes in the first graph is equal to that of the path nodes in the second graph;
if not, acquiring a difference value between the number of the path nodes in the first graph and the number of the path nodes in the second graph;
determining a compensation parameter based on the difference value and the position information of each path node in the first graph and the second graph;
wherein the determining a compensation parameter based on the difference value and the location information of each of the path nodes in the first graph and the second graph comprises:
determining the difference as the number of path nodes to be compensated in the graph with less path node number in the first graph and the second graph;
determining a positional relationship between each of the path nodes in the first graph and the second graph based on the positional information of each of the path nodes in the first graph and the second graph;
determining position information of each path node to be compensated in a graph with a smaller number of path nodes in the first graph and the second graph based on a position relationship between each path node in the graph with a larger number of path nodes in the first graph and the second graph;
determining the number of the path nodes to be compensated and the position information of each path node to be compensated as compensation parameters;
wherein the determining, based on the position relationship between each path node in the graph with a larger number of path nodes in the first graph and the second graph, the position information of each path node to be compensated in the graph with a smaller number of path nodes in the first graph and the second graph includes:
when the number of path nodes in the converted graph is more than that of the converted graph in the first graph and the second graph, determining position information corresponding to any position on the path in the converted graph as position information of each path node to be compensated;
and when the number of path nodes in the converted graph is less than that of the converted graph in the first graph and the second graph, selecting two path nodes in the converted graph based on the position relation between each path node in the graph with the larger number of path nodes in the first graph and the second graph, and determining the position information of one path node needing to be compensated on the extension line of the selected two path nodes until the position information of each path node needing to be compensated is determined.
2. The method according to claim 1, wherein after the determining the first graph and the second graph to be processed and before the obtaining the number of path nodes in the first graph and the second graph and the position information of each path node, the method further comprises:
judging whether the first graph and the second graph are vector graphs or not, wherein the vector graphs are graphs drawn based on path nodes;
and converting the graphics which are not vector graphics in the first graphics and the second graphics into vector graphics based on the judgment result.
3. The method according to any one of claims 1-2, wherein the implementing the graph transformation between the first graph and the second graph according to a preset animation algorithm based on the compensation parameter and the position information of each path node in the first graph and the second graph comprises:
determining a position corresponding to position information of each path node to be compensated in a graph with a smaller number of path nodes in the first graph and the second graph based on the compensation parameter, and inserting the corresponding path node to be compensated at each corresponding position;
obtaining position change information between corresponding path nodes in a graph with the current inserted path node and a graph without the inserted path node;
and realizing graph transformation between the first graph and the second graph according to a preset animation algorithm based on the position change information.
4. An apparatus for graphics conversion, the apparatus comprising:
the graph determining module is used for determining a first graph and a second graph to be processed;
a path node obtaining module, configured to obtain the number of path nodes in the first graph and the second graph and location information of each path node;
the compensation calculation module is used for performing path node compensation calculation on the graph with less path node number in the first graph and the second graph and determining a compensation parameter, wherein the compensation parameter comprises the number of path nodes to be compensated and the position information of each path node to be compensated;
the graph transformation module is used for realizing graph transformation between the first graph and the second graph according to a preset animation algorithm based on the compensation parameters and the position information of each path node in the first graph and the second graph;
wherein the compensation calculation module comprises:
the judging unit is used for judging whether the number of the path nodes in the first graph is equal to that of the path nodes in the second graph;
a difference value obtaining unit, configured to obtain a difference value between the number of path nodes in the first graph and the number of path nodes in the second graph when the determination results of the determining unit are unequal;
a compensation parameter determination unit configured to determine a compensation parameter based on the difference value and position information of each of the path nodes in the first graph and the second graph;
wherein the compensation parameter determination unit includes:
a compensation number determining subunit, configured to determine the difference as the number of path nodes to be compensated in a graph with a smaller number of path nodes in the first graph and the second graph;
a positional relationship determination subunit configured to determine a positional relationship between each of the path nodes in the first graph and the second graph based on positional information of each of the path nodes in the first graph and the second graph;
a compensation position information determining subunit, configured to determine, based on a position relationship between each path node in a graph with a larger number of path nodes in the first graph and the second graph, position information of each path node to be compensated in the graph with a smaller number of path nodes in the first graph and the second graph, including: when the number of path nodes in the converted graph is more than that of the converted graph in the first graph and the second graph, determining position information corresponding to any position on the path in the converted graph as position information of each path node to be compensated; when the number of path nodes in the transformed graph is less than that of the transformed graph in the first graph and the second graph, selecting two path nodes in the transformed graph based on the position relationship between each path node in the graph with the larger number of path nodes in the first graph and the second graph, and determining the position information of one path node needing to be compensated on the extension line of the selected two path nodes until the position information of each path node needing to be compensated is determined;
and the compensation parameter determining subunit is used for determining the number of the path nodes to be compensated and the position information of each path node to be compensated as the compensation parameters.
5. The apparatus of claim 4, further comprising:
the judging module is used for judging whether the first graph and the second graph are vector graphs or not, and the vector graphs are graphs drawn based on path nodes;
and the graph conversion module is used for converting the graph which is not the vector graph in the first graph and the second graph into the vector graph based on the judgment result.
CN201611250163.0A 2016-12-29 2016-12-29 Method and device for graphics conversion Active CN108257079B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611250163.0A CN108257079B (en) 2016-12-29 2016-12-29 Method and device for graphics conversion

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611250163.0A CN108257079B (en) 2016-12-29 2016-12-29 Method and device for graphics conversion

Publications (2)

Publication Number Publication Date
CN108257079A CN108257079A (en) 2018-07-06
CN108257079B true CN108257079B (en) 2021-07-27

Family

ID=62722007

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611250163.0A Active CN108257079B (en) 2016-12-29 2016-12-29 Method and device for graphics conversion

Country Status (1)

Country Link
CN (1) CN108257079B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11605190B1 (en) 2021-09-01 2023-03-14 Toyota Research Institute, Inc. System and method for de-biasing graphical information

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1330836A (en) * 1998-12-15 2002-01-09 松下电器产业株式会社 Method and apparatus for image processing
CN101785684A (en) * 2010-01-27 2010-07-28 天津大学 Ultrasonic endoscopic synthetic aperture imaging system and synthetic method of larger aperture
JP2011223340A (en) * 2010-04-09 2011-11-04 Ntt Docomo Inc Moving image encoding device, moving image decoding device, moving image encoding method, moving image decoding method, moving image encoding program, and moving image decoding program
CN102411786A (en) * 2010-09-29 2012-04-11 微软公司 Low complexity method for motion compensation of dwt based systems
KR20120111477A (en) * 2011-03-31 2012-10-10 이엔유 주식회사 Translating method from xml dcs drawing data to object oriented simulation data
CN102736557A (en) * 2011-04-07 2012-10-17 杨建国 Numerical control machine tool error real-time compensation system based on virtual instrument
CN104811637A (en) * 2014-01-24 2015-07-29 株式会社理光 Projection system, image processing apparatus, and correction method
CN104917931A (en) * 2015-05-28 2015-09-16 京东方科技集团股份有限公司 Moving image compensation method and device and display device
CN106251304A (en) * 2015-09-11 2016-12-21 深圳市理邦精密仪器股份有限公司 Dynamic image segmented system and method
CN107850777A (en) * 2015-04-22 2018-03-27 易赛特股份有限公司 The method and apparatus of optical aberrations correction

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7848566B2 (en) * 2004-10-22 2010-12-07 Carnegie Mellon University Object recognizer and detector for two-dimensional images using bayesian network based classifier
CN104484803A (en) * 2014-11-24 2015-04-01 苏州福丰科技有限公司 Mobile phone payment method employing three-dimensional human face recognition based on neural network
CN105119250B (en) * 2015-07-22 2017-12-01 国电南瑞科技股份有限公司 Relay protection Remote Dynamic methods of exhibiting based on Data Integration

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1330836A (en) * 1998-12-15 2002-01-09 松下电器产业株式会社 Method and apparatus for image processing
CN101785684A (en) * 2010-01-27 2010-07-28 天津大学 Ultrasonic endoscopic synthetic aperture imaging system and synthetic method of larger aperture
JP2011223340A (en) * 2010-04-09 2011-11-04 Ntt Docomo Inc Moving image encoding device, moving image decoding device, moving image encoding method, moving image decoding method, moving image encoding program, and moving image decoding program
CN102411786A (en) * 2010-09-29 2012-04-11 微软公司 Low complexity method for motion compensation of dwt based systems
KR20120111477A (en) * 2011-03-31 2012-10-10 이엔유 주식회사 Translating method from xml dcs drawing data to object oriented simulation data
CN102736557A (en) * 2011-04-07 2012-10-17 杨建国 Numerical control machine tool error real-time compensation system based on virtual instrument
CN104811637A (en) * 2014-01-24 2015-07-29 株式会社理光 Projection system, image processing apparatus, and correction method
CN107850777A (en) * 2015-04-22 2018-03-27 易赛特股份有限公司 The method and apparatus of optical aberrations correction
CN104917931A (en) * 2015-05-28 2015-09-16 京东方科技集团股份有限公司 Moving image compensation method and device and display device
CN106251304A (en) * 2015-09-11 2016-12-21 深圳市理邦精密仪器股份有限公司 Dynamic image segmented system and method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于GDI+的矢量图形几何变换原理研究;丁健生;《科技天地》;20101231;第46-47页 *

Also Published As

Publication number Publication date
CN108257079A (en) 2018-07-06

Similar Documents

Publication Publication Date Title
CN109118456B (en) Image processing method and device
CN110458772B (en) Point cloud filtering method and device based on image processing and storage medium
CN110852949B (en) Point cloud data completion method and device, computer equipment and storage medium
US20200327078A1 (en) Data processing method and device, dma controller, and computer readable storage medium
CN107610146A (en) Image scene segmentation method, apparatus, computing device and computer-readable storage medium
CN109445901B (en) Method and device for drawing vector graphics tool in cross-file format
US10783685B2 (en) Banner image generation
CN111768353B (en) Hole filling method and device for three-dimensional model
CN104391991A (en) Method for converting AutoCAD data into GIS spatial data
CN116309823A (en) Pose determining method, pose determining device, pose determining equipment and storage medium
CN108257079B (en) Method and device for graphics conversion
CN109522532B (en) Method and device for calculating selection range of line drawing frame
CN110435154A (en) For the image processing method of 3D printing, device, electronic equipment and storage medium
US20230419561A1 (en) Three-dimensional model rendering method and apparatus, device, storage medium, and program product
CN111027543B (en) Image annotation method and device
CN113282534A (en) System on chip, data processing method thereof and neural network device
US20210110202A1 (en) 3d object detection from calibrated 2d images
CN107256004B (en) Product processing method and device
US20220111515A1 (en) Method and Apparatus for Managing Robot Program
CN114549303B (en) Image display method, image processing method, image display device, image processing apparatus, image display device, image processing program, and storage medium
CN115431270A (en) Robot-assisted positioning method, device and medium based on two-dimensional code label
CN116805085A (en) 3D-to-2D information conversion method, device, equipment and storage medium for parts
US10360707B2 (en) Information processing apparatus, information processing method, and storage medium for transforming path
CN110020285B (en) Histogram processing method and device
CN109410304B (en) Projection determination method, device and equipment

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
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 100080 No. 401, 4th Floor, Haitai Building, 229 North Fourth Ring Road, Haidian District, Beijing

Applicant after: Beijing Guoshuang Technology Co.,Ltd.

Address before: 100086 Cuigong Hotel, 76 Zhichun Road, Shuangyushu District, Haidian District, Beijing

Applicant before: Beijing Guoshuang Technology Co.,Ltd.

GR01 Patent grant
GR01 Patent grant