Graph generation method, system and equipment for line identification

Lines are formed by receiving the point connection obtained by receiving the touch event, and multiple line segments are fitted through the line segment detection algorithm to determine whether it constitutes an ellipse or circle, and finally generate the corresponding geometric figures, solving the problem of relying on third-party libraries and complex algorithms in the existing technology, and achieving efficient and accurate graph recognition and generation.

CN119516031APending Publication Date: 2025-02-25SICHUAN CHANGHONG EDUCATION TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411625890.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-14
Publication Date
2025-02-25

AI Technical Summary

Technical Problem

The prior art requires a large number of computing resources and complex algorithms in graph recognition and generation, and relies on third-party image libraries and algorithm libraries to increase the complexity of the software.

Method used

By receiving all the points obtained by receiving the touch event, connecting them to form lines, determining whether they can form a closed geometric figure, and fitting multiple line segments through the line segment detection algorithm to determine whether they form an ellipse or circle, and finally generating the corresponding geometric figure based on the fitted line segment connection relationship.

Benefits of technology

It realizes accurate and efficient identification of lines from images and generates corresponding graphics without relying on third-party image libraries and algorithm libraries, which simplifies software complexity and supports multi-end and multi-platform graphics recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119516031A_ABST
    Figure CN119516031A_ABST
Patent Text Reader

Abstract

The invention discloses a line identification graph generation method, system and equipment. The method comprises the following steps: receiving all points obtained by a touch event; sequentially connecting all the received points to form lines, and judging whether the lines can form a closed geometric figure or not; fitting the lines capable of forming the closed geometric figure into a plurality of line segments according to a set error threshold value, judging whether the plurality of line segments formed by fitting can form an ellipse or a circle or not, and drawing according to the geometric figure formed by the plurality of line segments formed by fitting. According to the method, the lines can be accurately and efficiently identified from the image and the corresponding graph can be generated without depending on any other third-party image library and algorithm library; according to the method, the path lines are generated and calculated by acquiring the points generated by events such as touch or a mouse, then the path lines are fitted into the multiple line segments to judge whether the corresponding geometric figures are generated or not, and due to independence of the method, figure recognition can be achieved at multiple terminals and multiple platforms.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of graphic recognition and generation, and in particular to a graphic generation method, system and device for line recognition. Background Art

[0002] At present, there are two main graphics drawing solutions for electronic whiteboards. One is to select a graphics mode with a specific shape and directly draw a regular specific shape to a specified position; the other is to integrate OpenCV with the whiteboard to recognize hand-drawn handwriting, and then correct and draw after recognizing it as a specific shape. The solution integrating OpenCV requires a lot of computing resources and complex algorithms to process and recognize graphics in images. If only simple graphics are recognized, other image algorithm libraries often need to be introduced, which greatly increases the complexity of the software. Summary of the invention

[0003] In order to solve the technical problems existing in the prior art, the purpose of the present invention is to provide a graphics generation method, system and device for line recognition, which can accurately and efficiently recognize lines from images and generate corresponding graphics without relying on any other third-party image library and algorithm library.

[0004] The present invention solves the above problems through the following technical solutions:

[0005] A method for generating graphics for line recognition, comprising:

[0006] Receive all points obtained by touch events; connect all received points in sequence to form lines, and determine whether the lines can form a closed geometric figure;

[0007] The lines that can form a closed geometric figure are fitted into multiple line segments according to a set error threshold, and it is determined whether the multiple fitted line segments can form an ellipse or a circle, and the geometric figure formed by the multiple fitted line segments is drawn.

[0008] As a further improvement, the determination of whether the multiple fitted line segments can form an ellipse or a circle is achieved by identifying the multiple fitted line segments through a line segment detection algorithm.

[0009] As a further improvement, the line segment detection algorithm includes any one of edge detection, line fitting and line screening.

[0010] As a further improvement, the geometric figure formed by the multiple fitted line segments is drawn, and the drawing process generates the corresponding geometric figure according to the connection relationship between the multiple fitted line segments.

[0011] As a further improvement, the connection relationship includes endpoints, intersections and adjacent relationships of line segments.

