Method, apparatus, readable storage medium, and electronic device for generating vector graphics

By identifying and segmenting graphic elements, comparing the similarity with preset vector elements, and generating vector graphics, it solves the time-consuming and labor-intensive problem of manually drawing complex charts, and achieves efficient and beautiful vector graphics generation.

CN115761043BActive Publication Date: 2025-07-22MR SEMICON LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202211434737.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-16
Publication Date
2025-07-22
Estimated Expiration
2042-11-16

AI Technical Summary

Technical Problem

In the prior art, when drawing complex charts, users need to manually make components and adjust connections, which makes them time-consuming and labor-consuming and difficult to meet the drawing requirements.

Method used

By acquiring graphic elements, identifying and segmenting processes, comparing the similarity to preset vector elements, determining the target vector elements, and generating vector graphics based on these elements, including linear transformation and layout parameter adjustments.

Benefits of technology

It improves the efficiency of drawing, lowers the drawing threshold, enhances the aesthetics and propagation of vector graphics, and ensures the accuracy and credibility of graphics.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115761043B_ABST
    Figure CN115761043B_ABST
Patent Text Reader

Abstract

The present invention provides a method, an apparatus, a readable storage medium, and an electronic device for generating a vector graphic. The method for generating a vector graphic includes: in response to a first input, obtaining a first graphic; performing an identification process and / or a segmentation process on the first graphic to obtain graphic elements to be vectorized; determining a target vector component according to a comparison result between the graphic elements to be vectorized and a preset vector component; generating a vector graphic corresponding to the first graphic according to the target vector component; wherein the vector graphic includes the target vector component.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data processing, and in particular, to a method, apparatus, readable storage medium, and electronic device for generating vector graphics. Background Art

[0002] Most technical workers use computer software to draw electronic charts, such as flowcharts and system block diagrams.

[0003] However, when drawing slightly more complex charts, many components and symbols need to be made by oneself, and it is difficult to make the connecting lines between some symbol connection points horizontal and vertical, which requires users to adjust them many times, consuming time and effort. Summary of the Invention

[0004] The present invention aims to solve at least one of the technical problems existing in the prior art or related technologies.

[0005] To this end, in the first aspect of the present invention, there is provided a method for generating vector graphics.

[0006] In the second aspect of the present invention, there is provided an apparatus for generating vector graphics.

[0007] In the third aspect of the present invention, there is provided another apparatus for generating vector graphics.

[0008] In the fourth aspect of the present invention, there is provided a readable storage medium.

[0009] In the fifth aspect of the present invention, there is provided an electronic device.

[0010] In view of this, the first aspect of the present invention provides a method for generating vector graphics, including: in response to a first input, obtaining a first graphic; performing recognition processing and / or segmentation processing on the first graphic to obtain graphic elements to be vectorized; determining target vector elements according to the comparison result between the graphic elements to be vectorized and preset vector elements; generating a vector graphic corresponding to the first graphic according to the target vector elements; wherein the vector graphic includes the target vector elements.

[0011] The technical solution of the present application proposes a method for generating vector graphics. Using this generation method, the first graphic can be directly converted into a vector graphic. In this process, the problem that the graphic elements manually drawn by the user cannot meet the drawing requirements and the user needs to continuously adjust the drawn graphic elements, resulting in time-consuming and laborious drawing, is overcome, the drawing efficiency is improved, and at the same time, the drawing threshold of the vector graphic is reduced, and the beauty and dissemination of the vector graphic are enhanced.

[0012] In addition, the method for generating vector graphics proposed by the present application also has the following additional technical features.

[0013] In the above technical solution, determining the target vector component according to the comparison result between the graphic element to be vectorized and the preset vector components specifically includes: determining the similarity between the graphic element to be vectorized and the vector components in the preset vector components; when the similarity between the first vector component in the preset vector components and the graphic element to be vectorized is greater than or equal to the similarity threshold, taking the first vector component as the target vector component; when the similarity between the first vector component and the graphic element to be vectorized is less than the similarity threshold, using the basic vector elements to draw the target vector component corresponding to the graphic element to be vectorized.

[0014] In the above technical solution, it is specified that the similarity between the target vector component selected from the preset vector components and the graphic element to be vectorized needs to be greater than or equal to the similarity threshold, so as to improve the accuracy of the selected vector component, thereby improving the accuracy of the converted vector graphic, and thus improving the credibility of the converted vector graphic.

[0015] In the above technical solution, when there is no vector component in the preset vector components whose similarity with the graphic element to be vectorized is not lower than the similarity threshold, the target vector component is no longer selected from the preset vector components, but the basic vector elements are used to draw the target vector component, so as to ensure that the obtained target vector component can accurately represent the graphic element to be vectorized, thereby improving the accuracy of the converted vector graphic, and thus improving the credibility of the converted vector graphic.

