A method and system for intelligent drawing of picture frames based on computer vision and pixel clustering

Through computer vision and pixel clustering technology, the automatic identification and addition of sub-region graph frames in CAD files are solved, and the problem of manual addition of graph frames is realized, efficient intelligent drawing of graph frames is achieved, and construction efficiency is significantly improved.

CN119004643BActive Publication Date: 2025-01-03SHANGHAI CONSTRUCTION FOURTH CONSTRUCTION GROUP CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411495521.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-25
Publication Date
2025-01-03
Estimated Expiration
2044-10-25

AI Technical Summary

Technical Problem

During the construction of building structures, the scale sizes of multiple sub-area drawings in the CAD file are inconsistent, which makes manually adding frames time-consuming and labor-intensive and inefficient.

Method used

Using a method based on computer vision and pixel clustering, the drawing boundary range is identified through computer vision models, and the size and position of the drawing frame are automatically determined in combination with the clustering algorithm, and the drawing frame is automatically added using the CAD secondary development tool.

Benefits of technology

Automatic identification and addition of graph frames is realized, which avoids tedious manual operations, significantly improves efficiency, saves time and effort, and can intelligently identify the boundary range of each sub-region in the CAD file and automatically determines the size and position of the graph frame.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119004643B_ABST
    Figure CN119004643B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and system for intelligent drawing of a drawing frame based on computer vision and pixel clustering, the method includes drawing information acquisition, obtaining CAD files and converting them into picture format drawings; computer vision partitioning, using computer vision models to identify each sub-region in the picture format drawings; pixel clustering partitioning, using clustering methods for each sub-region in the picture format drawings; partition result integration, comparing the results of two partitions, and determining the boundary range of a certain sub-region as the correct sub-region when the two partition recognition results are the same; otherwise, highlighting the boundary range of the sub-region as a pending option waiting for manual processing; frame position determination and drawing, according to the determined sub-region, the enlarged or reduced standard frame is automatically added to the boundary periphery of each sub-region in the CAD file using a CAD secondary development tool. The present invention has the advantages of saving time and labor and high efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of drawing drawing, and in particular to a method and system for intelligent drawing of a drawing frame based on computer vision and pixel clustering. Background Art

[0002] In the process management of building structure construction, when there are multiple sub-area drawings in a CAD file and the scales of each sub-area drawing are inconsistent, adding a frame to each drawing becomes a time-consuming and laborious process. The user needs to manually draw a frame of standard size, and then adjust the size information of the frame through repeated operations such as translation and scaling, and repeatedly add frames to multiple sub-area drawings in a CAD file. Summary of the invention

[0003] The purpose of the present invention is to provide a method and system for intelligent drawing of frames based on computer vision and pixel clustering, so as to solve the problem that it is time-consuming, labor-intensive and inefficient to manually add frames to multiple sub-area drawings in a CAD file.

[0004] In order to solve the above technical problems, the present invention provides a frame intelligent drawing method based on computer vision and pixel clustering, comprising:

[0005] Step 100, obtaining drawing information, after obtaining the metafile in the CAD file, converting it into a picture format drawing;

[0006] Step 200, computer vision partitioning, using a computer vision model to identify the boundary range of each sub-region in the picture format drawing; pixel clustering partitioning, using a clustering method to cluster the pixel points in the picture format drawing to obtain the boundary range of each sub-region;

[0007] Step 300, integrating the partitioning results, comparing the results of computer vision partitioning and pixel clustering partitioning, and determining the boundary range of a sub-region as the correct sub-region when the two partitioning recognition results are the same; otherwise, highlighting the boundary range of the sub-region as a pending option waiting for manual processing;

[0008] Step 400, determining and drawing the frame position, based on the determined sub-regions, automatically adding the enlarged or reduced standard frame to the periphery of the boundaries of each sub-region in the CAD file using a CAD secondary development tool.

