A graphic recognition method, a method and a device for determining a graphic recognition template

By obtaining the element feature information in the image and comparing the preset template, using the minimum enclosing circle algorithm to identify rules and irregular graphics, the problem of AutoCAD's low efficiency in processing irregular graphics is solved, and the designer's work efficiency is improved. Identification accuracy.

CN113869223BActive Publication Date: 2025-01-10GUANGDONG SANWEIJIA INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111148866.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-28
Publication Date
2025-01-10
Estimated Expiration
2041-09-28

AI Technical Summary

Technical Problem

AutoCAD does not support third-party graphics processing libraries when processing irregular graphics, resulting in designers requiring manual identification, which is large in workload and inefficient.

Method used

By obtaining the element feature information in the image and comparing it with the preset graphic recognition template, the minimum enclosing circle algorithm is used to identify rules and irregular graphics to improve the recognition efficiency.

Benefits of technology

It greatly improves the designer's drawing efficiency, reduces time and employment costs, and improves the accuracy of irregular graphics recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113869223B_ABST
    Figure CN113869223B_ABST
Patent Text Reader

Abstract

The embodiments of the present invention relate to a method for graphic recognition, a method for determining a graphic recognition template, and an apparatus, including: obtaining a first image to be subjected to graphic recognition, wherein the first image includes at least one object to be recognized; extracting the primitive feature information included in any object to be recognized in the first image; and performing graphic recognition classification on all objects to be recognized in the first image according to the primitive feature information of each object to be recognized in the first image and a preset graphic recognition template, so as to obtain regular graphics and irregular graphics. Therefore, the technical solution provided by the embodiments of the present invention realizes graphic classification, for example, regular graphics and irregular graphics, by comparing the primitive feature information of the object image with the primitive feature information in the template one by one. Identifying irregular graphic blocks can greatly improve the drawing efficiency of designers, reduce the time cost of designers, and reduce the employment cost and time cost of enterprises.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to the field of computer technology, and in particular to a graphic recognition method, a method and device for determining a graphic recognition template, an electronic device, and a storage medium. Background Art

[0002] In the industries of architecture and interior design, AutoCAD (Autodesk Computer Aided Design) is often needed to draw pictures. However, when it comes to processing irregular graphics, AutoCAD does not support third-party graphics processing libraries to identify irregular graphics. If designers are asked to identify irregular graphics one by one, the workload will be very large, resulting in low work efficiency. Summary of the invention

[0003] In view of this, in order to solve the above-mentioned technical problems, embodiments of the present invention provide a graphic recognition method, a method and device for determining a graphic recognition template, an electronic device and a storage medium.

[0004] In a first aspect, an embodiment of the present invention provides a graphic recognition method, comprising:

[0005] Acquire a first image to be subjected to graphic recognition, wherein the first image includes at least one object to be recognized;

[0006] Extracting feature information of graphic elements included in any object to be identified in the first image;

[0007] According to the graphic feature information of each of the objects to be identified in the first image and a preset graphic recognition template, graphic recognition classification is performed on all the objects to be identified in the first image to obtain regular graphics and irregular graphics.

[0008] In a possible implementation, the primitive feature information includes a primitive type and the number of primitives included in the primitive type, and the performing of graphic recognition classification on all objects to be recognized in the first image according to the primitive feature information of each object to be recognized in the first image and a preset graphic recognition template to obtain regular graphics and irregular graphics includes:

[0009] Compare the primitive type of each object to be identified in the first image and the number of primitives contained in the primitive type with the primitive type and the number of primitives contained in the primitive type pre-stored in a preset graphic recognition template;

[0010] When it is determined that the primitive type of any object to be identified in the first image and the number of primitives included in the primitive type are the same as the primitive type and the number of primitives included in the primitive type pre-stored in the preset graphic recognition template, determining that the object to be identified is a regular graphic;

[0011] When it is determined that the primitive type of any object to be identified in the first image and the number of primitives contained in the primitive type are different from the primitive type and the number of primitives contained in the primitive type pre-stored in the preset graphic recognition template, it is determined that the object to be identified is an irregular graphic.

[0012] In a possible implementation, the method further includes:

[0013] Determine relevant coordinate points of each of the graphic element types of the object to be identified to obtain a set of coordinate points;

[0014] The method further comprises: performing graphic recognition classification on all objects to be recognized in the first image according to the graphic element feature information of each object to be recognized in the first image and a preset graphic recognition template to obtain regular graphics and irregular graphics.

[0015] For all the objects to be identified that are determined to be irregular shapes, the coordinate point set of each object to be identified that is determined to be an irregular shape is processed by a minimum enclosing circle algorithm to obtain a corresponding first minimum enclosing circle;

[0016] Determine the similarity between a first minimum enclosing circle corresponding to any object to be identified that is determined to be an irregular shape and a second minimum enclosing circle in a preset shape recognition template;

[0017] When it is determined that the similarity is greater than or equal to the preset similarity, the object to be identified that is determined to be an irregular shape is determined to be a regular shape.

[0018] In a possible implementation, extracting feature information of graphic elements included in any object to be identified in the first image includes:

[0019] Extract all the graphic elements of any object to be identified according to the preset graphic element template;

[0020] Classify all the extracted graphics elements according to the preset graphics element types;

[0021] Count the number of primitives contained in each preset primitive type;

[0022] All the primitive types and the number of primitives in each primitive type are associated to determine the primitive feature information.

[0023] In a second aspect, an embodiment of the present invention provides a method for determining a graphic recognition template, comprising:

[0024] Acquire a second image, wherein the second image includes at least one sample object image;

[0025] Determining primitive feature information of each of the sample object images;