[0016] In any of the above technical solutions, determining the similarity between the graphic element to be vectorized and the vector components in the preset vector components specifically includes: determining the linear transformation matrix between the graphic element to be vectorized and the vector components in the preset vector components; performing linear transformation on the vector component according to the linear transformation matrix to obtain the linearly transformed vector component; determining the similarity according to the graphic element to be vectorized and the linearly transformed vector component.

[0017] In this technical solution, by determining the linear transformation matrix, the vector component can be linearly transformed according to the linear transformation matrix, so as to determine the similarity between the linearly transformed vector component and the graphic element to be vectorized.

[0018] In any of the above technical solutions, it further includes: adjusting the layout parameters between different target vector components in the vector graphic.

[0019] In this technical solution, by adjusting the layout parameters, the layout between different target vector components can be beautified, thereby improving the aesthetic feeling of the vector graphic.

[0020] In one of the technical solutions, an adjustment strategy for layout parameters can be pre-constructed so as to implement the adjustment of layout parameters according to the adjustment strategy.

[0021] In any of the above technical solutions, the layout parameters include one or more of the following: the spacing between different target vector elements, the alignment relationship between different target vector elements, and the connection position between different target vector elements.

[0022] In any of the above technical solutions, it further includes: receiving a second input to a target vector element of the vector graphic; and in response to the second input, adjusting the target vector element.

[0023] In this technical solution, considering that the target vector element is obtained by screening based on similarity or drawn using basic vector elements, it may be inconsistent with the first graphic drawn by the user, that is, there is a deviation.

[0024] To eliminate the above deviation, the technical solution of the present application can introduce human participation to manually verify the target vector element, thereby ensuring the accuracy of the vector graphic.

[0025] Among them, the adjustment includes but is not limited to the modification or replacement of the target vector element, and also includes the adjustment of layout parameters.

[0026] The second aspect of the present invention provides a vector graphic generation device, including: an acquisition unit for acquiring a first graphic in response to a first input; a processing unit for performing recognition processing and / or segmentation processing on the graphic elements of the first graphic to obtain graphic elements to be vectorized; a determination unit for determining target vector elements according to the comparison result between the graphic elements to be vectorized and preset vector elements; and a generation unit for generating a vector graphic corresponding to the first graphic according to the target vector elements; wherein the vector graphic includes the target vector elements.

[0027] The technical solution of the present application proposes a vector graphic generation device that can directly convert a first graphic into a vector graphic. In this process, it overcomes the problem that the graphic elements manually drawn by the user cannot meet the drawing requirements, and the user needs to continuously adjust the drawn graphic elements, resulting in time-consuming and laborious drawing. It improves the drawing efficiency, and at the same time, reduces the drawing threshold of the vector graphic and enhances the beauty and dissemination of the vector graphic.

[0028] In addition, the vector graphic generation device proposed by the present application further has the following additional technical features.

[0029] In the above technical solution, the determination unit is specifically configured to: determine the similarity between the graphic element to be vectorized and the vector elements in the preset vector components; in the case where the similarity between the first vector element in the preset vector components and the graphic element to be vectorized is greater than or equal to the similarity threshold, use the first vector element as the target vector element; in the case where the similarity between the first vector element and the graphic element to be vectorized is less than the similarity threshold, draw a target vector element corresponding to the graphic element to be vectorized by using the basic vector elements.

[0030] In the above technical solution, it is specified that the similarity between the target vector element selected from the preset vector components and the graphic element to be vectorized needs to be greater than or equal to the similarity threshold, so as to improve the accuracy of the selected vector element, thereby improving the accuracy of the converted vector graphic, and thus improving the credibility of the converted vector graphic.

[0031] In the above technical solution, in the case where there is no vector element in the preset vector components whose similarity with the graphic element to be vectorized is not lower than the similarity threshold, the target vector element is no longer selected from the preset vector components, but the basic vector elements are used to draw the target vector element, so as to ensure that the obtained target vector element can accurately represent the graphic element to be vectorized, thereby improving the accuracy of the converted vector graphic, and thus improving the credibility of the converted vector graphic.

[0032] In any of the above technical solutions, the determination unit is specifically configured to: determine the linear transformation matrix between the graphic element to be vectorized and the vector elements in the preset vector components; perform a linear transformation on the vector element according to the linear transformation matrix to obtain the linearly transformed vector element; determine the similarity according to the graphic element to be vectorized and the linearly transformed vector element.

[0033] In this technical solution, by determining the linear transformation matrix, the vector element can be linearly transformed according to the linear transformation matrix, so as to determine the similarity between the linearly transformed vector element and the graphic element to be vectorized.

[0034] In any of the above technical solutions, the generation unit is further configured to: adjust the layout parameters between different target vector elements in the vector graphic.

[0035] In this technical solution, by adjusting the layout parameters, the layout between different target vector elements can be beautified, thereby improving the aesthetic feeling of the vector graphic.

[0036] In one of the technical solutions, an adjustment strategy for the layout parameters can be constructed in advance, so as to implement the adjustment of the layout parameters according to the adjustment strategy.

[0037] In any of the above technical solutions, the layout parameters include one or more of the following: the spacing between different target vector elements, the alignment relationship between different target vector elements, and the connection position between different target vector elements.

