Geometric figure processing method and device, equipment and storage medium
By identifying, optimizing and vectorized editing of geometric figures, the problems of inaccurate identification and low editing efficiency in the prior art are solved, and high-precision and high-efficiency geometric figure processing are achieved, reducing labor costs.
Patent Information
- Application Number
- CN202411210915.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2044-08-30
AI Technical Summary
The prior art has low recognition accuracy and efficiency when processing geometric figures in scanned test papers or photos, resulting in a large amount of manpower adjustments required in the subsequent process, making it difficult to meet the high standards of educational scenarios for graphical accuracy and editing convenience.
Provide a geometric graphics processing method, including obtaining images to be identified, performing identification and cutting, optimization processing, denoising processing, obtaining image features, classifying and determining target geometric elements, disassembly relationships, determining vector elements, and vectoring based on editing instructions Edit and export vector graphics in standard format.
It realizes high-precision geometric figure recognition, reduces the labor cost of subsequent adjustments, and meets the editing needs of high efficiency and high accuracy.
Smart Images

Figure CN119131799A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of graphics processing technology, and in particular to a method, device, equipment and storage medium for processing geometric graphics. Background Art
[0002] With the rise of digital education, teachers and students have a growing demand for efficient and accurate geometric graphics processing tools in order to transfer geometric graphics on paper texts to online presentations. Although existing image processing and recognition technologies provide solutions to a certain extent, they often fail to meet the high standards for graphic accuracy and editing convenience in educational scenarios. Especially when processing geometric graphics in scanned test papers or photos, due to fluctuations in image quality and interference from complex backgrounds, the accuracy and efficiency of recognition are not high, which leads to the need for a lot of manpower to adjust the recognized geometric graphics later. Summary of the invention
[0003] In view of the shortcomings of the prior art, the present application provides a method, device, equipment and storage medium for processing geometric figures, aiming to solve the technical problem that the accuracy of geometric figure recognition in the prior art is not high, which leads to the subsequent waste of a lot of human resources to adjust it. Specifically: In a first aspect, an embodiment of the present application provides a method for processing geometric figures, the method comprising: acquiring an image to be identified, and identifying and cutting the image to be identified to determine an initial geometric illustration; optimizing the initial geometric illustration to determine a target geometric illustration; denoising the target geometric illustration to obtain a denoised geometric illustration, acquiring image features of the denoised geometric illustration, classifying the image features to determine target geometric elements, and determining a first vector element based on the relationship between the target geometric elements and geometric elements obtained by disassembling the target geometric elements; wherein the target geometric elements include at least one of a solid line, a dotted line, a line segment with an arrow, a circle, an ellipse, an angle, an arc, a curve and text; editing the vector elements to be edited in the first vector elements based on the editing instructions, determining a vector graphic based on the vector elements to be edited and non-edited vector elements, and exporting the vector graphic to a graphic resource library in a standard format.
[0004] In a second aspect, an embodiment of the present application provides a device for processing geometric figures, the device comprising: an identification and cutting module, used to obtain an image to be identified, and identify and cut the image to be identified to determine an initial geometric illustration; an optimization processing module, used to optimize the initial geometric illustration to determine a target geometric illustration; a vector element determination module, used to denoise the target geometric illustration to obtain a denoised geometric illustration, obtain image features of the denoised geometric illustration, classify the image features to determine the target geometric elements, and determine a first vector element based on the relationship between the target geometric element and the geometric element obtained by disassembling the target geometric element; wherein the target geometric element includes at least one of a solid line, a dotted line, a line segment with an arrow, a circle, an ellipse, an angle, an arc, a curve and text; an export module, used to edit the vector element to be edited in the first vector element based on an editing instruction, determine a vector graphic based on the vector element to be edited and the non-edited vector element, and export the vector graphic to a graphic resource library in a standard format.
[0005] In a third aspect, an embodiment of the present application provides an electronic device, the electronic device comprising: one or more processors, a memory, and one or more applications. The one or more applications are stored in the memory and configured to be executed by the one or more processors, and the one or more applications are configured to execute the method of the first aspect.
[0006] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which a program code is stored. The program code can be called by a processor to execute the method of the first aspect.
[0007] In the technical solution provided in the present application, an image to be identified is obtained, and the image to be identified is identified and cut to determine an initial geometric illustration; the initial geometric illustration is optimized to determine a target geometric illustration; the target geometric illustration is denoised to obtain a denoised geometric illustration, the image features of the denoised geometric illustration are obtained, the image features are classified to determine the target geometric elements, and the first vector element is determined according to the relationship between the target geometric elements and the geometric elements obtained by disassembling the target geometric elements; the vector elements to be edited in the first vector element are edited based on the editing instructions, the vector graphics are determined according to the vector elements to be edited and the non-edited vector elements, and the vector graphics are exported to the graphic resource library in a standard format. Thus, by performing high-precision identification of geometric figures, the labor cost of subsequent adjustments is greatly reduced; at the same time, because the corresponding vector elements are obtained by identifying and disassembling the geometric figures on the basis of optimizing the initial geometric illustration, vectorized editing can be performed later, so that it not only meets the requirements of high-precision and high-efficiency identification of geometric figures, but also meets the requirements of high-efficiency and high-accuracy editing of the identified geometric figures later. BRIEF DESCRIPTION OF THE DRAWINGS
[0008] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application, not all embodiments. Based on the embodiments of the present application, all other embodiments and drawings obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0009] Figure 1 A schematic flow chart of a method for processing geometric figures proposed in an embodiment of the present application is shown.
[0010] Figure 2 A schematic flow chart of another method for processing geometric figures proposed in an embodiment of the present application is shown.
[0011] Figure 3 A structural block diagram of a geometric figure processing device proposed in an embodiment of the present application is shown.
[0012] Figure 4 A structural block diagram of an electronic device proposed in an embodiment of the present application is shown.
[0013] Figure 5 A structural block diagram of a computer-readable storage medium proposed in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0014] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0015] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.
[0016] It should also be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, the singular forms "a", "an" and "the" are intended to include plural forms unless the context clearly indicates otherwise.
[0017] It should be further understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0018] In the field of education, especially in the teaching and examination of subjects such as mathematics and physics, the accuracy and standardization of geometric figures are extremely critical for students to understand and master knowledge points. However, in traditional educational practice, teachers often need to manually draw or input geometric figures when preparing teaching materials or test papers. This process is not only time-consuming but also prone to errors. In addition, when existing geometric figures need to be adjusted or personalized, teachers often have to redraw them, which is not only inefficient but also difficult to ensure the consistency and standardization of the figures.
[0019] With the rise of digital education, teachers and students have a growing demand for efficient and accurate geometric graphics processing tools. Although existing image processing and recognition technologies provide solutions to a certain extent, they often fail to meet the high standards of graphic accuracy and editing convenience in educational scenarios. Especially when processing geometric figures in scanned test papers or photos, due to fluctuations in image quality and interference from complex backgrounds, the recognition accuracy and efficiency are low, which leads to the need for a lot of manpower to edit the recognized geometric figures in the future, which is inefficient and error-prone.
[0020] Therefore, in order to solve the problems existing in the prior art, the present application proposes a method, device, equipment and storage medium for processing geometric figures, which will be described below in conjunction with specific embodiments.
[0021] See also Figure 1 , Figure 1 A method for processing geometric figures provided by the present application is shown, and the method at least includes steps S110 to S140, specifically: In step S110, an image to be recognized is obtained, and the image to be recognized is recognized and cut to determine an initial geometric illustration.
[0022] In the embodiment of the present application, the initial geometric illustration refers to a single geometric illustration that is obtained and is about to be recognized.
[0023] In the embodiment of the present application, obtaining the initial geometric illustration may be first obtaining a text image, and then recognizing and cutting the text image to obtain the initial geometric illustration. The text image may be a test paper image, a photo image, or an image on other paper. The present application mainly uses the test paper image as an example for explanation.
[0024] In some embodiments, an image acquisition device with a camera or a camera module or other image acquisition module can be used to capture a text image, and then all geometric illustrations in the text image are automatically detected, and then all detected geometric illustrations are cut to obtain a single initial geometric illustration.
[0025] In some embodiments, the image acquisition device may be, for example, a mobile phone, a computer, a camera, a video camera, a scanner, etc. It is understandable that in order to improve subsequent recognition accuracy and editing convenience, the image acquisition device may be a high-resolution device.
[0026] In step S120, the initial geometric illustration is optimized to determine the target geometric illustration.
[0027] In an embodiment of the present application, the optimization processing may include handwriting removal processing and binarization processing; the handwriting removal processing is used to remove handwriting traces in the collected initial geometric illustration; the binarization processing is used to black and white the initial geometric illustration with handwriting traces removed to obtain a black and white geometric illustration, thereby improving the rate of subsequent geometric figure recognition.
[0028] Specifically, after obtaining the initial geometric illustration, the initial geometric illustration can be first subjected to handwriting removal processing to obtain a handwriting-free geometric illustration, and then the handwriting-free geometric illustration can be binarized to obtain a target geometric illustration, thereby optimizing the quality of the image to be subsequently recognized and improving the subsequent recognition rate.
[0029] In step S130, the target geometric illustration is denoised to obtain a denoised geometric illustration, image features of the denoised geometric illustration are obtained, the image features are classified to determine the target geometric elements, and the first vector element is determined based on the relationship between the target geometric elements and the geometric elements obtained by disassembling the target geometric elements.
[0030] In the embodiment of the present application, geometric elements refer to elements that constitute geometric illustrations, including solid lines, dotted lines, line segments with arrows, circles, ellipses, angles, arcs, curves and text; vector elements refer to vectorized geometric elements; target geometric elements include at least one of solid lines, dotted lines, line segments with arrows, circles, ellipses, angles, arcs, curves and text; the first vector element is the vectorized target geometric element determined according to step S130.
[0031] In some embodiments, the target geometric illustration can be denoised using Gaussian filtering, where the Gaussian filtering formula is: , is the Gaussian kernel function, (a,b) is the center of the Gaussian kernel, is the standard deviation.
[0032] In other embodiments, the target geometric illustration may be denoised using denoising methods such as mean filtering, median filtering, wavelet denoising, non-local mean denoising, total variation denoising, etc. It is understandable that since each denoising method has a different denoising effect, the aforementioned denoising methods may be combined for denoising according to actual needs.
[0033] In some embodiments, an edge detection algorithm may be used to determine the image edges in the denoised geometric illustration, and then image features corresponding to the image edges may be obtained, thereby converting the target geometric illustration into a feature vector that can be understood and processed by the machine learning algorithm. The edge detection algorithm may be, for example, Sobel, Canny, etc.
[0034] It can be understood that by denoising and extracting features from the target geometric illustration, the accuracy of subsequent recognition can be improved.
[0035] Furthermore, in order to better convert the feature vector into the vector form required by the machine learning algorithm, the feature vector can be simply concatenated according to certain rules, or a dimensionality reduction method (such as PCA) can be used to convert the feature vector obtained above into a lower-dimensional feature vector representation. In this case, the image feature is a low-dimensional feature vector.
[0036] In some embodiments, after the image features are extracted, a classification machine learning algorithm can be used to classify the image features, thereby determining the target geometric elements corresponding to the target geometric illustration. The classification and its learning algorithm formula can be ;in, is the output of the neural network, is the weight, is the activation coefficient.
[0037] Furthermore, in some embodiments, the classification machine learning algorithm may be, for example, a support vector machine (SVM), a random forest, k-nearest neighbors, or the like.
[0038] In the embodiment of the present application, after the target geometric elements are obtained, the geometric element relationship between the target geometric elements can also be obtained, wherein the geometric element relationship is used to characterize the positional relationship of the target geometric elements in the coordinate system.
[0039] Specifically, the geometric relationship of the target geometric elements is first decomposed to determine the geometric element relationship between the target geometric elements, and then the first vector element is determined based on the target geometric elements and the geometric element relationship, wherein the position of the first vector element in the coordinate system corresponds to the geometric element relationship.
[0040] Furthermore, we can use analytical geometry formulas (such as the equation of a straight line ) and topological relationships (such as points on lines, intersections of lines, etc.), algebraize the target geometric elements, determine the geometric element relationships, and finally determine the first vector element based on the target geometric elements and the geometric element relationships corresponding to the target geometric elements.
[0041] In some embodiments, the target geometric illustration may be first denoised to obtain a denoised geometric illustration, and then the first feature may be determined based on the first feature extraction method, the second feature may be determined based on the second feature extraction method, and the third feature may be determined based on the third feature extraction method; then, the relationship between the first element and the first element, the relationship between the second element and the second element, and the relationship between the third element and the third element may be determined according to the feature processing methods corresponding to the first feature, the second feature, and the third feature; the target geometric element may be determined according to the first element, the second element, and the third element, and the relationship between the geometric elements may be determined according to the relationship between the first element, the second element, and the third element; finally, the first vector element may be determined according to the target geometric element and the relationship between the geometric elements.
[0042] Among them, the first feature extraction method is to extract through ResNet50 and Sigmoid; the second feature extraction method is to first extract multi-scale features from the image, and then gradually upsample the low-resolution features from the extracted multi-scale features to generate high-resolution pixel-by-pixel features; the third feature extraction method is to extract with ResNet50; the first element includes angles, solid lines, dotted lines and arrowed line segments; the second element includes angles, circles, ellipses, curves and arcs; the third element includes text; the first feature is a feature corresponding to at least one of solid lines, dotted lines and arrowed line segments; the second feature is a feature corresponding to at least one of circles, ellipses, curves and arcs; the third feature is a feature corresponding to text; the text includes at least one of Chinese, English and numbers; the first feature, the second feature and the third feature are image features.
[0043] Furthermore, after determining the target geometric illustration, it is necessary to use the first feature extraction method, the second feature extraction method and the third feature extraction method to extract features of the target geometric illustration; if the first feature is obtained according to the first feature extraction method, it means that the target geometric illustration includes line segments (the line segments include at least one of solid lines, dashed lines and line segments with arrows), so it is necessary to obtain the first element and the relationship between the first elements, that is, obtain the endpoint coordinates of the line segments and the intersection coordinates of multiple line segments and determine the line segment type, and then predict the direction and angle of each point; if the second feature is obtained according to the second feature extraction method, the corresponding second element and the relationship between the second element are obtained. The specific process is to distinguish circles and ellipses according to the distances from the major axis and minor axis of the circle to the center of the circle, calculate the coordinates of the center of the circle and the diameter of the circle and the major and minor axes of the ellipse, determine the curve and arc according to the length of the arc, and calculate the coordinates of each point on the curve and arc as well as the angle and direction; if the third feature is obtained according to the third feature extraction method, the third element and the relationship between the third elements are determined, that is, determine the text in the target geometric illustration and the text coordinates corresponding to each text.
[0044] In some embodiments, the second feature extraction method also includes: determining an embedding vector of the target geometric illustration based on the Transformer, and then calculating cross-attention based on the embedding vector and the pixel-by-pixel features to improve the performance of the model.
[0045] In some embodiments, the arc may be an arc of shorter length surrounded by an angle formed by two straight lines; the diameter of a circle is determined by the distance between the center and the side.
[0046] In some implementations, in order to reduce the workload of subsequent manual adjustments, the points of each coordinate on the arc line may be fitted and corrected to ultimately obtain a smooth curve.
[0047] In some implementations, to ensure the accuracy of the text, based on the above steps, the corresponding text can be intercepted from the initial geometric illustration according to the text coordinates and the Transformer+CTC structure can be used to perform text recognition again. It can be understood that after determining the coordinates of the text and the specific content of the text, the text can be filled in the first vector element at the end.
[0048] Further, after determining the target geometric element and the relationship between the geometric elements, vectorization processing is performed on the target geometric element based on the target geometric element and the relationship between the geometric elements, so as to obtain a first vector element.
[0049] In some implementations, to facilitate subsequent editing, the obtained solid lines, dotted lines, line segments with arrows, circles, ellipses, arcs, curves, and texts may be displayed in different layer areas, respectively.
[0050] In step S140, the vector elements to be edited in the first vector elements are edited based on the editing instruction, vector graphics are determined according to the vector elements to be edited and non-edited vector elements, and the vector graphics are exported to a graphic resource library in a standard format.
[0051] In an embodiment of the present application, the editing instruction is an editing instruction selected by the user, the standard format is the SVG format, and the graphic resource library can be a teaching graphic resource library; the vector element to be edited is a vector element corresponding to the editing instruction and requires editing and adjustment; the non-editing vector element is a vector element that does not require adjustment.
[0052] Specifically, since the solid line, dotted line, line segment with arrow, circle, ellipse, arc, curve and text are in different layer areas, after obtaining the editing instruction, the vector element to be edited corresponding to the editing instruction can be determined, and then the vector element to be edited in the first vector element is edited based on the editing instruction, and finally the vector graphic corresponding to the first vector element is obtained, thereby realizing vectorized editing. Among them, each editing instruction corresponds to a vector element to be edited, and the vector element to be edited is at least one of a solid line, a dotted line, a line segment with arrow, a circle, an ellipse, an arc, a curve and text.
[0053] It is understandable that since the initial geometric figures have been identified with high precision before editing, there is no need to perform excessive editing operations on the first vector element to adjust it in order to obtain the vector graphics corresponding to the initial geometric figures, which saves labor costs, reduces errors in the human adjustment process, and greatly improves editing accuracy and efficiency.
[0054] In some embodiments, the user can also create a new canvas, and then combine and adjust the existing standard geometric elements to obtain a new geometric figure. Specifically, the selection instruction selected by the user can be obtained first, and then the standard geometric element to be adjusted can be determined based on the selection instruction, and then the adjustment instruction can be obtained and the standard geometric element can be adjusted based on the adjustment instruction to obtain a standard figure, and finally the standard figure can be exported to the graphic resource library in a standard format. Among them, the number of standard geometric elements is at least 1.
[0055] Furthermore, secondary creation can be performed on the basis of vector graphics, that is, secondary creation can be performed on the basis of recognized geometric figures. The method is a combination of the above steps, which will not be described in detail here.
[0056] It should be noted that in the embodiment of the present application, the adjustment and subsequent creation of the first vector element are all completed in the vectorized editing interface.
[0057] Furthermore, the editing interface can provide editing operations such as multi-element or single element selection, drag box selection, copy, paste, delete, undo, align, and manual addition of geometric elements, thereby meeting the user's needs for personalized graphic adjustment and secondary creation.
[0058] Furthermore, for straight lines, the mouse can perform operations such as dragging, stretching, rotating and color selection, and the property settings can include line style (solid line, dotted line), arrow style (none, single arrow, double arrow), top and tail position (x, y), line thickness, rotation angle, level, etc.; for arcs, the mouse can perform operations such as dragging, stretching, arc stretching, rotating and color selection, and the property settings can include line style (solid line, dotted line), line thickness, rotation angle, level, etc.; for circles, the mouse can perform operations such as dragging, scaling, style selection (solid, hollow) and color selection, and the property settings can include original shape, stroke style (solid line, dotted line), stroke thickness and diameter, etc.; for balls, the mouse can perform operations such as dragging and color selection, and the property settings can include ball center position, horizontal auxiliary lines, vertical auxiliary lines, etc.; for text, the mouse can perform operations such as dragging and rotating, and the property settings can include font style, font style, font size, line height, character spacing, special symbols, etc.
[0059] In the technical solution provided in the present application, an image to be identified is obtained, and the image to be identified is identified and cut to determine an initial geometric illustration; the initial geometric illustration is optimized to determine a target geometric illustration; the target geometric illustration is denoised to obtain a denoised geometric illustration, the image features of the denoised geometric illustration are obtained, the image features are classified to determine the target geometric elements, and the first vector element is determined according to the relationship between the target geometric elements and the geometric elements obtained by disassembling the target geometric elements; the vector elements to be edited in the first vector element are edited based on the editing instructions, the vector graphics are determined according to the vector elements to be edited and the non-edited vector elements, and the vector graphics are exported to the graphic resource library in a standard format. Thus, by performing high-precision identification of geometric figures, the labor cost of subsequent adjustments is greatly reduced; at the same time, on the basis of optimizing the initial geometric illustration, the geometric figures are identified and disassembled to obtain the corresponding vector elements, so that vectorized editing can be performed later, which not only meets the needs of high-precision and high-efficiency identification of geometric figures, but also meets the needs of high-efficiency and high-accuracy editing of the identified geometric figures later.
[0060] See also Figure 2 , Figure 2 Another method for processing geometric figures proposed in an embodiment of the present application is shown, and the method includes steps S210 to S270, specifically: In step S210, an image to be recognized is obtained, and the image to be recognized is recognized and cut to determine an initial geometric illustration.
[0061] In step S220, the initial geometric illustration is optimized to determine the target geometric illustration.
[0062] In step S230, the target geometric illustration is denoised to obtain a denoised geometric illustration, image features of the denoised geometric illustration are obtained, the image features are classified to determine the target geometric elements, and the first vector element is determined based on the target geometric elements and the geometric element relationship obtained by disassembling the target geometric elements.
[0063] In the embodiment of the present application, the specific description of step S210 to step S230 can refer to the aforementioned step S110 to step S130, which will not be repeated here.
[0064] In step S240, a second vector element corresponding to the target geometric illustration is obtained based on the target geometric element.
[0065] Specifically, the second geometric element included in each line in the target geometric illustration can be obtained based on the target geometric element, and then the corresponding fitting method is selected based on the second geometric element to determine the second vector element. The target geometric element includes at least one of a solid line, a dotted line, a line segment with an arrow, a circle, an ellipse, an arc, and a curve.
[0066] In some embodiments, if the line is any one of a solid line, a dashed line, and a line segment with an arrow, the coordinates of the two end points of the line are first obtained, and then the corresponding vector line is fitted according to the coordinates of the two end points.
[0067] In some embodiments, if the line is an ellipse, the first coordinates of two points with the same horizontal coordinate and the largest difference in vertical coordinates are obtained, and the second coordinates of two points with the same vertical coordinate and the largest difference in horizontal coordinates are obtained; then, fitting is performed based on the two points corresponding to the first coordinates and the two points corresponding to the second coordinates to obtain the corresponding vector line. It can be understood that after determining the first coordinates and the second coordinates, the major axis and the minor axis of the ellipse can be determined.
[0068] In some embodiments, if the line is a circle, the coordinates of the center of the circle and the circumferential coordinates of any point on the circumference are obtained, and fitting is performed based on the coordinates of the center of the circle and the circumferential coordinates to obtain the corresponding vector line.
[0069] In some embodiments, if the line is an arc or a curve, the endpoint coordinates of the two end points on the arc and the midpoint coordinates of the arc are obtained, and then fitting is performed based on the endpoint coordinates and the midpoint coordinates to determine the corresponding vector line.
[0070] In step S250 , a first distance between the first vector element and the target geometric element is determined, and a second distance between the second vector element and the target geometric element is determined.
[0071] Specifically, the average pixel distance between each vector line in the first vector element and the corresponding target geometric element is used as the first distance, and the average distance between each vector line in the second vector element and the corresponding target geometric element is used as the second distance.
[0072] In some embodiments, if the vector line is any one of a solid line, a dashed line, and a line segment with an arrow, the average distance difference is determined according to the coordinates of the two end points of the vector line on the first vector element and the target geometric element.
[0073] In some embodiments, if the vector line is a circle, the average distance is determined according to the center coordinates and radius of the first vector element and the target geometric element.
[0074] In some embodiments, if the vector line is an ellipse, the average distance is determined based on the major axis and the minor axis of the first vector element and the target geometric element.
[0075] In some embodiments, if the vector line is an arc or a curve, the average distance is determined according to the coordinates of the endpoints and the coordinates of the midpoint.
[0076] It should be noted that, since the angle has been taken into account when determining the first vector element, the correction is only for further fine-tuning it. Therefore, in order to reduce the amount of calculation, only the line itself is considered when calculating the distance, without considering the angle.
[0077] In step S260 , a target vector element is determined based on the first vector element, the first distance, the second vector element, and the second distance.
[0078] In the embodiment of the present application, vector lines that deviate greatly from the target geometric illustration in the first vector element can be screened out, and then these vector lines can be corrected. Specifically, the first vector element corresponding to the first distance greater than or equal to the preset distance is obtained as the first preliminary screening element; the correction element is determined based on the first preliminary screening element, the second vector element, the first distance, and the second distance; and the target vector element is determined based on the first vector element and the correction element.
[0079] Further, a second preliminary screening element corresponding to the first preliminary screening element is determined in the second vector element, and a vector element whose second distance in the second preliminary screening element is less than the first distance is used as a correction element, wherein the correction element is a vector element in the first vector element that needs to be corrected and replaced.
[0080] Furthermore, vector elements in the first vector elements that do not correspond to the correction elements are obtained as non-correction elements; and the target vector elements are determined according to the non-correction elements and the correction elements.
[0081] It can be understood that if there is no vector element in the second preliminary screening elements whose second distance is less than the first distance, it means that the deviation degree of the second preliminary screening elements is greater than or equal to the first preliminary screening elements. At this time, the first vector element is used as the target vector element.
[0082] In some implementations, in order to facilitate subsequent editing and adjustment by the user, the first preliminary screening elements that have not been modified may be prompted for editing, for example, they may be highlighted.
[0083] In step S270, the vector element to be edited in the target vector element is edited based on the editing instruction, a vector graphic is determined according to the vector element to be edited and the non-edited vector element, and the vector graphic is exported to the graphic resource library in a standard format.
[0084] In the embodiment of the present application, the specific description of step S270 can refer to the aforementioned step S140, which will not be repeated here.
[0085] In the technical solution provided in the present application, an initial geometric illustration is determined by acquiring an image to be identified, and identifying and cutting the image to be identified; the initial geometric illustration is optimized to determine a target geometric illustration; the target geometric illustration is denoised to obtain a denoised geometric illustration, image features of the denoised geometric illustration are acquired, the image features are classified to determine the target geometric elements, and a first vector element is determined based on the relationship between the target geometric elements and the geometric elements obtained by disassembling the target geometric elements; a second vector element corresponding to the target geometric illustration is acquired based on the target geometric element; a first distance between the first vector element and the target geometric element is determined, and a second distance between the second vector element and the target geometric element is determined; the target vector element is determined based on the first vector element, the first distance, the second vector element, and the second distance; the vector element to be edited in the target vector element is edited based on the editing instruction, a vector graphic is determined based on the vector element to be edited and the non-edited vector element, and the vector graphic is exported to a graphic resource library in a standard format. Therefore, based on the high-precision recognition of geometric figures, they can be further automatically corrected, greatly reducing the manpower cost of subsequent adjustments; at the same time, based on the optimization of the initial geometric illustrations, the geometric figures are identified and disassembled to obtain the corresponding vector elements, so that vectorized editing can be performed subsequently, which not only meets the needs of high-precision and high-efficiency recognition of geometric figures, but also meets the needs of subsequent high-efficiency and high-accuracy editing of the identified geometric figures.
[0086] See also Figure 3 , Figure 3A geometric figure processing device 100 proposed in an embodiment of the present application is shown, and the device includes: a recognition and cutting module 110, an optimization processing module 120, a vector element determination module 130 and an export module 140. Specifically: The recognition and cutting module 110 is used to obtain the image to be recognized, and recognize and cut the image to be recognized to determine the initial geometric illustration; An optimization processing module 120 is used to optimize the initial geometric illustration to determine a target geometric illustration; The vector element determination module 130 is used to perform denoising on the target geometric illustration to obtain a denoised geometric illustration, obtain image features of the denoised geometric illustration, classify the image features to determine the target geometric element, and determine the first vector element according to the target geometric element and the geometric element relationship obtained by disassembling the target geometric element; wherein the target geometric element includes at least one of a solid line, a dotted line, a line segment with an arrow, a circle, an ellipse, an angle, an arc, a curve, and text; The export module 140 is used to edit the vector elements to be edited in the first vector elements based on the editing instruction, determine the vector graphics according to the vector elements to be edited and the non-edited vector elements, and export the vector graphics to the graphic resource library in a standard format.
[0087] It should be noted that each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the embodiments can be referred to each other. For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. Any processing method described in the method embodiment can be implemented by the corresponding processing module in the device embodiment, and will not be repeated one by one in the device embodiment.
[0088] See also Figure 4 , Figure 4 An electronic device 200 proposed in an embodiment of the present application is shown, and the electronic device 200 may be a computer, a tablet, a mobile phone, etc. The electronic device 200 in the present application may include one or more of the following components: a processor 210, a memory 220, and one or more applications, wherein the one or more applications may be stored in the memory 220 and configured to be executed by one or more processors 210, and the one or more applications are configured to execute the method described in the foregoing method embodiment.
[0089] The processor 210 may include one or more processing cores. The processor 210 uses various interfaces and lines to connect various parts of the entire electronic device 200, and executes various functions and processes data of the electronic device 200 by running or executing instructions, programs, code sets or instruction sets stored in the memory 220, and calling data stored in the memory 220. Optionally, the processor 210 can be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), and programmable logic array (PLA). The processor 210 can integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. Among them, the CPU mainly processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 210, but may be implemented separately through a communication chip.
[0090] The memory 220 may include a random access memory (RAM) or a read-only memory (ROM). The memory 220 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 220 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a feature extraction function, a vectorization processing function, an export function, etc.), instructions for implementing the following various method embodiments, etc. The data storage area may also store data (such as a target geometric element, a first vector element, etc.) created by the electronic device 200 during use.
[0091] See also Figure 5 , Figure 5 The structure block diagram of a computer-readable storage medium proposed in the embodiment of the present application is shown. The computer-readable storage medium 300 stores program codes, and the program codes can be called by a processor to execute the method described in the above method embodiment.
[0092] The computer-readable storage medium 300 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM, a hard disk, or a ROM. Optionally, the computer-readable storage medium 300 includes a non-transitory computer-readable storage medium. The computer-readable storage medium 300 has storage space for program code 310 for executing any method steps in the above method. These program codes can be read from or written to one or more computer program products. The program code 310 can be compressed in an appropriate form.
[0093] The present application provides a method, device, equipment and storage medium for processing geometric figures, which obtains an image to be identified, identifies and cuts the image to be identified to determine an initial geometric illustration; optimizes the initial geometric illustration to determine a target geometric illustration; performs denoising on the target geometric illustration to obtain a denoised geometric illustration, obtains image features of the denoised geometric illustration, classifies the image features to determine the target geometric element, and determines the first vector element based on the target geometric element and the geometric element relationship obtained by disassembling the target geometric element; edits the vector element to be edited in the first vector element based on the editing instruction, determines the vector graphic based on the vector element to be edited and the non-edited vector element, and exports the vector graphic to the graphic resource library in a standard format. Thus, by performing high-precision identification of geometric figures, the labor cost of subsequent adjustments is greatly reduced; at the same time, because the corresponding vector elements are obtained by identifying and disassembling the geometric figures on the basis of optimizing the initial geometric illustration, vectorized editing can be performed later, which not only meets the requirements of high-precision and high-efficiency identification of geometric figures, but also meets the requirements of high-efficiency and high-accuracy editing of the identified geometric figures later.
[0094] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for processing geometric figures, characterized in that: The method comprises: Acquire an image to be identified, and identify and cut the image to be identified to determine an initial geometric illustration; Optimizing the initial geometric illustration to determine a target geometric illustration; De-noising the target geometric illustration to obtain a denoised geometric illustration, obtaining image features of the denoised geometric illustration, classifying the image features to determine target geometric elements, and determining a first vector element according to a relationship between the target geometric elements and geometric elements obtained by disassembling the target geometric elements; wherein the target geometric elements include at least one of a solid line, a dotted line, a line segment with an arrow, a circle, an ellipse, an angle, an arc, a curve, and text; The vector elements to be edited in the first vector elements are edited based on the editing instruction, vector graphics are determined according to the vector elements to be edited and non-edited vector elements, and the vector graphics are exported to a graphic resource library in a standard format.
2. The method according to claim 1, characterized in that Before editing the first vector element in the first vector elements based on the editing instruction, the method further includes: Acquire a second vector element corresponding to the target geometric illustration based on the target geometric element; Determine a first distance between the first vector element and the target geometric element, and determine a second distance between the second vector element and the target geometric element; determining a target vector element based on the first vector element, the first distance, the second vector element, and the second distance; The editing of the to-be-edited vector element in the first vector element based on the editing instruction includes: The to-be-edited vector element in the target vector element is edited based on the editing instruction.
3. The method according to claim 2, characterized in that The acquiring, based on the target geometric element, a second vector element corresponding to the target geometric illustration comprises: Acquire a second geometric element included in each line in the target geometric illustration based on the target geometric element; A corresponding fitting method is selected based on the second geometric element to determine a second vector element.
4. The method according to claim 3, characterized in that The determining a target vector element based on the first vector element, the first distance, the second vector element, and the second distance comprises: Acquire a first vector element corresponding to a first distance greater than or equal to a preset distance as a first preliminary screening element; determining a correction element based on the first preliminary screening element, the second vector element, the first distance, and the second distance; A target vector element is determined based on the first vector element and the correction element.
5. The method according to claim 4, characterized in that The determining of the correction element based on the first preliminary screening element, the second vector element, the first distance and the second distance comprises: Determine a second preliminary screening element in the second vector element corresponding to the first preliminary screening element; The vector elements whose second distance in the second preliminary screening elements is smaller than the first distance are used as correction elements.
6. The method according to claim 5, characterized in that The determining of the target vector element based on the first vector element and the correction element comprises: Acquire vector elements in the first vector elements that do not correspond to the correction elements as non-correction elements; A target vector element is determined based on the non-corrected element and the corrected element.
7. The method according to any one of claims 1 to 6, characterized in that: The step of optimizing the initial geometric illustration to determine the target geometric illustration includes: Performing handwriting removal processing on the initial geometric illustration to obtain a handwriting-free geometric illustration; The de-handwritten geometric illustration is binarized to obtain a target geometric illustration.
8. A geometric figure processing device, characterized in that: The device comprises: A recognition and cutting module is used to obtain an image to be recognized, and to recognize and cut the image to be recognized to determine an initial geometric illustration; An optimization processing module, used for optimizing the initial geometric illustration to determine a target geometric illustration; A vector element determination module is used to perform denoising on the target geometric illustration to obtain a denoised geometric illustration, obtain image features of the denoised geometric illustration, classify the image features to determine the target geometric element, and determine the first vector element according to the target geometric element and the geometric element relationship obtained by disassembling the target geometric element; wherein the target geometric element includes at least one of a solid line, a dotted line, a line segment with an arrow, a circle, an ellipse, an angle, an arc, a curve and text; The export module is used to edit the vector elements to be edited in the first vector elements based on the editing instructions, determine the vector graphics according to the vector elements to be edited and the non-edited vector elements, and export the vector graphics to the graphic resource library in a standard format.
9. An electronic device, characterized in that: include: one or more processors; Memory; One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, and the one or more applications are configured to execute the method according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program codes, which can be called by a processor to execute the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Stick figure computer scoring and auxiliary coloring method
CN106530317A
Vector element correction method and vector element correction device
CN106886984A
Vector diagram drawing method and device, equipment and storage medium
CN114693840A
Vector graph generation method and device, readable storage medium and electronic equipment
CN115761043A
Image processing method and device based on vector graph drawing
CN116645678A