[0009] Furthermore, in the frame intelligent drawing method based on computer vision and pixel clustering provided by the present invention, in step 200, the computer vision partitioning method includes:

[0010] Step 210, creating a picture format drawing data set, and manually marking a label of each sub-area in the picture format drawing;

[0011] Step 220, establish a computer vision network model, change the parameters of the computer vision network model according to the sub-regions and the labels on them in the picture format drawing data set to perform migration training to obtain the final model, input the picture format drawing containing the sub-regions into the final model, and output the boundary range of each sub-region corresponding to the picture format drawing.

[0012] Furthermore, in the frame intelligent drawing method based on computer vision and pixel clustering provided by the present invention, in step 200, the pixel clustering partitioning method includes:

[0013] Step 230, for the picture format drawing, select all non-white pixel points in the picture format drawing, obtain their pixel coordinates (x, y), and traverse the picture format drawing to obtain the coordinates of all pixel points;

[0014] Step 240: classify all pixel coordinates according to a clustering algorithm to identify the boundary range of each sub-area in the picture format drawing.

[0015] Furthermore, in the intelligent drawing method of a picture frame based on computer vision and pixel clustering provided by the present invention, in step 400, the method of determining and drawing the picture frame position includes:

[0016] Step 410, comparing the vertical length and horizontal length of the boundary range of each sub-region; when the horizontal length is greater than the vertical length, determining that the frame of the sub-region is a horizontal frame, otherwise determining that the frame of the sub-region is a vertical frame;

[0017] Step 420: linearly enlarge or reduce the standard frame so that the range of the standard frame covers the boundary range of each sub-region. The multiple of linear enlargement of the standard frame is calculated according to formula (1):

[0018] k = max(x 1 / x 0 ,y 1 / y 0 ) (1);

[0019] in, k is the linear magnification of the standard frame, x 1 , y 1 are the horizontal and vertical lengths of the identified sub-regions, respectively. x0 , y 0 They are the horizontal and vertical lengths of the blank area in the standard frame respectively;

[0020] Step 430: automatically add the enlarged or reduced standard drawing frame to each sub-area in the CAD file using a CAD secondary development tool.

[0021] In order to solve the above technical problems, the present invention also provides a frame intelligent drawing system based on computer vision and pixel clustering, comprising:

[0022] The drawing information acquisition module is used to obtain the graphic element file in the CAD file and convert it into a picture format drawing;

[0023] The computer vision partitioning module uses a computer vision model to identify the boundary range of each sub-area in the picture format drawing;

[0024] The pixel clustering partitioning module uses a clustering method to cluster the pixel points in the picture format drawing to obtain the boundary range of each sub-area;

[0025] The partition result integration module compares the results of the computer vision partition module and the pixel clustering partition module. If the boundary range of a sub-region is the same as the two partition recognition results, it is determined to be the correct sub-region; otherwise, the boundary range of the sub-region is highlighted as a pending option waiting for manual processing;

[0026] The frame position determination and drawing module automatically adds the enlarged or reduced standard frame to the periphery of the boundaries of each sub-area in the CAD file using the CAD secondary development tool according to the determined sub-area.

[0027] Compared with the prior art, the present invention has the following beneficial effects:

[0028] The intelligent drawing method and system of the frame based on computer vision and pixel clustering provided by the embodiment of the present invention can intelligently identify the boundary range of each sub-region in the CAD file, automatically determine the size and position of the frame without manual identification and viewing, avoid tedious manual operations, automatically calculate the size of each sub-region, and automatically determine the size and position of the frame based on the size of the region and the coordinates of the control points, and draw it in the CAD file. Figure 2 Each sub-area of ​​the CAD file is automatically added with a frame to form Figure 3 Compared with the method where users need to manually copy a standard-sized frame, and then adjust the frame size information through operations such as translation and scaling, and repeatedly manually add frames to multiple sub-areas in a CAD file, this method has the advantages of saving time and effort and high efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] Figure 1 It is a flow chart of a method for intelligent drawing of frames based on computer vision and pixel clustering;