[0038] In any of the above technical solutions, the generating unit is further configured to: receive a second input to a target vector element of the vector graphic; and in response to the second input, adjust the target vector element.

[0039] In this technical solution, considering that the target vector element is obtained by screening based on similarity or drawn using basic vector elements, it may be inconsistent with the first graphic drawn by the user, that is, there is a deviation.

[0040] To eliminate the above deviation, the technical solution of the present application can introduce human participation to manually verify the target vector element, thereby ensuring the accuracy of the vector graphic.

[0041] Among them, the adjustment includes but is not limited to the modification or replacement of the target vector element, and also includes the adjustment of layout parameters.

[0042] The third aspect of the present invention provides a vector graphic generating device, including: a processor and a memory, where the memory stores a program or instruction that can run on the processor, and when the program or instruction is executed by the processor, the steps of the method in any one of the first aspect are implemented.

[0043] The fourth aspect of the present invention provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by the processor, the steps of the method in any one of the first aspect are implemented.

[0044] The fifth aspect of the present invention provides an electronic device, including: the vector graphic generating device in any one of the second aspect and the third aspect; and / or the readable storage medium in the fourth aspect.

[0045] The additional aspects and advantages of the present invention will be partially given in the following description, partially become obvious from the following description, or be understood through the practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] The above and / or additional aspects and advantages of the present invention will become obvious and easy to understand from the description of the embodiments in conjunction with the following drawings, where:

[0047] Figure 1 FIG. 1 shows one of the flow diagrams of the method for generating a vector graphic in an embodiment of the present invention;

[0048] Figure 2 FIG. 2 shows another flow diagram of the method for generating a vector graphic in an embodiment of the present invention;

[0049] Figure 3 Shows the third schematic flowchart of the method for generating vector graphics in an embodiment of the present invention;

[0050] Figure 4 Shows the interaction schematic diagram between a mobile phone and a computer in an embodiment of the present invention;

[0051] Figure 5 Shows the schematic diagram of a paper chart in an embodiment of the present invention;

[0052] Figure 6 Shows the schematic diagram of a rotation matrix in an embodiment of the present invention;

[0053] Figure 7 Shows the schematic diagram of a size transformation matrix in an embodiment of the present invention;

[0054] Figure 8 Shows the schematic diagram of the effect of the method for generating vector graphics in an embodiment of the present invention;

[0055] Figure 9 Shows the schematic diagram of the effect of the method for generating vector graphics in an embodiment of the present invention;

[0056] Figure 10 Shows the schematic block diagram of a device for generating a vector graphics in an embodiment of the present invention;

[0057] Figure 11 Shows the schematic block diagram of another device for generating a vector graphics in an embodiment of the present invention. Detailed implementation manners

[0058] In order to be able to more clearly understand the above aspects, features and advantages of the present invention, the present invention will be further described in detail below in conjunction with the accompanying drawings and specific implementation manners. It should be noted that, without conflict, the embodiments of the present application and the features in the embodiments may be combined with each other.

[0059] In the following description, many specific details are set forth in order to fully understand the present invention. However, the present invention may also be implemented in other ways different from those described herein. Therefore, the protection scope of the present invention is not limited by the specific embodiments disclosed below.

[0060] In one of the embodiments, as Figure 1 shown, a method for generating a vector graphics is proposed, including:

[0061] Step 102, in response to a first input, obtain a first graphic;

[0062] Step 104, perform recognition processing and / or segmentation processing on the first graphic to obtain vectorization graphic elements to be vectorized;

[0063] Step 106: Determine the target vector component according to the comparison result between the graphic element to be vectorized and the preset vector component.

[0064] Step 108: Generate a vector graphic corresponding to the first graphic according to the target vector component.

[0065] Among them, the vector graphic includes the target vector component.

[0066] An embodiment of the present application proposes a method for generating a vector graphic. Using this generation method, the first graphic can be directly converted into a vector graphic. In this process, it overcomes the problem that the graphic elements manually drawn by the user cannot meet the mapping needs, and the user needs to continuously adjust the drawn graphic elements, resulting in time-consuming and laborious mapping. It improves the mapping and drawing efficiency. At the same time, it reduces the threshold for drawing vector graphics and enhances the beauty and dissemination of vector graphics.

[0067] Specifically, the embodiment of the present application performs recognition processing and / or segmentation processing on the obtained first graphic, so as to parse out the graphic elements to be vectorized in the first graphic, so as to compare the parsed graphic elements to be vectorized with the pre-set or stored vector graphics, that is, the preset vector components in the above text, to obtain the target vector component corresponding to the graphic element to be vectorized, and then generate a vector graphic according to the target vector component.

[0068] Among them, for the recognition processing of graphic elements, it can be understood that the shape of the first graphic is recognized to know the type to which the first graphic belongs. Among them, the type can be circuits and logic circuits, flowcharts, block diagrams, industrial control systems, process flowcharts, basic electricity, fluid power, etc.