[0012] As a further improvement, the receiving of all points obtained by the touch event is specifically: receiving a touch event of the device or a mouse press event, and starting to record, obtaining all point data generated during movement until a lift event is obtained, and stopping recording.

[0013] As a further improvement, all the received points are connected in sequence to form lines, and it is determined whether the lines can form a closed geometric figure. Specifically, all the received points are connected in sequence to form lines, and it is determined whether the multiple lines formed have intersections; if so, it is deemed that they can form a closed geometric figure; if not, it is deemed that they cannot form a closed geometric figure.

[0014] As a further improvement, after the lines that can form a closed geometric figure are fitted into a plurality of line segments according to a set error threshold, the fitted plurality of line segments are preprocessed to remove meaningless line segments.

[0015] At the same time, the present invention also solves the above problems through the following technical solutions:

[0016] A line recognition graphics generation system, used to implement the line recognition graphics generation method as described above, comprising:

[0017] Image input module, used to receive all points acquired by touch events;

[0018] An image preprocessing module, used to sequentially connect all points obtained from the received touch events to form lines, and perform preprocessing to determine whether the lines can form a closed geometric figure;

[0019] A line recognition module is used to recognize lines that can form closed geometric figures, fit them into multiple line segments according to a set error threshold, and determine whether the multiple line segments formed by fitting can form an ellipse or a circle;

[0020] A graphics generation module, used to generate corresponding geometric graphics according to the connection relationship between the multiple fitted line segments;

[0021] Output module, used to output the generated geometry.

[0022] In addition, the present invention also solves the above-mentioned problem through the following technical solutions:

[0023] An electronic device comprises a processor, a memory and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned graphic generation method for line recognition when executing the computer program.

[0024] Compared with the prior art, the present invention has the following advantages and beneficial effects:

[0025] The present invention can accurately and efficiently identify lines from images and generate corresponding graphics without relying on any other third-party image libraries and algorithm libraries. It generates and calculates path lines by acquiring points generated by events such as touch or mouse, and then fits them into multiple line segments to determine whether corresponding geometric figures are generated. Due to the independence of this method, graphic recognition can be implemented on multiple terminals and platforms. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] Figure 1 A flow chart of a method for generating a line recognition graphic of the present invention;

[0027] Figure 2 A series of schematic diagrams of points obtained for the device in the present invention;

[0028] Figure 3 A schematic diagram of a line segment is formed by points where the line segments are close to each other in the present invention;

[0029] Figure 4 A schematic diagram showing that the points close to the line segments in the present invention do not satisfy the requirement of forming a line segment;

[0030] Figure 5 It is a schematic diagram of the line set obtained in the present invention;

[0031] Figure 6 The figure is a block diagram of a line recognition graphics generation system of the present invention. DETAILED DESCRIPTION

[0032] In order to make the purpose, technical solutions and advantages of the present application clearer, the technical solutions in the embodiments of the present application will be described in more detail below in conjunction with the drawings in the preferred embodiments of the present application. In the drawings, the same or similar reference numerals throughout represent the same or similar parts or parts with the same or similar functions. The described embodiments are part of the embodiments of the present application, not all of the embodiments. The embodiments described below with reference to the drawings are exemplary and are intended to be used to explain the present application, and should not be construed as limitations on the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.

[0033] The embodiments of the present application are described in detail below with reference to the accompanying drawings.

[0034] In the description of the present application, it should be noted that, unless expressly provided and limited otherwise, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or display comprising a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units that are not explicitly listed or inherent to these processes, methods, products or displays.

[0035] Example 1

[0036] See attached Figure 1-5 , a graphics generation method for line recognition, comprising:

[0037] Receive all points obtained by touch events; connect all received points in sequence to form lines, and determine whether the lines can form a closed geometric figure;

[0038] The lines that can form a closed geometric figure are fitted into multiple line segments according to a set error threshold, and it is determined whether the multiple fitted line segments can form an ellipse or a circle, and the geometric figure formed by the multiple fitted line segments is drawn.