[0026] A graphic recognition template is determined based on the sample object image and the corresponding graphic element feature information.

[0027] In a possible implementation manner, determining the primitive feature information of each sample object graph includes:

[0028] Explode any of the sample object images using a preset object image explosion model to obtain all the graphic elements of the sample object image;

[0029] Classifying all the primitives to obtain the primitives contained in each primitive type and the total number of primitives;

[0030] The primitive type, primitives in the primitive type, and the total number of primitives corresponding to the sample object graph are associated to obtain primitive feature information of the sample object graph.

[0031] In a possible implementation manner, determining the primitive feature information of each of the sample object graphs further includes:

[0032] For a graphic element in any graphic element type, determine the relevant coordinate points of each graphic element to obtain a set of coordinate points;

[0033] The coordinate point set is added to the primitive feature information.

[0034] In a possible implementation, the method further includes:

[0035] After classifying all the primitives to obtain the primitives included in each primitive type and the total number of primitives, determining any primitive included in any primitive type as a target primitive;

[0036] Delete other primitives in the preset primitive type except the target primitive.

[0037] In a possible implementation, associating the primitive type, primitives in the primitive type, and the total number of primitives corresponding to the sample object graph to obtain primitive feature information of the sample object graph includes:

[0038] The primitive type corresponding to the sample object graph, the target primitive in the primitive type, and the total number of primitives are associated to obtain primitive feature information of the sample object graph.

[0039] In a possible implementation, determining a graphic recognition template based on the sample object image and corresponding graphic element feature information includes:

[0040] For any sample object graph, the primitive type, primitives in the primitive type, and the total number of primitives corresponding to the sample object graph are associated with the sample object graph to obtain a graphic recognition template of the sample object graph.

[0041] In a possible implementation, the determining the graphic recognition template based on the sample object image and the corresponding graphic element feature information includes:

[0042] For any sample object graph, the coordinate point set of the sample object graph is processed by a minimum enclosing circle algorithm to obtain a minimum enclosing circle containing the coordinate point set of the sample object graph;

[0043] The primitive type corresponding to the sample object graph, the primitives in the primitive type, the total number of primitives and the minimum enclosing circle are associated with the sample object graph to obtain a graphic recognition template of the sample object graph.

[0044] In a third aspect, an embodiment of the present invention provides a device for pattern recognition, including:

[0045] A first acquisition module, used to acquire a first image to be subjected to graphic recognition, wherein the first image includes at least one object to be recognized;

[0046] A feature extraction module, used to extract feature information of graphic elements included in any object to be identified in the first image;

[0047] The graphic recognition module is used to perform graphic recognition classification on all the objects to be recognized in the first image according to the graphic feature information of each object to be recognized in the first image and a preset graphic recognition template to obtain regular graphics and irregular graphics.

[0048] In a fourth aspect, an embodiment of the present invention provides a device for determining a graphic recognition template, comprising:

[0049] A second acquisition module, used to acquire a second image, wherein the second image includes at least one sample object image;

[0050] A feature determination module, used to determine the primitive feature information of each sample object image;

[0051] The template determination module is used to determine the graphic recognition template based on the sample object image and the corresponding graphic element feature information.

[0052] In a fifth aspect, an embodiment of the present invention provides an electronic device comprising: a processor and a memory, wherein the processor is used to execute an image recognition program stored in the memory to implement the graphic recognition method described in any one of the first aspects or to implement the method for determining the graphic recognition template described in any one of the second aspects.

[0053] In the sixth aspect, an embodiment of the present invention provides a storage medium, which stores one or more programs, and the one or more programs can be executed by one or more processors to implement the graphic recognition method described in any one of the first aspects or the method for determining the graphic recognition template described in any one of the second aspects.

[0054] The technical solution provided by the embodiment of the present invention can achieve graphic classification, for example, regular graphics and irregular graphics, and identify irregular graphic blocks by comparing the graphic element feature information of the object image with the graphic element feature information in the template one by one. Compared with the related art that requires designers to find irregular graphics one by one by themselves, the embodiment of the present invention can greatly improve the drawing efficiency of designers, reduce the time cost of designers, and reduce the employment cost and time cost of enterprises. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] Figure 1 A schematic diagram of a flow chart of graphic recognition according to an embodiment of the present invention;

[0056] Figure 2 A flowchart of an embodiment of a graphic recognition method provided by an embodiment of the present invention;

[0057] Figure 3 A flowchart of an embodiment of a method for determining a graphic recognition template provided by an embodiment of the present invention;

[0058] Figure 4 A block diagram of an embodiment of a device for pattern recognition provided by an embodiment of the present invention;

[0059] Figure 5 A block diagram of an embodiment of a device for determining a graphic recognition template provided by an embodiment of the present invention;

[0060] Figure 6 A schematic structural diagram of an electronic device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0061] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0062] The following is a further explanation of the method embodiment provided by the present invention with reference to specific embodiments in conjunction with the accompanying drawings, and the embodiments do not constitute a limitation on the embodiments of the present invention.

[0063] Figure 1 The figure is a flow chart of a graphic recognition process according to an embodiment of the present invention.

[0064] like Figure 1 As shown, designers are dealing with Figure 1 When a drawing shown in FIG. 1 is shown in FIG. 1 , the drawing includes, for example, a microwave oven, a chair, and a table. The designer needs to identify the objects / graphics that do not conform to the rules in the microwave oven A, chair B, and table C in the drawing, and then further process them (for example, delete, adjust, etc.). In the related art, the designer can only judge by naked eyes, which is extremely inefficient when faced with a large number of drawings.