[0069] In the above embodiment, by recognizing the type to which the first graphic belongs, the preset vector component is selected according to the recognition result, so as to select the target vector component, thereby reducing the number of preset vector components, and thus improving the selection speed of the target vector component.

[0070] In the above embodiment, the segmentation processing of graphic elements can be understood as dividing the first graphic into regions according to the density of the lines in different parts of the first graphic, and each region corresponds to a graphic element to be vectorized. In this embodiment, by performing segmentation processing, the difficulty in determining the target vector component is reduced, and thus the generation speed of the vector graphic is improved.

[0071] In the above embodiment, graphic elements refer to point, line, and surface elements in digital mapping. Based on this, the graphic elements to be vectorized can be understood as the graphic elements drawn by the user.

[0072] In the above embodiments, a vector element, that is, a graphic element in a vector file, can be understood as an object, and each object is a self - contained entity that has attributes such as color, shape, outline, size, and screen position.

[0073] A vector graphic is a graphic obtained by combining vector elements, such as three vector elements connected in sequence.

[0074] In one of the embodiments, the vector graphic can be a vector chart, such as a circuit and a logic circuit, a flowchart, a block diagram, an industrial control system, a process flowchart, basic electricity, fluid power, etc., which will not be elaborated here.

[0075] In the above embodiments, determining the target vector element according to the comparison result between the graphic element to be vectorized and the preset vector elements specifically includes: determining the similarity between the graphic element to be vectorized and the vector elements in the preset vector elements; when the similarity between the first vector element in the preset vector elements and the graphic element to be vectorized is greater than or equal to the similarity threshold, taking the first vector element as the target vector element; when the similarity between the first vector element and the graphic element to be vectorized is less than the similarity threshold, drawing a target vector element corresponding to the graphic element to be vectorized by using basic vector elements.

[0076] In this embodiment, by determining the similarity between the preset vector elements and the graphic element to be vectorized, it is possible to judge whether there is a target vector element in the preset vector elements according to the similarity. Furthermore, when there is a target vector element that meets the conditions in the preset vector elements, the target vector element is selected from the preset vector elements, and when there is no target vector element that meets the conditions in the preset vector elements, a target vector element corresponding to the graphic element to be vectorized is drawn by using basic vector elements.

[0077] In the above embodiments, it is limited that the similarity between the target vector element selected from the preset vector elements and the graphic element to be vectorized needs to be greater than or equal to the similarity threshold, so as to improve the accuracy of the selected vector element, thereby improving the accuracy of the converted vector graphic, and thus improving the credibility of the converted vector graphic.

[0078] In some embodiments of the present application, the similarity can be a two - dimensional similarity, such as the Euclidean distance.

[0079] In some embodiments of the present application, when there are multiple vector elements in the preset vector elements whose similarities with the graphic element to be vectorized are all not lower than the similarity threshold, the vector element with the largest similarity between the preset vector elements and the graphic element to be vectorized is selected as the target vector element, that is, the similarity between the first vector element and the graphic element to be vectorized is the largest.

[0080] In the above embodiments, by selecting the vector element with the highest similarity between the preset vector elements and the graphic elements to be vectorized as the target vector element, the accuracy of the converted vector graphic is improved, thereby enhancing the credibility of the converted vector graphic.

[0081] In the above embodiments, when there is no vector element in the preset vector elements whose similarity with the graphic elements to be vectorized is not lower than the similarity threshold, the target vector element is no longer selected from the preset vector elements. Instead, the basic vector elements are used to draw the target vector element, thereby ensuring that the obtained target vector element can accurately represent the graphic elements to be vectorized, improving the accuracy of the converted vector graphic, and enhancing the credibility of the converted vector graphic.

[0082] In some embodiments of the present application, the basic vector elements included in the graphic elements to be vectorized and the connection relationship between the basic vector elements can be identified, and then the target vector element is drawn according to the basic vector elements included in the graphic elements to be vectorized and the connection relationship between the basic vector elements.

[0083] In some embodiments of the present application, determining the similarity between the graphic elements to be vectorized and the vector elements in the preset vector elements specifically includes: determining the linear transformation matrix between the graphic elements to be vectorized and the vector elements in the preset vector elements; performing a linear transformation on the vector elements according to the linear transformation matrix to obtain the linearly transformed vector elements; and determining the similarity according to the graphic elements to be vectorized and the linearly transformed vector elements.

[0084] In this embodiment, by determining the linear transformation matrix, the vector elements are linearly transformed according to the linear transformation matrix, so as to determine the similarity between the linearly transformed vector elements and the graphic elements to be vectorized.

[0085] In the above embodiments, through linear transformation, the size of the linearly transformed vector elements is made similar to that of the graphic elements to be vectorized, thereby improving the accuracy of similarity calculation.

[0086] In the above embodiments, the linear transformation includes, for example, rotation and / or scaling.

[0087] In some embodiments of the present application, it further includes: adjusting the layout parameters between different target vector elements in the vector graphic.