[0030] Figure 2 This is the effect diagram of each sub-area of ​​the CAD file before adding the drawing frame;

[0031] Figure 3 It is the effect diagram after adding frames to each sub-area of ​​the CAD file;

[0032] Figure 4 This is the internal structure diagram of the frame intelligent drawing system based on computer vision and pixel clustering. DETAILED DESCRIPTION

[0033] The present invention is described in detail below in conjunction with the accompanying drawings: The advantages and features of the present invention will become more apparent from the following description. It should be noted that the accompanying drawings are in very simplified form and in non-precise proportions, and are only used to conveniently and clearly assist in explaining the purpose of the embodiments of the present invention.

[0034] Please refer to Figure 1 The embodiment of the present invention provides a method for intelligently drawing a frame based on computer vision and pixel clustering, comprising:

[0035] Step 100, obtaining drawing information, after obtaining the metafile in the CAD file, converting it into a picture format drawing. The CAD file can also be directly converted into a picture format drawing. The picture format drawings include but are not limited to JPEG and PNG formats.

[0036] Step 200, computer vision partitioning and pixel clustering partitioning, that is, partitioning is performed in two ways.

[0037] Computer vision partitioning is to use computer vision models to identify the boundary range of each sub-area in the picture format drawing. Specifically, it can include:

[0038] Step 210 , creating a picture format drawing data set, manually marking a label of each sub-region in the picture format drawing, wherein the data set is a number of picture format drawings containing multiple sub-regions, and the content of the label can be the boundary outline of each sub-region.

[0039] Step 220, establish a computer vision network model, change the parameters of the computer vision network model according to each sub-region in the picture format drawing data set and the labels thereon, perform migration training to obtain the final model, input the picture format drawing containing the sub-region into the final model, and output the boundary range of each sub-region corresponding to the picture format drawing. You can use a deep learning network model such as a convolutional neural network, a regional convolutional neural network, a residual network, YOLO, or a pre-trained computer vision model. The initial model of the computer vision network model can also be used. The training process of the model can use algorithms such as stochastic gradient descent and adaptive gradient algorithm to train the model until the loss function is less than a preset value, end the training, and form the final model.

[0040] Pixel clustering partitioning is to cluster the pixels in the picture format drawing using a clustering method to obtain the boundary range of each sub-area. Specifically, it may include:

[0041] Step 230, for the picture format drawing, select all non-white pixel points in the picture format drawing, obtain their pixel coordinates (x, y), and traverse the picture format drawing to obtain the coordinates of all pixel points.

[0042] Step 240, classify all pixel coordinates according to the clustering algorithm to identify the boundary range of each sub-region in the picture format drawing. The clustering algorithm may use a clustering algorithm including but not limited to the DBSCAN algorithm (density clustering algorithm) or the K-means clustering algorithm to classify these pixels. When the number of sub-regions in the picture format drawing is known, the K-means algorithm may be used. When the number of sub-regions in the picture format drawing is unknown, the DBSCAN algorithm may be used to calculate the maximum length L of the drawing, and the length of L / 50 is selected as the maximum neighborhood distance parameter of the clustering method according to experience.

[0043] Step 300, the partitioning results are integrated, and the results of computer vision partitioning and pixel clustering partitioning are compared. When the boundary range of a sub-region is the same as the two partitioning recognition results, it is determined to be the correct sub-region; otherwise, the boundary range of the sub-region is highlighted as a pending option waiting for manual processing.

[0044] Step 400, determining and drawing the frame position, according to the determined sub-area, automatically adding the enlarged or reduced standard frame to the periphery of the boundary of each sub-area in the CAD file using the CAD secondary development tool. Specifically, it may include:

[0045] Step 410 , compare the vertical length and horizontal length of each sub-region boundary range; when the horizontal length is greater than the vertical length, determine that the frame of the sub-region is a horizontal frame, otherwise determine that the frame of the sub-region is a vertical frame.

[0046] Step 420: linearly enlarge or reduce the standard frame so that the range of the standard frame covers the boundary range of each sub-region. The multiple of linear enlargement of the standard frame is calculated according to formula (1):

[0047] k = max(x 1 / x 0 ,y 1 / y 0 ) (1);

[0048] in, k is the linear magnification of the standard frame, x 1 , y 1 are the horizontal and vertical lengths of the identified sub-regions, respectively. x 0 , y 0 They are the horizontal and vertical lengths of the blank area in the standard frame respectively.

[0049] Step 430: automatically add the enlarged or reduced standard drawing frame to each sub-area in the CAD file using a CAD secondary development tool.

[0050] Please refer to Figure 4 The embodiment of the present invention further provides a frame intelligent drawing system based on computer vision and pixel clustering, which adopts the above method and includes:

[0051] The drawing information acquisition module 501 acquires the graphic element file in the CAD file and converts it into a drawing in picture format.

[0052] The computer vision partitioning module 502 uses a computer vision model to identify the boundary range of each sub-area in the picture format drawing.

[0053] The pixel clustering and partitioning module 503 clusters the pixel points in the picture format drawing using a clustering method to obtain the boundary range of each sub-region.

[0054] The partition result integration module 504 compares the results of the computer vision partition module 502 and the pixel clustering partition module 503. When the boundary range of a sub-region is the same as the two partition recognition results, it is determined to be the correct sub-region; otherwise, the boundary range of the sub-region is highlighted as a pending option waiting for manual processing.

[0055] The frame position determination and drawing module 505 automatically adds the enlarged or reduced standard frame to the periphery of the boundary of each sub-region in the CAD file by using the CAD secondary development tool according to the determined sub-region.

[0056] The intelligent drawing method and system of the frame based on computer vision and pixel clustering provided by the embodiment of the present invention can intelligently identify the boundary range of each sub-region in the CAD file, automatically determine the size and position of the frame without manual identification and viewing, avoid tedious manual operations, automatically calculate the size of each sub-region, and automatically determine the size and position of the frame based on the size of the region and the coordinates of the control points, and draw it in the CAD file. Figure 2 Each sub-area of ​​the CAD file is automatically added with a frame to form Figure 3 Compared with the method where users need to manually copy a standard-sized frame, and then adjust the frame size information through operations such as translation and scaling, and repeatedly manually add frames to multiple sub-areas in a CAD file, this method has the advantages of saving time and effort and high efficiency.

[0057] The present invention is not limited to the above-mentioned specific implementation modes. Obviously, the above-mentioned embodiments are only some embodiments of the embodiments of the present invention, but not all embodiments. Based on the described embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field belong to the scope of protection of the present invention. Those skilled in the art can make other levels of modifications and changes to the present invention. In this way, if these modifications and changes of the present invention fall within the scope of the claims of the present invention, the present invention is also intended to include these changes and changes.

Claims

1. A method for intelligent drawing of a frame based on computer vision and pixel clustering, characterized in that: include: Step 100, obtaining drawing information, obtaining the metafile in the CAD file and converting it into a picture format drawing; Step 200, computer vision partitioning, using a computer vision model to identify the boundary range of each sub-area in the picture format drawing, wherein the computer vision model includes a deep learning network model or a pre-trained computer vision model, and an initial model of the computer vision network model. The model training process uses a stochastic gradient descent or an adaptive gradient algorithm to train the model until the loss function is less than a preset value, and the training is terminated to form a final model; wherein the deep learning network model includes a convolutional neural network, a regional convolutional neural network, a residual network or YOLO; pixel clustering partitioning, using a clustering method to cluster the pixel points in the picture format drawing to obtain the boundary range of each sub-area, wherein the clustering method uses a DBSCAN algorithm or a K-means clustering algorithm; Step 300, integrating the partitioning results, comparing the results of computer vision partitioning and pixel clustering partitioning, and determining the boundary range of a sub-region as the correct sub-region when the two partitioning recognition results are the same; otherwise, highlighting the boundary range of the sub-region as a pending option waiting for manual processing; Step 400, determining and drawing the frame position, based on the determined sub-regions, automatically adding the enlarged or reduced standard frame to the periphery of the boundaries of each sub-region in the CAD file using a CAD secondary development tool.