[0065] In an embodiment of the present invention, objects / graphics that do not conform to the rules in a drawing are identified through a graphic recognition template. For example, it is identified that chair B does not conform to the rules (for example, the position is crooked). Assuming that it is identified through the template, it is marked with a dotted box as shown in the figure, so that the designer can process the objects or graphics that do not conform to the rules in the drawing. For example, after the designer processes chair B, chair B1 is obtained, that is, the position of chair B is corrected. In summary, compared with the related art, the embodiment of the present invention can improve the processing efficiency of the designer.

[0066] The embodiments of the present invention will be described in detail below with reference to the accompanying drawings.

[0067] Figure 2 A flowchart of an embodiment of a graphic recognition method provided by an embodiment of the present invention.

[0068] Step 201: Acquire a first image to be subjected to graphic recognition, wherein the first image includes at least one object to be recognized.

[0069] The first image may be, for example, an AutoCAD (Autodesk Computer Aided Design) drawing of a designer, which may include at least one object graphic, such as a microwave oven, a table, a chair, etc. The object graphic is the object to be identified.

[0070] The embodiment of the present invention can be provided in the form of SDK (Software Development Kit). After the designer completes the drawing production of AutoCAD, he can call the SDK for graphic recognition corresponding to the embodiment of the present invention. After receiving the drawing, the SDK for graphic recognition corresponding to the embodiment of the present invention executes the relevant logic of graphic recognition accordingly.

[0071] Step 202: extracting feature information of image elements included in any object to be identified in the first image.

[0072] The primitive feature information may include, for example, the primitive type and the number of primitives contained in the primitive type. A primitive is a basic graphic element, and any graphic expression is composed of a number of different points, lines, and surface patterns or a cyclic combination of the same pattern, and these points, lines, and surface patterns are basic graphic elements (primitives). In the embodiment of the present invention, a point, a line, or a surface is respectively determined as a primitive type.

[0073] In some embodiments, the primitive feature information can be extracted, for example, by extracting all primitives of any object to be identified according to a preset primitive template, classifying all extracted primitives according to preset primitive types, counting the number of primitives contained in each preset primitive type, and associating all primitive types and the number of primitives in each primitive type to determine the primitive feature information. For example, a microwave oven is composed of six arcs and four straight lines, that is, the primitive types are straight lines and arcs, where the primitive type is straight lines, the number of primitives (straight lines) is 4, and the number of primitives (arcs) is 6; another example is a chair, which is composed of 11 arcs and 6 straight lines, that is, the primitive types are arcs and straight lines, and the number of primitives in each primitive type is 11 and 6 respectively.

[0074] Step 203 , based on the graphic feature information of each object to be identified in the first image and a preset graphic recognition template, graphic recognition classification is performed on all the objects to be identified in the first image to obtain regular graphics and irregular graphics.

[0075] The preset graphic recognition template may be a pre-stored graphic recognition template used to recognize the graphic in the first image. Figure 3 The embodiment shown.

[0076] In some embodiments, the primitive type and the number of primitive types of each object to be identified in the first image can be compared with the primitive type and the number of primitives contained in the primitive type pre-stored in the preset graphic recognition template. When it is determined that the primitive type and the primitives contained in the primitive type of any object to be identified in the first image are the same as the primitive type and the primitives contained in the primitive type pre-stored in the preset graphic recognition template, the object to be identified is determined to be a regular graphic. When it is determined that the primitive type and the number of primitive types of any object to be identified in the first image are different from the primitive type and the number of primitives contained in the primitive type pre-stored in the preset graphic recognition template, the object to be identified is determined to be an irregular graphic.

[0077] In other embodiments, Figure 2On the basis of the illustrated embodiment, the following steps may also be included (not shown in the figure): determine the relevant coordinate points of each primitive type of the object to be identified to obtain a set of coordinate points. Further, step 203 may also include the following steps: for all objects to be identified that are determined to be irregular graphics, process the set of coordinate points of each object to be identified that is determined to be an irregular graphic by a minimum enclosing circle algorithm to obtain a corresponding first minimum enclosing circle; perform similarity between the first minimum enclosing circle corresponding to any object to be identified that is determined to be an irregular graphic and the second minimum enclosing circle in the preset graphic recognition template; when the similarity is greater than or equal to the preset similarity, determine that the object to be identified that is determined to be an irregular graphic is a regular graphic.

[0078] In order to enable those skilled in the art to more clearly and accurately understand the technical solutions provided by the embodiments of the present invention, the aforementioned embodiments will be further introduced in conjunction with the computer-implemented logic process.

[0079] Step 1: Receive a drawing (ie the aforementioned first image) to start processing the drawing.

[0080] Step 2: Traverse the block definitions (i.e., objects to be identified) in the drawing to determine all the block definitions (i.e., objects to be identified) in the drawing.

[0081] Step 3: Extract the primitive feature information of these block definitions (i.e., objects to be identified), and save the obtained primitive feature information in a "container" (container variable is a term, which is a variable defined by the programmer in the program, and this variable is now named DWGPrimitivesInfoMap). Because the primitive type and quantity can be different class definitions, they are uniformly expressed in Chinese here. For example, the extracted primitive feature information is expressed as std::map<primitive type, number>DWGPrimitivesInfoMap (for example, the declaration in the code can be like this std::map<*Entity, int>DWGPrimitivesInfoMap). And, according to the corresponding relationship of <primitive type, number>, for example, for a microwave oven, the content in DWGPrimitivesInfoMap is (arc, 6), (straight line, 4); for example, for a chair, the content in DWGPrimitivesInfoMap is (arc, 11), (straight line, 6).