[0088] In this embodiment, by adjusting the layout parameters, the layout between different target vector elements is beautified, thereby enhancing the aesthetic feeling of the vector graphic.

[0089] In some embodiments of the present application, an adjustment strategy for layout parameters can be pre-constructed to implement the adjustment of layout parameters according to the adjustment strategy.

[0090] In some embodiments of the present application, the layout parameters include one or more of the following: the spacing between different target vector elements, the alignment relationship between different target vector elements, and the connection position between different target vector elements.

[0091] In some embodiments of the present application, it further includes: receiving a second input for a target vector element of the vector graphic; and in response to the second input, adjusting the target vector element.

[0092] In this embodiment, considering that the target vector element is obtained by similarity screening or drawn using basic vector elements, it may be inconsistent with the first graphic drawn by the user, that is, there is a deviation.

[0093] To eliminate the above deviation, the embodiments of the present application can introduce human participation to perform manual verification on the target vector element, thereby ensuring the accuracy of the vector graphic.

[0094] Among them, the adjustment includes but is not limited to the modification or replacement of the target vector element, and also includes the adjustment of layout parameters.

[0095] In one embodiment, the first input may be a shooting input, such as controlling the camera component of the electronic device to shoot the graphic drawn by the user, and then obtaining the first graphic.

[0096] Specifically, as Figure 2 shown, the method for generating a vector graphic includes:

[0097] Step 202, taking a photo of the paper chart;

[0098] Step 204, running chart vectorization software and importing the paper chart photo;

[0099] Step 206, performing image recognition on the chart photo to automatically generate a vectorized chart.

[0100] In one embodiment, the first input may be a receiving input for data transmission, such as receiving a graphic transmitted from another device as the first graphic.

[0101] As Figure 3 and Figure 4 shown, the method for generating a vector graphic includes:

[0102] Step 302, using a camera to take a photo of the paper chart;

[0103] Step 304, transmitting the paper chart photo to a computer;

[0104] Step 306: The computer runs chart vectorization software and imports a photo of the paper chart.

[0105] Step 308: The chart vectorization software runs an image recognition algorithm to recognize and segment graphic elements on the paper chart photo.

[0106] Step 310: Select similar graphics from the software component library, apply a linear transformation, and calculate the two-dimensional similarity between them.

[0107] Step 312: Determine whether the software component library contains components with high similarity. If the determination result is yes, execute Step 314; if the determination result is no, execute Step 316.

[0108] Step 314: Directly replace with vector components in the software component library.

[0109] Step 316: The software automatically draws vector graphic elements.

[0110] As Figure 4 shown, the mobile phone 402 takes a photo of the paper chart 404 to obtain a photo of the paper chart, and sends it to the computer 406.

[0111] As Figure 5 shown, the paper chart 404 is a chart drawn by the user by hand.

[0112] In one embodiment, the linear transformation matrix includes a rotation matrix, and an example of the rotation matrix is as Figure 6 shown.

[0113] In one embodiment, the linear transformation matrix includes a size transformation matrix, and an example of the size transformation matrix is as Figure 7 shown.

[0114] In some embodiments of the present application, the method for generating a vector graphic specifically includes:

[0115] (1) Use a camera to collect a chart image drawn by the user on paper.

[0116] (2) Transmit the collected chart image to a computer running chart vectorization software.

[0117] (3) Run the chart vectorization software and import the chart image.

[0118] (4) The chart vectorization software starts an image recognition algorithm to recognize and segment graphic elements of the chart image.

[0119] (5) For the recognized and segmented graphic elements, several similar symbols are screened out from the software component library, and a linear transformation (rotation and scaling) matrix between the similar symbols and the graphic elements to be vectorized is calculated.

[0120] (6) Apply this linear transformation matrix to the similar symbols, and calculate the two-dimensional similarity between the transformed symbols and the graphic elements to be vectorized.

[0121] (7) If the software library contains vector components with high similarity, directly replace the graphic elements to be vectorized with this component; for the graphic elements that cannot be matched from the vector component library, the software uses basic vector elements to automatically draw the corresponding vector graphic elements.

[0122] (8) Automatically beautify the generated vector graph, mainly including adjusting the spacing and alignment of components, and adjusting the connections between components.

[0123] By running the above generation method, the automatic generation of vector graphics can be realized. For example, as Figure 8 and Figure 9 shown, convert the hand-drawn graph into a vector graph, or convert the graph with non-straight strokes into a vector graph with straight strokes.

[0124] In one embodiment, as Figure 10 shown, a vector graphic generation device 1000 is provided, including: an acquisition unit 1002, configured to acquire a first graph in response to a first input; a processing unit 1004, configured to perform recognition processing and / or segmentation processing on the graphic elements of the first graph to obtain graphic elements to be vectorized; a determination unit 1006, configured to determine a target vector component according to the comparison result between the graphic elements to be vectorized and a preset vector component; a generation unit 1008, configured to generate a vector graph corresponding to the first graph according to the target vector component; wherein, the vector graph includes the target vector component.