2. The method for intelligent drawing of a picture frame based on computer vision and pixel clustering according to claim 1, characterized in that: In step 200, the method of computer vision partitioning includes: Step 210, creating a picture format drawing data set, and manually marking a label of each sub-area in the picture format drawing; Step 220, establish a computer vision network model, change the parameters of the computer vision network model according to the sub-regions and the labels on them in the picture format drawing data set to perform migration training to obtain the final model, input the picture format drawing containing the sub-regions into the final model, and output the boundary range of each sub-region corresponding to the picture format drawing.

3. The frame intelligent drawing method based on computer vision and pixel clustering according to claim 1, characterized in that: In step 200, the pixel clustering and partitioning method includes: Step 230, for the picture format drawing, select all non-white pixel points in the picture format drawing, obtain their pixel coordinates (x, y), and traverse the picture format drawing to obtain the coordinates of all pixel points; Step 240: classify all pixel coordinates according to a clustering algorithm to identify the boundary range of each sub-area in the picture format drawing.

4. The method for intelligent drawing of a picture frame based on computer vision and pixel clustering according to claim 1, characterized in that: In step 400, the method for determining and drawing the frame position includes: Step 410, comparing the vertical length and horizontal length of the boundary range of each sub-region; when the horizontal length is greater than the vertical length, determining that the frame of the sub-region is a horizontal frame, otherwise determining that the frame of the sub-region is a vertical frame; Step 420: linearly enlarge or reduce the standard frame so that the range of the standard frame covers the boundary range of each sub-region. The multiple of linear enlargement of the standard frame is calculated according to formula (1): k = max(x1 / x0,y1 / y0) (1); Where k is the multiple of linear magnification of the standard frame, x1 and y1 are the horizontal and vertical lengths of the identified sub-region, and x0 and y0 are the horizontal and vertical lengths of the blank area in the standard frame. Step 430: automatically add the enlarged or reduced standard drawing frame to each sub-area in the CAD file using a CAD secondary development tool.

5. A frame intelligent drawing system based on computer vision and pixel clustering, characterized in that: include: The drawing information acquisition module is used to obtain the graphic element file in the CAD file and convert it into a picture format drawing; The computer vision partitioning module uses a computer vision model to identify the boundary range of each sub-area in the picture format drawing, wherein the computer vision model includes a deep learning network model or a pre-trained computer vision model, and an initial model of the computer vision network model. The training process of the model uses a stochastic gradient descent and an adaptive gradient algorithm to train the model until the loss function is less than a preset value, and the training is terminated to form a final model; wherein the deep learning network model includes a convolutional neural network, a regional convolutional neural network, a residual network or YOLO; The pixel clustering partitioning module uses a clustering method to cluster the pixel points in the picture format drawing to obtain the boundary range of each sub-area, where the clustering method uses the DBSCAN algorithm or the K-means clustering algorithm; The partition result integration module compares the results of the computer vision partition module and the pixel clustering partition module. If the boundary range of a sub-region is the same as the two partition recognition results, it is determined to be the correct sub-region; otherwise, the boundary range of the sub-region is highlighted as a pending option waiting for manual processing; The frame position determination and drawing module automatically adds the enlarged or reduced standard frame to the periphery of the boundaries of each sub-area in the CAD file using the CAD secondary development tool according to the determined sub-area.