[0082] Step 4: Determine the relevant coordinate points of the primitive type (or primitive) in the primitive feature information of the block definition (i.e. the object to be identified), for example, std::vector<coordinate point>DWGPointsVect, that is, define the coordinate variable as DWGPointsVect, and the corresponding value is expressed as (AcGePoint2d, AcGePoint3d); because the coordinate points can be defined by different classes, they are uniformly expressed in Chinese here. In the code, for example, std::map <acgepoint2d>DWGPointsVect】, and stores information according to the <coordinate point> rule, for example, PointsVect stores (0, 1, 1), (0, 0, 3), etc.; and std::vector<number of coordinate points> DWGPointsNumVector, where DWGPointsNumVector is the name of the variable defined by the programmer in the program. Because the number of coordinate points can be of different types (int, double, etc.), it is uniformly expressed in Chinese and declared in the code like this std::vector <int>DWGPointsNumVector, this variable is used to save the number of coordinate points.

[0083] Step 5: Compare the type and number of primitives that make up each block definition (i.e., the object to be identified) obtained in step 3 with the preset graphic recognition template, for example, PrimitivesInfoMap = DWGPrimitivesInfoMap, where PrimitivesInfoMap is the graphic recognition template, and each block definition in DWGPrimitivesInfoMap makes up the type and number of primitives; PrimitivesInfoMap = DWGPrimitivesInfoMap means that the block definition (i.e., the object to be identified) is a regular graphic, otherwise it is an irregular graphic.

[0084] Step 6: Based on step 4, the minimum enclosing circle algorithm is used to obtain the minimum enclosing circle corresponding to each block definition (i.e., the object to be identified), and the minimum enclosing circle corresponding to each block definition (i.e., the object to be identified) is compared with the corresponding minimum enclosing circle in the preset graphic recognition template. For example, if PointsNumVector = DWGPointsNumVector, or the similarity between PointsNumVector and DWGPointsNumVector is more than 90%, it can be considered a successful match, and the block definition (i.e., the object to be identified) is determined to be a regular graphic, otherwise it is an irregular graphic. Among them, DWGPointsNumVector is the minimum enclosing circle or coordinate set corresponding to each block definition (i.e., the object to be identified), and PointsNumVector is the corresponding minimum enclosing circle in the preset graphic recognition template.

[0085] The technical solution provided by the embodiment of the present invention can achieve graphic classification, for example, regular graphics and irregular graphics, and identify irregular graphic blocks by comparing the graphic element feature information of the object image with the graphic element feature information in the template one by one. Compared with the related art that requires designers to find irregular graphics one by one by themselves, the embodiment of the present invention can greatly improve the drawing efficiency of designers, reduce the time cost of designers, and reduce the employment cost and time cost of enterprises.

[0086] In addition, after the minimum enclosing circle of the object to be identified is determined by the minimum enclosing circle algorithm, it is compared with the corresponding minimum enclosing circle in the template. This can eliminate interference caused by factors such as the placement angle and direction of the object to be identified, and improve the recognition accuracy of irregular graphics.

[0087] Figure 3 A flow chart of an embodiment of a method for determining a graphic recognition template provided by an embodiment of the present invention.

[0088] like Figure 3 As shown, a method for determining a graphic recognition template may include the following steps:

[0089] Step 301: Acquire a second image, wherein the second image includes at least one sample object image.

[0090] The second image may be a designer's AutoCAD (Autodesk Computer Aided Design) drawing, which may include at least one object graphic. In some embodiments, the second image may include only an image of a sample object, and in this embodiment of the present invention, multiple second images are used as sample images; in other embodiments, the second image may also include multiple sample object graphics, and one or more second images are used as sample images.

[0091] Step 302: Determine the primitive feature information of each sample object graph.

[0092] In some embodiments, for each sample object graph, any sample object graph can be exploded by a preset object graph explosion model to obtain all the primitives of the sample object graph; all the primitives are classified to obtain the primitives contained in each primitive type and the total number of primitives; the primitive type corresponding to the sample object graph, the primitives in the primitive type and the total number of primitives are associated to obtain the primitive feature information of the sample object graph. For example, a microwave oven is composed of 6 arcs and 4 straight lines after being exploded by the preset object graph, that is, the primitive types are straight lines and arcs, and the total number of primitives under each primitive type is 4 and 6 respectively; another example is a chair, which is composed of 11 arcs and 6 straight lines, that is, the primitive types are arcs and straight lines, and the total number of primitives under each primitive type is 11 and 6 respectively. Assume that the container variable (container variable is a term, which is a variable defined by the programmer in the program, and this variable is now named PrimitivesInfoMap) is std::map<primitive type, number>PrimitivesInfoMap.

[0093] In some other embodiments, step 302 may also include determining relevant coordinate points of each primitive in any primitive type to obtain a coordinate point set; and adding the coordinate point set to the primitive feature information.

[0094] Step 303: Determine a graphic recognition template based on the sample object image and the corresponding graphic element feature information.

[0095] In some embodiments, for any sample object graph, the corresponding primitive type, primitives in the primitive type, and the total number of primitives corresponding to the sample object graph can be associated with the sample object graph to obtain a graphic recognition template for the sample object graph. For example, in the code, it can be declared like this std::map<*Entity, int>PrimitivesInfoMap, and the information we want is stored according to the correspondence of <element type, total number>. For example, if the sample object image is a microwave oven, the content in PrimitivesInfoMap is (arc, 6), (straight line, 4), which can be implemented by the following code: std::map<*Entity, int>PrimitivesInfoMap; PrimitivesInfoMap[Arc]=6; PrimitivesInfoMap[Line]=4; for example, if the sample object image is a chair, the content in PrimitivesInfoMap is (arc, 11), (straight line, 6), which can be implemented by the following code: std::map<*Entity, int>PrimitivesInfoMap; PrimitivesInfoMap[Arc]=11; PrimitivesInfoMap[Line]=6. The above method of associating the sample object graph, primitive type, primitives in the primitive type, and the total number of primitives forms a graphic recognition template. In some embodiments, the sample object graph, primitive type, and the total number of primitives can also be associated to form a graphic recognition template.