[0125] An embodiment of the present application proposes a vector graphic generation device 1000, which can directly convert a first graph into a vector graph. In this process, it overcomes the problem that the graphic elements manually drawn by the user cannot meet the mapping needs, and the user needs to continuously adjust the drawn graphic elements, thus resulting in time-consuming and laborious mapping. It improves the mapping and drawing efficiency. At the same time, it reduces the threshold for drawing vector graphics, and enhances the beauty and dissemination of vector graphics.

[0126] Specifically, the embodiments of the present application perform recognition processing and / or segmentation processing on the obtained first graphic, so as to parse out the graphic elements to be vectorized in the first graphic, and then compare the parsed graphic elements to be vectorized with the pre-set or stored vector graphics, that is, the preset vector components in the above text, to obtain the target vector components corresponding to the graphic elements to be vectorized, and further generate vector graphics based on the target vector components.

[0127] Among them, for the recognition processing of graphic elements, it can be understood that the shape of the first graphic is recognized to know the type to which the first graphic belongs. Among them, the type can be circuits and logic circuits, flowcharts, block diagrams, industrial control systems, process flowcharts, basic electricity, fluid power, etc.

[0128] In the above embodiment, by recognizing the type to which the first graphic belongs, the preset vector components are selected according to the recognition result, so as to select the target vector components, thereby reducing the number of preset vector components and improving the selection speed of the target vector components.

[0129] In the above embodiment, the segmentation processing of graphic elements can be understood as dividing the first graphic into regions according to the density of the lines in different parts of the first graphic, and each region corresponds to a graphic element to be vectorized. In this embodiment, by performing segmentation processing, the difficulty in determining the target vector components is reduced, thereby improving the generation speed of vector graphics.

[0130] In the above embodiment, graphic elements refer to point, line, and planar elements in digital mapping. Based on this, the graphic elements to be vectorized can be understood as the graphic elements drawn by the user.

[0131] In the above embodiment, vector components, that is, graphic elements in vector files, can be understood as objects. Each object is a self-contained entity, and it has attributes such as color, shape, contour, size, and screen position.

[0132] A vector graphic is a graphic obtained by combining vector components, such as three vector components connected in sequence.

[0133] In the above embodiment, the determining unit 1006 is specifically configured to: determine the similarity between the graphic elements to be vectorized and the vector components in the preset vector components; in the case where the similarity between the first vector component in the preset vector components and the graphic elements to be vectorized is greater than or equal to the similarity threshold, use the first vector component as the target vector component; in the case where the similarity between the first vector component and the graphic elements to be vectorized is less than the similarity threshold, draw the target vector component corresponding to the graphic elements to be vectorized by using basic vector elements.

[0134] In this embodiment, by determining the similarity between a preset vector element and a graphic element to be vectorized, it is possible to judge whether there is a target vector element in the preset vector element according to the similarity. Furthermore, when there is a target vector element meeting the conditions in the preset vector element, the target vector element is selected from the preset vector element; while when there is no target vector element meeting the conditions in the preset vector element, a target vector element corresponding to the graphic element to be vectorized is drawn using basic vector elements.

[0135] In the above embodiment, it is specified that the similarity between the target vector element selected from the preset vector element and the graphic element to be vectorized needs to be greater than or equal to a similarity threshold, so as to improve the accuracy of the selected vector element, thereby improving the accuracy of the vector graphic obtained by conversion, and thus improving the credibility of the vector graphic obtained by conversion.

[0136] In some embodiments of the present application, when there are multiple vector elements in the preset vector element whose similarities with the graphic element to be vectorized are not lower than the similarity threshold at the same time, the vector element with the greatest similarity between the preset vector element and the graphic element to be vectorized is selected as the target vector element. That is, the similarity between the first vector element and the graphic element to be vectorized is the greatest.

[0137] In the above embodiment, by selecting the vector element with the greatest similarity between the preset vector element and the graphic element to be vectorized as the target vector element, the accuracy of the vector graphic obtained by conversion is improved, and thus the credibility of the vector graphic obtained by conversion is improved.

[0138] In the above embodiment, when there is no vector element in the preset vector element whose similarity with the graphic element to be vectorized is not lower than the similarity threshold, the target vector element is no longer selected from the preset vector element, but the target vector element is drawn using basic vector elements, so as to ensure that the obtained target vector element can accurately represent the graphic element to be vectorized, thereby improving the accuracy of the vector graphic obtained by conversion, and thus improving the credibility of the vector graphic obtained by conversion.

[0139] In some embodiments of the present application, the basic vector elements included in the graphic element to be vectorized and the connection relationship between the basic vector elements can be recognized, and then the target vector element is drawn according to the basic vector elements included in the graphic element to be vectorized and the connection relationship between the basic vector elements.

[0140] In some embodiments of the present application, the determination unit 1006 is specifically configured to: determine a linear transformation matrix between the graphic element to be vectorized and the vector elements in the preset vector components; perform a linear transformation on the vector elements according to the linear transformation matrix to obtain the linearly transformed vector elements; and determine the similarity according to the graphic element to be vectorized and the linearly transformed vector elements.