[0039] Preferably, whether the multiple fitted line segments can form an ellipse or a circle is determined by identifying the multiple fitted line segments through a line segment detection algorithm to achieve the determination. The line segment detection algorithm includes any one of edge detection, line fitting and line screening.

[0040] The geometric figures formed by the fitted multiple line segments are drawn; the drawing process generates the corresponding geometric figures according to the connection relationship between the fitted multiple line segments, which includes the endpoints, intersections and adjacent relationships of the line segments.

[0041] In an optional embodiment, all points obtained by the touch event are received, specifically: a touch event of the device or a mouse press event is received, and recording begins, obtaining all point data generated during movement until a lift event is obtained, and recording stops.

[0042] In another optional embodiment, all received points are sequentially connected to form lines, and it is determined whether the lines can form a closed geometric figure. Specifically, all received points are sequentially connected to form lines, and it is determined whether the multiple lines formed have intersections; if so, it is deemed that they can form a closed geometric figure; if not, it is deemed that they cannot form a closed geometric figure.

[0043] Determine whether the multiple lines formed have any intersection; preferably, the first and last points may be extended to determine whether there is any intersection.

[0044] In another optional embodiment, after the lines that can form a closed geometric figure are fitted into multiple line segments according to a set error threshold, the multiple fitted line segments need to be preprocessed to remove meaningless line segments such as those that are too short.

[0045] In another optional embodiment, it is determined whether the multiple fitted line segments can form an ellipse or a circle, and the geometric figure formed by the multiple fitted line segments is drawn; the specific method is: determine whether the number of the multiple fitted line segments exceeds n, if so, try to re-fit the multiple lines into an ellipse or a circle, and if it can be drawn into an ellipse or a circle, the drawing is completed; if it cannot be drawn into an ellipse or a circle, draw the corresponding geometric figure; wherein n≥8. If not, directly draw the corresponding geometric figure, and the drawing is completed.

[0046] In a specific embodiment, the method can be applied to the process of identifying lines as geometric figures. The method comprises the following steps:

[0047] A. Detect the set of points generated by touch or mouse events when the program is running.

[0048] When the program is running, it receives a touch event or a mouse press event from the device, and starts recording from this point. When moving, a series of point data will be generated until a lift event is triggered, and the recording stops. For a schematic diagram of a series of points obtained from the device, refer to the attached Figure 2 .

[0049] B. Perform connection calculations on the recorded points.

[0050] Connect the recorded points in sequence to determine whether the lines formed by these points have any intersections, or whether the first and last points have any intersections after being extended. If so, it is considered to form a closed figure, otherwise the line will be considered to be unrecognizable as a geometric figure.

[0051] C. If a closed figure can be formed, try to fit the lines into multiple line segments.

[0052] According to the threshold of a given point deviation, the points are fitted to obtain multiple intersecting line segments. The obtained line segments are preprocessed to remove short and meaningless line segments.

[0053] A series of points acquired from the device that can form a closed figure are fitted into a line segment starting from the first point. The tentative error threshold is 5 pixels, that is, the distance between the point that can be fitted into a line segment and the line segment cannot exceed 5 pixels; refer to the attached Figure 3 , the points close to the line segment satisfy the requirement to form a line segment. If you add the next point to the previous point and try to fit it to a line segment, refer to the attached Figure 4, there are several points that deviate from the line segment by more than 5 pixels, then this point and the previous point should not be fitted into a line segment. Repeat the above steps and you should get Figure 5 The set of line segments shown, in this embodiment, the geometric figure composed of these points should be a quadrilateral.

[0054] D. Combine the line segments that meet the conditions to obtain a figure.

[0055] According to the number of line segments obtained, if there are too many line segments, the figure expressed by the line may be an ellipse. Then put the previously obtained point set into the ellipse formula to judge whether most of them are on the appropriate ellipse. If they are satisfied, the figure is an ellipse. Otherwise, according to the obtained line segments, get their endpoint coordinates, connect them in sequence and connect the head and tail to get the corresponding geometric figure.

[0056] Example 2

[0057] See attached Figure 6 , a line recognition graphics generation system, used to implement the line recognition graphics generation method described in embodiment 1, comprising:

[0058] Image input module, used to receive all points acquired by touch events;

[0059] An image preprocessing module, used to sequentially connect all points obtained from the received touch events to form lines, and perform preprocessing to determine whether the lines can form a closed geometric figure;

[0060] A line recognition module is used to recognize lines that can form closed geometric figures, fit them into multiple line segments according to a set error threshold, and determine whether the multiple line segments formed by fitting can form an ellipse or a circle;

[0061] A graphics generation module, used to generate corresponding geometric graphics according to the connection relationship between the multiple fitted line segments;

[0062] Output module, used to output the generated geometry.

[0063] In addition, this embodiment further provides an electronic device, which includes a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements the line recognition graphic generation method described in Embodiment 1 when executing the computer program;

[0064] This embodiment further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed, the method for generating graphics for line recognition described in Embodiment 1 is implemented.

[0065] Although the present invention is described herein with reference to the illustrative embodiments of the present invention, the above embodiments are only preferred embodiments of the present invention, and the embodiments of the present invention are not limited to the above embodiments. It should be understood that those skilled in the art can design many other modifications and embodiments, which will fall within the scope and spirit of the principles disclosed in this application.

Claims

1. A method for generating graphics for line recognition, characterized in that: include: Receive all points obtained by touch events; Connect all received points in sequence to form lines, and determine whether the lines can form a closed geometric figure; The lines that can form a closed geometric figure are fitted into multiple line segments according to a set error threshold, and it is determined whether the multiple fitted line segments can form an ellipse or a circle, and the geometric figure formed by the multiple fitted line segments is drawn.

2. The method for generating graphics for line recognition according to claim 1, characterized in that: The determination of whether the multiple fitted line segments can form an ellipse or a circle is achieved by identifying the multiple fitted line segments through a line segment detection algorithm.

3. The method for generating graphics for line recognition according to claim 2, characterized in that: The line segment detection algorithm includes any one of edge detection, line fitting and line screening.

4. The method for generating graphics for line recognition according to claim 1, characterized in that: The geometric figure formed by the multiple fitted line segments is drawn, and the drawing process generates the corresponding geometric figure according to the connection relationship between the multiple fitted line segments.

5. A method for generating graphics for line recognition according to claim 4, characterized in that: The connection relationship includes endpoints, intersections and adjacent relationships of line segments.

6. The method for generating graphics for line recognition according to claim 1, characterized in that: The receiving of all points obtained by the touch event specifically includes: receiving a touch event of the device or a press event of the mouse, starting to record, obtaining all point data generated during movement until a lift event is obtained, and stopping recording.

7. The method for generating graphics for line recognition according to claim 1, characterized in that: The method of connecting all the received points in sequence to form lines and determining whether the lines can form a closed geometric figure is specifically as follows: connecting all the received points in sequence to form lines and determining whether the formed multiple lines have intersections; if so, it is deemed that they can form a closed geometric figure; if not, it is deemed that they cannot form a closed geometric figure.

8. The method for generating graphics for line recognition according to claim 1, characterized in that: After the lines that can form a closed geometric figure are fitted into a plurality of line segments according to a set error threshold, the fitted plurality of line segments are preprocessed to remove meaningless line segments.

9. A line recognition graphics generation system, used to implement a line recognition graphics generation method as claimed in any one of claims 1 to 8, characterized in that: include: Image input module, used to receive all points acquired by touch events; An image preprocessing module, used to sequentially connect all points obtained from the received touch events to form lines, and perform preprocessing to determine whether the lines can form a closed geometric figure; A line recognition module is used to recognize lines that can form closed geometric figures, fit them into multiple line segments according to a set error threshold, and determine whether the multiple line segments formed by fitting can form an ellipse or a circle; A graphics generation module, used to generate corresponding geometric graphics according to the connection relationship between the multiple fitted line segments; Output module, used to output the generated geometry.

10. An electronic device, characterized in that: The method comprises a processor, a memory and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, a graphic generation method for line recognition as claimed in any one of claims 1 to 8 is implemented.