[0096] In other embodiments, for any sample object image, the coordinate point set of the sample object image is processed by a minimum enclosing circle algorithm to obtain a minimum enclosing circle containing the coordinate point set of the sample object image, and the primitive type corresponding to the sample object image, the primitives in the primitive type, the total number of primitives, and the minimum enclosing circle are associated with the sample object image to obtain a graphic recognition template of the sample object image.

[0097] Exemplarily, because the orientation of the drawing (second image / first image) and the graphic blocks (e.g., the sample object diagram) is uncertain, in order to avoid the influence of the orientation factor on the algorithm, the embodiment of the present invention adopts the minimum enclosing circle algorithm, and obtains the number of coordinate points on the circle for the coordinate point set (e.g., defined as PointsVect), and saves it in a container variable (refer to the above content). Assume that the container variable is std::vector<number of coordinate points>PointsNumVector, and then the coordinate point set PointsVect removes the points on the circle to obtain the remaining coordinate points that have not passed the minimum enclosing circle algorithm, and then continues to use the minimum enclosing circle algorithm. The same steps are performed on the remaining coordinate points, that is, the minimum enclosing circle algorithm is used to process the remaining coordinate points, and the number of points on the circle is saved in PointsNumVector, assuming that it is defined as PointsNumVector.push(coordinate point), such as PointsNumVector.push(AcGePoint3d(0,0,1)); the minimum enclosing circle algorithm is continued to be used for the remaining coordinate points that have not passed the minimum enclosing circle algorithm, and then saved until the number of coordinates in the coordinate point set PointsVect is zero, at which time the minimum enclosing circle of all coordinate point sets that can enclose the primitives of the sample object graph will be obtained. Further, the primitive type corresponding to the sample object graph, the primitives in the primitive type, the total number of primitives, and the minimum enclosing circle are associated with the sample object graph, that is, the graphic recognition template of the sample object graph is obtained.

[0098] In some embodiments of the present invention, after classifying all primitives to obtain the primitives included in each primitive type and the total number of primitives, any primitive included in any primitive type can be determined as a target primitive, and then the other primitives except the target primitive in the preset primitive type are deleted. For example, there are 10 primitives of a chair being a straight line. In order to reduce the later calculation cost and storage cost, a straight line primitive can be determined as the target primitive, stored as a template, and the remaining 9 straight line primitives except the target primitive are deleted.

[0099] Through the method for determining the graphic recognition template provided by the embodiment of the present invention, irregular graphics in the drawings designed by the designer (related graphics that do not meet the drawing specifications, do not meet the design layout, do not meet the design requirements, etc.) can be automatically identified to improve the design efficiency; in addition, through the minimum enclosing circle algorithm, the automatic recognition process can be avoided from being affected by the direction, position, etc. of the object to be identified, thereby improving the accuracy of automatic recognition.

[0100] In addition to the aforementioned method embodiment, a device corresponding to the aforementioned method embodiment is also provided. The device in the embodiment of the present invention will be described in detail below with reference to the accompanying drawings.

[0101] Figure 4 A block diagram of an embodiment of a graphic recognition device provided by an embodiment of the present invention.

[0102] like Figure 4 As shown, a graphic recognition device in an embodiment of the present invention may include: a first acquisition module 41, a feature extraction module 42 and a graphic recognition module 43. Among them:

[0103] The first acquisition module 41 may be used to acquire a first image to be subjected to graphic recognition, wherein the first image includes at least one object to be recognized.

[0104] The feature extraction module 42 may be used to extract feature information of graphic elements included in any object to be identified in the first image.

[0105] The graphic recognition module 43 may be configured to perform graphic recognition classification on all objects to be recognized in the first image according to the graphic element feature information of each object to be recognized in the first image and a preset graphic recognition template, so as to obtain regular graphics and irregular graphics.

[0106] In some embodiments, when the primitive feature information includes a primitive type and the number of primitives included in the primitive type, the graphic recognition module 43 may include:

[0107] A comparison unit (not shown in the figure) can be used to compare the primitive type of each object to be identified in the first image and the number of primitives contained in the primitive type with the primitive type and the number of primitives contained in the primitive type pre-stored in a preset graphic recognition template.

[0108] A first determination unit (not shown in the figure) can be used to determine that the object to be identified in the first image is a regular graphic when the primitive type of the object to be identified in the first image and the number of primitives contained in the primitive type are the same as the primitive type and the number of primitives contained in the primitive type pre-stored in a preset graphic recognition template, and can also be used to determine that the object to be identified in the first image is an irregular graphic when the primitive type of the object to be identified in the first image and the number of primitives contained in the primitive type are different from the primitive type and the number of primitives contained in the primitive type pre-stored in the preset graphic recognition template.

[0109] In some other embodiments, a graphic recognition device may further include a coordinate set determination module (not shown in the figure).

[0110] The coordinate set determination module may be used to determine the relevant coordinate points of each of the graphic element types of the object to be identified, so as to obtain a coordinate point set.

[0111] Furthermore, in the case where the graphic recognition device may further include a coordinate set determination module (not shown in the figure), the graphic recognition module 43 may further include: a first coordinate processing unit (not shown in the figure), a similarity determination unit (not shown in the figure) and a second determination unit (not shown in the figure).

[0112] The first coordinate processing unit may be used to process the coordinate point set of each object to be identified that is determined to be an irregular shape by a minimum enclosing circle algorithm to obtain a corresponding first minimum enclosing circle.