[0141] In this embodiment, by determining the linear transformation matrix, the vector elements are linearly transformed according to the linear transformation matrix, so as to determine the similarity between the linearly transformed vector elements and the graphic element to be vectorized.

[0142] In the above embodiment, by performing a linear transformation, the sizes of the linearly transformed vector elements and the graphic element to be vectorized are made similar, thereby improving the accuracy of similarity calculation.

[0143] In the above embodiment, the linear transformation includes rotation and / or scaling.

[0144] In some embodiments of the present application, the generation unit 1008 is further configured to: adjust the layout parameters between different target vector elements in the vector graphic.

[0145] In this embodiment, by adjusting the layout parameters, the layout between different target vector elements is beautified, thereby improving the aesthetic feeling of the vector graphic.

[0146] In some embodiments of the present application, an adjustment strategy for the layout parameters may be pre-constructed so as to implement the adjustment of the layout parameters according to the adjustment strategy.

[0147] In some embodiments of the present application, the layout parameters include one or more of the following: the spacing between different target vector elements, the alignment relationship between different target vector elements, and the connection position between different target vector elements.

[0148] In some embodiments of the present application, the generation unit 1008 is further configured to: receive a second input for a target vector element of the vector graphic; and in response to the second input, adjust the target vector element.

[0149] In this embodiment, considering that the target vector element is obtained by similarity screening or drawn using basic vector elements, it may be inconsistent with the first graphic drawn by the user, that is, there is a deviation.

[0150] To eliminate the above deviation, the embodiments of the present application may introduce human participation to perform manual verification on the target vector elements, thereby ensuring the accuracy of the vector graphic.

[0151] Among them, the adjustment includes but is not limited to the modification or replacement of the target vector element, and also includes the adjustment of layout parameters.

[0152] In one embodiment, as Figure 11 shown, a vector graphics generation device 1100 is provided, including: a processor 1102 and a memory 1104. The memory 1104 stores programs or instructions that can run on the processor 1102. When the programs or instructions are executed by the processor 1102, the steps of the method in any one of the above embodiments are implemented.

[0153] In one embodiment, a readable storage medium is provided. Programs or instructions are stored on the readable storage medium. When the programs or instructions are executed by a processor, the steps of the method in any one of the above embodiments are implemented.

[0154] In one embodiment, an electronic device is provided, including: the vector graphics generation device in any one of the above; and / or the readable storage medium as described above.

[0155] In one embodiment, the electronic device may be a mobile phone, a tablet computer, etc.

[0156] The features of the terms "first" and "second" in the specification and claims of this application may explicitly or implicitly include one or more of such features. In the written description of the present invention, unless otherwise stated, the meaning of "a plurality" is two or more. In addition, "and / or" in the specification and claims means at least one of the connected objects. The character " / " generally means that the related objects before and after are in an "or" relationship.

[0157] In the written description of the present invention, it can be understood that the orientation or positional relationship indicated by the terms "center", "longitudinal", "transverse", "length", "width", "thickness", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", "clockwise", "counterclockwise", "axial", "radial", "circumferential", etc. is based on the orientation or positional relationship shown in the drawings. It is only for the convenience of describing the embodiments of the present invention and simplifying the description of the embodiments of the present invention, rather than indicating or implying that the structures, devices, and elements referred to must have a specific orientation, be constructed and operated in a specific orientation. Therefore, these descriptions should not be construed as limiting the present invention.

[0158] In the written description of the present invention, it is understood that, unless otherwise clearly specified and limited, the terms "install", "connect", and "join" shall be understood in a broad sense. For example, it may be a fixed connection, a detachable connection, or an integral connection; it may be a mechanical connection or an electrical connection; it may be a direct connection between the two, or an indirect connection between the two through an intermediate medium, and it may be the communication inside the two components. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0159] In the claims, the description and the drawings of the present invention, the term "a plurality" means two or more, unless otherwise clearly defined. The orientation or positional relationship indicated by terms such as "upper", "lower", etc. is based on the orientation or positional relationship shown in the drawings, and is only for more convenient description of the present invention and to make the description process simpler, rather than to indicate or imply that the device or element referred to must have the specific orientation described, be constructed and operated in the specific orientation. Therefore, these descriptions should not be construed as limitations on the present invention; terms such as "connect", "install", "fix", etc. should all be understood in a broad sense. For example, "connect" can be a fixed connection between multiple objects, a detachable connection between multiple objects, or an integral connection; it can be a direct connection between multiple objects, or an indirect connection between multiple objects through an intermediate medium. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to the specific circumstances of the above data.

[0160] In the claims, the description and the drawings of the present invention, the description of terms such as "an embodiment", "some embodiments", "specific embodiments", etc. means that the specific features, structures, materials, or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present invention. In the claims, the description and the drawings of the present invention, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described can be combined in a suitable manner in any one or more embodiments or examples.

[0161] The above are only the preferred embodiments of the present invention and are not intended to limit the present invention. For those skilled in the art, the present invention can have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.