[0113] The similarity determination unit may be used to determine the similarity between a first minimum enclosing circle corresponding to any object to be identified that is determined to be an irregular shape and a second minimum enclosing circle in a preset shape recognition template.

[0114] The second determining unit (not shown in the figure) can be used to determine that the object to be identified that is determined to be an irregular shape is a regular shape when it is determined that the similarity is greater than or equal to a preset similarity.

[0115] In some other embodiments, the feature extraction module 42 may include (not shown in the figure): a primitive extraction unit, a first primitive classification unit, a statistical unit and a first association unit.

[0116] The primitive extraction unit can be used to extract all primitives of any object to be identified according to a preset primitive template.

[0117] The first primitive classification unit may be used to classify all extracted primitives according to preset primitive types.

[0118] The counting unit can be used to count the number of primitives contained in each preset primitive type.

[0119] The first associating unit may be used to associate all of the primitive types and the number of primitives in each primitive type to determine the primitive feature information.

[0120] The technical solution provided by the embodiment of the present invention can achieve graphic classification, for example, regular graphics and irregular graphics, and identify irregular graphic blocks by comparing the graphic element feature information of the object image with the graphic element feature information in the template one by one. Compared with the related art that requires designers to find irregular graphics one by one by themselves, the embodiment of the present invention can greatly improve the drawing efficiency of designers, reduce the time cost of designers, and reduce the employment cost and time cost of enterprises.

[0121] In addition, after the minimum enclosing circle of the object to be identified is determined by the minimum enclosing circle algorithm, it is compared with the corresponding minimum enclosing circle in the template. This can eliminate interference caused by factors such as the placement angle and direction of the object to be identified, and improve the recognition accuracy of irregular graphics.

[0122] Figure 5 A block diagram of an embodiment of a device for determining a graphic recognition template provided by an embodiment of the present invention.

[0123] like Figure 5 As shown, a device for determining a graphic recognition template may include a second acquisition module 51, a feature determination module 52 and a template determination module 53. Among them:

[0124] The second acquisition module 51 may be used to acquire a second image, wherein the second image includes at least one sample object image.

[0125] The feature determination module 52 may be used to determine the primitive feature information of each of the sample object images.

[0126] The template determination module 53 may be configured to determine a graphic recognition template based on the sample object image and corresponding graphic element feature information.

[0127] In some embodiments, the feature determination module 52 may include: an explosion processing unit (not shown in the figure), a second primitive classification unit (not shown in the figure) and a second association unit (not shown in the figure), wherein:

[0128] The explosion processing unit (not shown in the figure) can be used to perform explosion processing on any of the sample object images through a preset object image explosion model to obtain all the graphic elements of the sample object image.

[0129] The second primitive classification unit (not shown in the figure) can be used to classify all the primitives to obtain the primitives included in each primitive type and the total number of primitives.

[0130] The second associating unit (not shown in the figure) can be used to associate the primitive type corresponding to the sample object graph, the primitives in the primitive type and the total number of primitives to obtain the sample object graph.

[0131] Primitive feature information of the object graph. Furthermore, the second associating unit may be used to associate the primitive type corresponding to the sample object graph, the target primitive in the primitive type, and the total number of primitives to obtain the primitive feature information of the sample object graph.

[0132] Alternatively, the feature determination module 52 may further include: a second coordinate processing unit (not shown in the figure) and an adding unit (not shown in the figure).

[0133] The second coordinate processing unit (not shown in the figure) can be used to determine the relevant coordinate points of each primitive in any primitive type to obtain a coordinate point set.

[0134] An adding unit (not shown in the figure) can be used to add the coordinate point set to the primitive feature information.

[0135] In some other embodiments, the apparatus for determining a graphic recognition template in the embodiment of the present invention may further include a target graphic element determination module (not shown in the figure) and a deletion module (not shown in the figure).

[0136] The target primitive determination module (not shown in the figure) can be used to determine any primitive contained in any primitive type as the target primitive after classifying all the primitives to obtain the primitives contained in each primitive type and the total number of primitives.

[0137] The deletion module (not shown in the figure) can be used to delete other primitives in the preset primitive type except the target primitive.

[0138] In some other embodiments, the template determination module 53 may include a minimum enclosing circle determination unit (not shown in the figure) and a fourth association unit (not shown in the figure).

[0139] The minimum enclosing circle determination unit (not shown in the figure) can be used to process the coordinate point set of any sample object image through the minimum enclosing circle algorithm to obtain the minimum enclosing circle containing the coordinate point set of the sample object image.

[0140] The fourth association unit (not shown in the figure) can be used to associate the primitive type corresponding to the sample object image, the primitives in the primitive type, the total number of primitives and the minimum enclosing circle with the sample object image to obtain a graphic recognition template for the sample object image.

[0141] Through the device for determining the graphic recognition template provided by the embodiment of the present invention, irregular graphics (related graphics that do not meet the drawing specifications, do not meet the design layout, do not meet the design requirements, etc.) in the drawings designed by the designer can be automatically identified to improve the design efficiency; in addition, through the minimum enclosing circle algorithm, the automatic recognition process can be avoided from being affected by the direction, position, etc. of the object to be identified, thereby improving the accuracy of automatic recognition.

[0142] Figure 6 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention, Figure 6 The electronic device 600 shown includes: at least one processor 601, a memory 602, at least one network interface 604 and other user interfaces 603. The various components in the electronic device 600 are coupled together via a bus system 605. It is understood that the bus system 605 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 605 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 605 is not shown in FIG. Figure 6 Various buses are labeled as bus system 605 .

[0143] The user interface 603 may include a display, a keyboard, or a pointing device (eg, a mouse, a trackball, a touch pad, or a touch screen).

[0144] It can be understood that the memory 602 in the embodiment of the present invention can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM) and direct memory bus random access memory (DRRAM). The memory 602 described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0145] In some implementations, the memory 602 stores the following elements, executable units or data structures, or a subset thereof, or an extended set thereof: an operating system 6021 and an application 6022 .

[0146] The operating system 6021 includes various system programs, such as a framework layer, a core library layer, a driver layer, etc., which are used to implement various basic services and process hardware-based tasks. The application 6022 includes various application programs, such as a media player (MediaPlayer), a browser (Browser), etc., which are used to implement various application services. The program for implementing the method of the embodiment of the present invention can be included in the application 6022.

[0147] In the embodiment of the present invention, by calling the program or instruction stored in the memory 602, specifically, the program or instruction stored in the application 6022, the processor 601 is used to execute the following Figure 2 and Figure 3 The method steps provided by each method embodiment are shown.

[0148] The method disclosed in the above embodiment of the present invention can be applied to the processor 601, or implemented by the processor 601. The processor 601 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit in the processor 601 or the instruction in the form of software. The above processor 601 can be a general processor, a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiment of the present invention can be directly embodied as a hardware decoding processor to execute, or the hardware and software units in the decoding processor can be executed. The software unit can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 602, and the processor 601 reads the information in the memory 602 and completes the steps of the above method in combination with its hardware.

[0149] It is understood that the embodiments described herein can be implemented by hardware, software, firmware, middleware, microcode or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPDevice, DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), general processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described in the present application or a combination thereof.

[0150] For software implementation, the technology described herein can be implemented by a unit that performs the functions described herein. The software code can be stored in a memory and executed by a processor. The memory can be implemented in the processor or outside the processor.

[0151] The electronic device provided in this embodiment may be Figure 6 The electronic device shown in FIG. 1 may perform the following steps: Figure 2-3 All steps of the method embodiment shown in Figure 2-3 For details on the technical effects of the method embodiments shown in Figure 2-3 For the sake of brevity, the relevant description is not repeated here.

[0152] The embodiment of the present invention also provides a storage medium (computer-readable storage medium). The storage medium here stores one or more programs. The storage medium may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a read-only memory, a flash memory, a hard disk or a solid-state drive; the memory may also include a combination of the above-mentioned types of memory.

[0153] When one or more programs in the storage medium can be executed by one or more processors to implement the above-mentioned execution on the electronic device side, Figure 2 and Figure 3 Related methods of the method embodiment shown.

[0154] The processor is used to execute the stored in the memory. Figure 2 and Figure 3 The related procedures of the method embodiment shown in the figure are used to implement the following steps performed on the electronic device side: Figure 2 and Figure 3 The relevant steps of the method embodiment are shown.

[0155] The professionals should further realize that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to the function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0156] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0157] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.< / int>

Claims

1. A pattern recognition method, characterized in that: include: Acquire a first image to be subjected to graphic recognition, wherein the first image includes at least one object to be recognized; Extracting feature information of graphic elements included in any object to be identified in the first image; According to the graphic feature information of each of the objects to be identified in the first image and a preset graphic recognition template, performing graphic recognition classification on all the objects to be identified in the first image to obtain regular graphics and irregular graphics; The primitive feature information includes a primitive type and the number of primitives contained in the primitive type, and the method of performing graphic recognition classification on all objects to be recognized in the first image according to the primitive feature information of each object to be recognized in the first image and a preset graphic recognition template to obtain regular graphics and irregular graphics includes: Compare the primitive type of each object to be identified in the first image and the number of primitives contained in the primitive type with the primitive type and the number of primitives contained in the primitive type pre-stored in a preset graphic recognition template; When it is determined that the primitive type of any object to be identified in the first image and the number of primitives included in the primitive type are the same as the primitive type and the number of primitives included in the primitive type pre-stored in the preset graphic recognition template, determining that the object to be identified is a regular graphic; When it is determined that the primitive type of any object to be identified in the first image and the number of primitives included in the primitive type are different from the primitive type and the number of primitives included in the primitive type pre-stored in the preset graphic recognition template, determining that the object to be identified is an irregular graphic; The method further comprises: Determine relevant coordinate points of each of the graphic element types of the object to be identified to obtain a set of coordinate points; The method further comprises: performing graphic recognition classification on all objects to be recognized in the first image according to the graphic element feature information of each object to be recognized in the first image and a preset graphic recognition template to obtain regular graphics and irregular graphics. For all the objects to be identified that are determined to be irregular shapes, the coordinate point set of each object to be identified that is determined to be an irregular shape is processed by a minimum enclosing circle algorithm to obtain a corresponding first minimum enclosing circle; Determine the similarity between a first minimum enclosing circle corresponding to any object to be identified that is determined to be an irregular shape and a second minimum enclosing circle in a preset shape recognition template; When it is determined that the similarity is greater than or equal to the preset similarity, the object to be identified that is determined to be an irregular shape is determined to be a regular shape.

2. The method according to claim 1, characterized in that: extracting the first image The primitive feature information of any object to be identified includes: Extract all the graphic elements of any object to be identified according to the preset graphic element template; Classify all the extracted graphics elements according to the preset graphics element types; Count the number of primitives contained in each preset primitive type; All the primitive types and the number of primitives in each primitive type are associated to determine the primitive feature information.