Claims

1. A method for generating a vector graphic, characterized in that, Including: In response to a first input, obtaining a first graphic; Performing recognition processing and / or segmentation processing on the graphic elements of the first graphic to obtain graphic elements to be vectorized; Determining a target vector element according to the comparison result between the graphic elements to be vectorized and preset vector elements; Generating a vector graphic corresponding to the first graphic according to the target vector element; Wherein, the vector graphic includes the target vector element; The determining the target vector element according to the comparison result between the graphic elements to be vectorized and preset vector elements specifically includes: Determining the similarity between the graphic elements to be vectorized and the vector elements in the preset vector elements; When the similarity between the first vector element in the preset vector elements and the graphic elements to be vectorized is greater than or equal to the similarity threshold, taking the first vector element as the target vector element; When the similarity between the first vector element and the graphic elements to be vectorized is less than the similarity threshold, drawing a target vector element corresponding to the graphic elements to be vectorized by using basic vector elements; The segmentation processing of the graphic elements is to divide the first graphic into regions according to the density of the lines in different parts of the first graphic, and each region corresponds to a graphic element to be vectorized.

2. The method for generating a vector graphic according to claim 1, wherein The determining the similarity between the graphic elements to be vectorized and the vector elements in the preset vector elements specifically includes: Determining a linear transformation matrix between the graphic elements to be vectorized and the vector elements in the preset vector elements; Performing a linear transformation on the vector element according to the linear transformation matrix to obtain a linearly transformed vector element; Determining the similarity according to the graphic elements to be vectorized and the linearly transformed vector element.

3. The method for generating a vector graphic according to claim 1 or 2, wherein Further including: Adjusting the layout parameters between different target vector elements in the vector graphic.

4. The method for generating a vector graphic according to claim 3, characterized in that, The layout parameters include one or more of the following: The spacing between different target vector elements, the alignment relationship between different target vector elements, and the connection position between different target vector elements.

5. The method for generating a vector graph according to claim 1 or 2, characterized in that, Further including: Receiving a second input for the target vector element of the vector graphic; In response to the second input, adjusting the target vector element.

6. A generating device for vector graphics, characterized in that, Including: An obtaining unit, configured to obtain a first graphic in response to a first input; A processing unit, configured to perform recognition processing and / or segmentation processing on the first graphic to obtain graphic elements to be vectorized; A determining unit, configured to determine a target vector element according to the comparison result between the graphic elements to be vectorized and preset vector elements; A generating unit, configured to generate a vector graphic corresponding to the first graphic according to the target vector element; Wherein, the vector graphic includes the target vector element; The determining unit is specifically configured to: Determine the similarity between the graphic elements to be vectorized and the vector elements in the preset vector elements; When the similarity between the first vector element in the preset vector elements and the graphic elements to be vectorized is greater than or equal to the similarity threshold, taking the first vector element as the target vector element; When the similarity between the first vector element and the graphic element to be vectorized is less than the similarity threshold, a target vector element corresponding to the graphic element to be vectorized is drawn using the basic vector element. The segmentation process of the graphic element is to divide the first graphic into regions according to the density of the lines in different parts of the first graphic, and each region corresponds to a graphic element to be vectorized.

7. The generating device for vector graphics according to claim 6, characterized in that, The determining unit is specifically configured to: Determine the linear transformation matrix between the graphic element to be vectorized and the vector elements in the preset vector elements; Perform a linear transformation on the vector element according to the linear transformation matrix to obtain a linearly transformed vector element; Determine the similarity according to the graphic element to be vectorized and the linearly transformed vector element.

8. The generating device for vector graphics according to claim 6 or 7, characterized in that, The generating unit is further configured to: Adjust the layout parameters between different target vector elements in the vector graphic.

9. The generating device for vector graphics according to claim 8, characterized in that, The layout parameters include one or more of the following: The spacing between different target vector elements, the alignment relationship between different target vector elements, and the connection position between different target vector elements.

10. The generating device for vector graphics according to claim 6 or 7, characterized in that, The generating unit is further configured to: Receive a second input for the target vector element of the vector graphic; In response to the second input, adjust the target vector element.

11. A generating device for vector graphics, characterized in that, Comprising: A processor and a memory, the memory stores a program or instruction that can run on the processor, and when the program or instruction is executed by the processor, the steps of the method according to any one of claims 1 to 5 are implemented.

12. A readable storage medium, characterized in that, A program or instruction is stored on the readable storage medium, and when the program or instruction is executed by the processor, the steps of the method according to any one of claims 1 to 5 are implemented.

13. An electronic device, characterized in that, Comprising: A vector graphic generating device according to any one of claims 6 to 11; And / or A readable storage medium according to claim 12.

Citation Information

Patent Citations

  • On-line identification method of compound pattern

    CN101964053A

  • Image similarity judgment method, electronic equipment and storage medium

    CN109948653A

  • Graph drawing method and device, electronic equipment and storage medium

    CN112734876A