3. A method for determining a graphic recognition template, characterized in that: include: Acquire a second image, wherein the second image includes at least one sample object image; Determining primitive feature information of each of the sample object images; Determining a graphic recognition template based on the sample object image and corresponding graphic element feature information; Wherein, determining the primitive feature information of each sample object graph includes: By using the preset object graph explosion model to explode any of the sample object graphs, we can obtain All graphics primitives of the sample object graph; Classifying all the primitives to obtain the primitives contained in each primitive type, and The total number of primitives; The primitive type, primitives in the primitive type, and the total number of primitives corresponding to the sample object graph to obtain the primitive feature information of the sample object graph; For a graphic element in any graphic element type, determine the relevant coordinate points of each graphic element to obtain a set of coordinate points; Adding the coordinate point set to the primitive feature information; The step of determining a graphic recognition template based on the sample object image and corresponding graphic element feature information includes: For any sample object graph, the coordinate point set of the sample object graph is processed by a minimum enclosing circle algorithm to obtain a minimum enclosing circle containing the coordinate point set of the sample object graph; The primitive type corresponding to the sample object graph, the primitives in the primitive type, the total number of primitives and the minimum enclosing circle are associated with the sample object graph to obtain a graphic recognition template of the sample object graph.

4. The method according to claim 3, characterized in that The method further comprises: After classifying all the primitives to obtain the primitives included in each primitive type and the total number of primitives, determining any primitive included in any primitive type as a target primitive; Delete all primitives except the target primitive in the preset primitive type.

5. The method according to claim 4, characterized in that The step of associating the primitive type, primitives in the primitive type, and the total number of primitives corresponding to the sample object graph to obtain primitive feature information of the sample object graph includes: The primitive type corresponding to the sample object graph, the target primitive in the primitive type, and the primitive The total number is associated to obtain the primitive feature information of the sample object graph.

6. A device for pattern recognition, characterized in that: include: A first acquisition module, used to acquire a first image to be subjected to graphic recognition, wherein the first image includes at least one object to be recognized; A feature extraction module, used to extract feature information of graphic elements included in any object to be identified in the first image; A graphic recognition module, configured to perform graphic recognition classification on all objects to be recognized in the first image according to the graphic element feature information of each object to be recognized in the first image and a preset graphic recognition template, so as to obtain regular graphics and irregular graphics; Wherein, in the case where the primitive feature information includes a primitive type and the number of primitives included in the primitive type, the graphic recognition module includes: A comparison unit, configured to compare the primitive type of each object to be identified in the first image and the number of primitives contained in the primitive type with the primitive type and the number of primitives contained in the primitive type pre-stored in a preset graphic recognition template; a first determination unit, configured to determine that the object to be identified is a regular graphic when it is determined that the primitive type of any object to be identified in the first image and the number of primitives contained in the primitive type are the same as the primitive type and the number of primitives contained in the primitive type pre-stored in the preset graphic recognition template, and to determine that the object to be identified is an irregular graphic when it is determined that the primitive type of any object to be identified in the first image and the number of primitives contained in the primitive type are different from the primitive type and the number of primitives contained in the primitive type pre-stored in the preset graphic recognition template; The graphic recognition device further comprises a coordinate set determination module, which is used to determine the relevant coordinate points of each of the graphic element types of the object to be recognized, so as to obtain a coordinate point set; The graphic recognition module includes: a first coordinate processing unit, a similarity determination unit, and a second determination unit; The first coordinate processing unit is used to process the coordinate point set of each object to be identified as an irregular shape by a minimum enclosing circle algorithm to obtain a corresponding first minimum enclosing circle; A similarity determination unit, used to determine the similarity between a first minimum enclosing circle corresponding to any object to be identified that is determined to be an irregular shape and a second minimum enclosing circle in a preset shape recognition template; The second determining unit is configured to determine that the object to be identified as an irregular shape is a regular shape when it is determined that the similarity is greater than or equal to a preset similarity.

7. A device for determining a graphic recognition template, characterized in that: include: A second acquisition module, used to acquire a second image, wherein the second image includes at least one sample object image; A feature determination module, used to determine the primitive feature information of each sample object image; A template determination module, used to determine a graphic recognition template based on the sample object image and corresponding graphic element feature information; The feature determination module includes: an explosion processing unit, a second graphic element classification unit and a second association unit; An explosion processing unit, used to perform explosion processing on any of the sample object graphs by using a preset object graph explosion model to obtain all the graphic elements of the sample object graph; A second primitive classification unit, used for classifying all the primitives to obtain the primitives included in each primitive type and the total number of primitives; A second associating unit, configured to associate the primitive type, the primitives in the primitive type, and the total number of primitives corresponding to the sample object graph, so as to obtain primitive feature information of the sample object graph; The feature determination module further includes: a second coordinate processing unit and an adding unit; A second coordinate processing unit, for determining, for each primitive in any primitive type, a relevant coordinate point of each primitive, so as to obtain a coordinate point set; An adding unit, used for adding the coordinate point set to the primitive feature information; The template determination module includes a minimum enclosing circle determination unit and a fourth association unit; A minimum enclosing circle determining unit, configured to process the coordinate point set of any sample object graph by a minimum enclosing circle algorithm to obtain a minimum enclosing circle containing the coordinate point set of the sample object graph; The fourth associating unit is used to associate the primitive type corresponding to the sample object image, the primitives in the primitive type, the total number of primitives and the minimum enclosing circle with the sample object image to obtain a graphic recognition template of the sample object image.

8. An electronic device, characterized in that: include: A processor and a memory, wherein the processor is used to execute a graphic recognition program stored in the memory to implement the graphic recognition method described in any one of claims 1 to 2 or the method for determining a graphic recognition template described in any one of claims 3 to 5.

9. A storage medium, characterized in that: The storage medium stores one or more programs, and the one or more programs are executed by one or more processors to implement the graphic recognition method described in any one of claims 1 to 2 or the method for determining a graphic recognition template described in any one of claims 3 to 5.