A ground power station digital twin modeling marking method, system, device and medium

Text recognition and image processing technology is used to extract string information, identify string outline coordinates, and generate marking files. This solves the problem of low string marking efficiency in digital twin modeling of large ground power stations and achieves efficient automatic marking of strings.

CN118397634BActive Publication Date: 2024-09-03ZHEJIANG ZHENGTAI NEW ENERGY DEV CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410845641.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-27
Publication Date
2024-09-03
Estimated Expiration
2044-06-27

AI Technical Summary

Technical Problem

In the digital twin modeling of large-scale ground power stations, string labeling efficiency is low, and the existing technology lacks effective automated labeling methods, resulting in manual labeling being time-consuming and laborious, and reducing efficiency.

Method used

By obtaining the design drawings and real radiographic images, text recognition and image processing technology are used to extract the number and arrangement information of the string components, identify the string outline coordinates, generate string marking files, and realize automatic marking of the strings.

Benefits of technology

It improves the efficiency and accuracy of string labeling, fills the research gap in automatic labeling of string information, reduces the time and labor of manual labeling, and improves the efficiency of digital twin modeling.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118397634B
    Figure CN118397634B
Patent Text Reader

Abstract

The present invention discloses a ground power station digital twin modeling marking method, system, equipment and medium, which are applied to the field of photovoltaic power stations, including: obtaining the design drawing and true orthogonal image of the target ground power station; using text recognition technology to extract text information in the design drawing to obtain the component quantity information of each string and the component row and column arrangement information of each string; using image processing technology to identify the strings in the true orthogonal image, and based on the component quantity information of each string and the component row and column arrangement information of each string, obtain the contour coordinate set of all strings; according to the contour coordinate set, obtain the string marking file corresponding to the target ground power station. The present invention fills the gap in the research on the automatic marking of string information in the process of digital twin modeling of ground power stations, and also improves the marking efficiency of strings in the process of digital twin modeling of ground power stations.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of photovoltaic power stations, and in particular to a method, system, equipment and medium for digital twin modeling of a ground power station. Background Art

[0002] The digital twin of a photovoltaic power station uses digital technology to build a virtual power station that is highly consistent with a real photovoltaic power station. The digital twin technology is used to model and simulate the photovoltaic power station. By mapping the components, equipment, geographic information, operating data, etc. in the photovoltaic power station with the model, the performance, safety, faults, etc. of the power station are displayed, analyzed, and evaluated in the form of three-dimensional images.

[0003] In the digital twin application of large-scale ground power stations, due to the large number of components in large-scale ground power stations, the string information is usually displayed in the design drawings, and the specific display method is text labels or wiring diagrams. However, since the reference models are mostly connected, if the conventional manual marking method is still used, the workload is huge, time-consuming and labor-intensive, which greatly reduces the marking efficiency. Moreover, there is no research based on the string marking of large-scale ground power stations at this stage.

[0004] Therefore, how to fill the research gap in marking strings in digital twin modeling of ground power stations, and how to efficiently and accurately mark strings in digital twin modeling of ground power stations are technical problems that need to be solved urgently. Summary of the invention

[0005] In view of this, the purpose of the present invention is to provide a marking method, system, equipment and medium for digital twin modeling of ground power stations, which solves the research gap in the prior art on marking of strings in digital twin modeling of ground power stations and the problem of low marking efficiency.

[0006] In order to solve the above technical problems, the present invention provides a ground power station digital twin modeling and marking method, comprising:

[0007] Obtain the design drawings and true orthogonal images of the target ground power station;

[0008] Using text recognition technology to extract text information in the design drawing to obtain component quantity information of each string and component row and column arrangement information of each string;

[0009] Using image processing technology to identify the strings in the true orthogonal image, and obtaining the outline coordinate set of all the strings based on the number of components of each string and the arrangement of the components of each string;

[0010] A string marking file corresponding to the target ground power station is obtained according to the contour coordinate set.

[0011] Optionally, the text information in the design drawing is extracted using a text recognition technology to obtain the number of components of each string and the arrangement of components in rows and columns of each string, including:

[0012] Taking a screenshot of the design drawing to obtain a screenshot of the design drawing;

[0013] Performing text recognition on the screenshot of the design drawing to obtain recognized text;

[0014] Using regular expressions to perform field screening on the recognized text to obtain a target field;

[0015] Digital extraction is performed on the target field to obtain component quantity information of each string and component row and column arrangement information of each string.

[0016] Optionally, the strings in the true orthogonal image are identified using image processing technology, and the outline coordinate sets of all strings are obtained based on the number of components of each string and the arrangement of the components of each string, including:

[0017] Taking a screenshot of the true orthogonal image to obtain a true orthogonal image screenshot;

[0018] Taking a screenshot of any component in the true image screenshot to obtain a component screenshot;

[0019] Obtain the length, width and area of ​​the component according to the component screenshot;

[0020] Calculate the length, width and area of ​​the string according to the number of components of the string, the arrangement of the components of the string, and the length, width and area of ​​the components;

[0021] Performing a color mask recognition operation on the true orthogonal image screenshot using the color that appears most frequently in the component screenshot, and obtaining contours of similar color gamuts in the true orthogonal image screenshot;

[0022] The areas of the similar color gamut contours are calculated respectively, and the similar color gamut contours are divided according to the quantitative relationship between the areas of the similar color gamut contours and the area of ​​the group strings to obtain the contour coordinate set.

[0023] Optionally, the contour coordinate set is obtained by respectively calculating the area of ​​each of the similar color gamut contours and dividing the similar color gamut contours according to the quantitative relationship between the area of ​​the similar color gamut contours and the area of ​​the group string, including:

[0024] Determine whether the area of ​​the similar color gamut contour is equal to an integer multiple of the group string area;

[0025] If they are equal, then the similar color gamut contour is equally divided according to the integer multiple, the length and width of the similar color gamut contour, and the length and width of the group string;

[0026] If not, determining whether the minimum difference between the area of ​​the similar color gamut contour and the integer multiple of the group string area is greater than or equal to the area of ​​one component;

[0027] If the minimum difference is greater than or equal to the area of ​​a component, no processing is performed;

[0028] If the minimum difference is smaller than the area of ​​a component, the similar color gamut contour is equally divided according to the integer multiple corresponding to the minimum difference, the length and width of the similar color gamut contour, and the length and width of the string;

[0029] The coordinates of the similar color gamut contour after being bisected are obtained to obtain the contour coordinate set.

[0030] Optionally, after obtaining the outline coordinate sets of all strings based on the component quantity information of each string and the component row and column arrangement information of each string, the method further includes:

[0031] If it is determined according to the contour coordinate set that there are adjacent contours, the coordinates of the adjacent contours are deviated from each other in the length direction to obtain a deviated contour coordinate set;

[0032] Correspondingly, the string marking file corresponding to the target ground power station is obtained according to the contour coordinate set, including:

[0033] A string marking file corresponding to the target ground power station is obtained according to the offset contour coordinate set.

[0034] Optionally, after obtaining the outline coordinate sets of all strings based on the component quantity information of each string and the component row and column arrangement information of each string, the method further includes:

[0035] When the regular expression is used to perform field screening on the recognized text and the target field is not obtained, and the number of columns is determined to be a non-integer according to the obtained row number supplementary information, the coordinates in the contour coordinate set are corrected to obtain a corrected contour coordinate set;

[0036] Correspondingly, the string marking file corresponding to the target ground power station is obtained according to the contour coordinate set, including:

[0037] A string marking file corresponding to the target ground power station is obtained according to the corrected contour coordinate set.

[0038] Optionally, obtaining a string marking file corresponding to the target ground power station according to the contour coordinate set includes:

[0039] Drawing corresponding contours in batches on the base map of the true orthogonal image according to the contour coordinate set to obtain a marked computer-aided design file;

[0040] The group string marking file for describing and storing geographic information is obtained according to the marked computer-aided design file.

[0041] Optionally, also include:

[0042] The power generation unit area is determined according to the drawing of the power generation unit, the outline of the string in the power generation unit area is framed, and the color display of the outline of the string in the power generation unit area is modified; the power generation unit area is an area composed of several strings.

[0043] Optionally, determining the power generation unit area according to the drawing of the power generation unit, selecting the outline of the string in the power generation unit area, and modifying the color display of the outline of the string in the power generation unit area includes:

[0044] identifying a shape of a power generation unit in a drawing of the power generation unit;

[0045] In the true orthogonal image screenshot, matching and identifying similar shapes according to the shape of the power generation unit, and obtaining a coordinate set of the power generation unit after identification;

[0046] The colors of the strings in the area of ​​the power generation units are modified in batches on the base map of the true orthogonal image according to the coordinate set of the power generation units.

[0047] The present invention also provides a ground power station digital twin modeling and marking system, comprising:

[0048] An acquisition module is used to acquire the design drawing and true orthogonal image of the target ground power station;

[0049] A text extraction module is used to extract text information in the design drawing using text recognition technology to obtain component quantity information of each string and component row and column arrangement information of each string;

[0050] An image processing module, used to identify the strings in the true orthogonal image using image processing technology, and obtain the outline coordinate set of all the strings based on the number of components of each string and the arrangement information of the components of each string;

[0051] The marking module is used to obtain a string marking file corresponding to the target ground power station according to the contour coordinate set.

[0052] The present invention also provides a ground power station digital twin modeling and marking device, comprising:

[0053] Memory for storing computer programs;

[0054] A processor is used to implement the steps of the above-mentioned ground power station digital twin modeling and marking method when executing the computer program.

[0055] The present invention also provides a medium, in which computer executable instructions are stored. When the computer executable instructions are loaded and executed by a processor, the steps of the above-mentioned ground power station digital twin modeling and marking method are implemented.

[0056] It can be seen that the present invention obtains the design drawing and true orthogonal image of the target ground power station; uses text recognition technology to extract text information in the design drawing to obtain the component quantity information of each string and the component row and column arrangement information of each string; uses image processing technology to identify the strings in the true orthogonal image, and obtains the contour coordinate set of all strings based on the component quantity information of each string and the component row and column arrangement information of each string; obtains the string marking file corresponding to the target ground power station according to the contour coordinate set. The present invention fills the gap in the research on the automatic marking of string information in the process of digital twin modeling of ground power stations, and also improves the marking efficiency of strings in the process of digital twin modeling of ground power stations.

[0057] In addition, the present invention also provides a ground power station digital twin modeling marking system, equipment and medium, which also have the above-mentioned beneficial effects. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0059] Figure 1 A flowchart of a ground power station digital twin modeling and marking method provided by an embodiment of the present invention;

[0060] Figure 2 An example of a partial diagram of a design diagram of a ground power station provided by an embodiment of the present invention - specifically, a component wiring diagram portion;

[0061] Figure 3 Another example of a partial diagram of a design diagram of a ground power station provided by an embodiment of the present invention - specifically, a wiring diagram of a power generation unit system;

[0062] Figure 4 A true orthographic image of a ground power station provided by an embodiment of the present invention;

[0063] Figure 5A partially enlarged example diagram of a true orthographic image of a ground power station provided by an embodiment of the present invention;

[0064] Figure 6 A schematic diagram of an enlarged screenshot example of a component provided in an embodiment of the present invention;

[0065] Figure 7 An example diagram of an image mask recognition result provided by an embodiment of the present invention;

[0066] Figure 8 An example diagram of a morphological closing operation result provided by an embodiment of the present invention;

[0067] Fig. 9 An example diagram of a contour result of a similar color gamut provided by an embodiment of the present invention;

[0068] Fig.10 A schematic diagram of contour division provided by an embodiment of the present invention;

[0069] Fig.11 A schematic diagram of entity filling provided by an embodiment of the present invention;

[0070] Fig.12 A schematic diagram of mutual deviation of contours provided in an embodiment of the present invention;

[0071] Fig.13 An example diagram of string correction for a ground power station provided by an embodiment of the present invention;

[0072] Fig.14 An example of a power generation unit drawing provided by an embodiment of the present invention;

[0073] Fig.15 A schematic diagram of a power generation unit marking provided by an embodiment of the present invention;

[0074] Fig.16 A schematic diagram of the structure of a ground power station digital twin modeling and marking device provided by an embodiment of the present invention;

[0075] Fig.17 A schematic diagram of the structure of a ground power station digital twin modeling and marking device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0076] 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 only 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.

[0077] Please refer to Figure 1 , Figure 1 A flowchart of a ground power station digital twin modeling and labeling method provided by an embodiment of the present invention. The method may include:

[0078] S101: Obtain a design drawing and a true orthogonal image of a target ground power station.

[0079] In the digital twin application of large-scale ground power stations, due to the large number of components in large-scale ground power stations, string information is usually displayed, and the string information is usually textually labeled or simply illustrated in the design drawing, such as Figure 2 and Figure 3 As shown, Figure 2 An example of a partial diagram of a design diagram of a ground power station provided by an embodiment of the present invention - specifically, a component wiring diagram portion; Figure 3 Another example of a partial design drawing of a ground power station provided in an embodiment of the present invention is specifically a wiring diagram of a power generation unit system. This embodiment does not limit the format of the design drawing. For example, it can be a CAD (Computer Aided Design) format file, a PDF (Portable Document Format) file, a picture file, etc.

[0080] The true orthogonal image in this embodiment can be obtained by the drone system, such as Figure 4 and Figure 5 As shown. After the UAV system’s flight path planning, flight image collection, and image synthesis, a true orthogonal image of the target ground power station area is output, and a ".tiff file" format file with geographic information is output. Specifically, this embodiment can use a DJI drone to plan the path of the target ground power station area according to the path requirements of the DJI drone software (DJI Terra) to generate a true orthogonal image. The drone flies according to the path planning and collects and transmits image data during flight. Finally, through the image processing software and technology of the DJI drone, the drone system can output a true orthogonal image of the target ground power station and output a ".tiff file" format file with geographic information.

[0081] It should be noted that the present embodiment can be implemented in CAD software, and the programming language used is Python (a high-level programming language). Therefore, the true orthogonal image of the ".tiff file" can be converted into a ".dxf" format file through the Aowei interactive map browser for CAD editing. Among them, the format conversion step can be performed manually, or it can be implemented by calling the software through the software path through the python design call. The ".dxf" format file is a vector graphics file, an open source CAD data file format, which captures all elements of the CAD graphics, such as text, lines, and shapes, and details how to represent these different graphic elements. In addition, the ".dxf" format file is a graphic exchange file used to transfer data between CAD applications, so that the 2D and 3D graphic data of AutoCAD (a computer-aided design software) can be used with other programs.

[0082] S102: extracting text information in the design drawing using text recognition technology to obtain component quantity information of each string and component row and column arrangement information of each string.

[0083] This embodiment uses text recognition technology to extract the number of components in the string and the arrangement of the components in the string in the design drawing. This embodiment does not limit the specific extraction method of the text recognition technology. For example, the digital information in the design drawing can be directly extracted, and then the context information can be used to determine whether each number belongs to the number of components or the arrangement of the components in the string; or text extraction can be performed first, and then regular expressions can be used to determine the number of components in the string and the arrangement of the components in the string.

[0084] Furthermore, in order to improve the accuracy of recognition, the text information in the design drawing is extracted by using the text recognition technology to obtain the component quantity information of each string and the component row and column arrangement information of each string, which may specifically include:

[0085] Step 21: Take a screenshot of the design drawing to obtain a screenshot of the design drawing.

[0086] It is understandable that before executing step 21, the design drawing is opened using the default program of the design drawing through Python (computer programming language) to prompt the adjustment information. The specific implementation code example is as follows:

[0087] #Calling the library

[0088] import os #os module is used to interact with the operating system

[0089] import tkinter as tk #tkinter module graphical user interface library for creating desktop applications

[0090] from tkinter import messagebox #messagebox module is used for dialog box prompts

[0091] import time #The time module is used to use time-related functions

[0092] def open_file_and_show_message(file_path, message):

[0093] # Try opening the file with the default program

[0094] os.startfile(file_path)

[0095] # Wait for a while to make sure the file is open (delay as a simple example)

[0096] time.sleep(30) # wait 30 seconds

[0097] # Create a Tkinter window to display the message box

[0098] root = tk.Tk()

[0099] root.withdraw() # Hide the main window

[0100] messagebox.showinfo("prompt", message) # Display the message box

[0101] root.destroy() # Destroy the Tkinter window

[0102] # The path to the design file to open and the message to display

[0103] file_path = 'Design drawing'

[0104] message = 'Please adjust the display to full screen and adjust the display ratio (default 100%, can be adjusted according to actual situation)'

[0105] # Calling the function

[0106] open_file_and_show_message(file_path, message)

[0107] In the implementation code example of opening the design drawing by default, a function open_file_and_show_message() is defined, which receives the file path and the message to be displayed as parameters. The function includes: using os.startfile() to open the file, then using time.sleep() to wait for a period of time (here set to 30 seconds, which can be adjusted according to actual conditions), and then creating a Tkinter (Tkinter is the default GUI (graphical user interface) library of Python) window and displaying a prompt operation message box.

[0108] This embodiment takes into account that there is no restriction on the format of the design drawing obtained, so the direct screenshot method can be used to perform unified format conversion, which is convenient and fast, and also eliminates the need for complex format conversion. The design drawing is screenshoted through Python to obtain a screenshot of the design drawing. The specific implementation code example is as follows:

[0109] #Calling the library

[0110] import pyautogui #pyautogui library is used to simulate mouse and keyboard operations

[0111] # Take a screenshot of the entire screen

[0112] screenshot = pyautogui.screenshot()

[0113] # Save the screenshot to a file

[0114] screenshot.save('Design screenshot.png')

[0115] Step 22: Perform text recognition on the design screenshot to obtain recognized text.

[0116] In this embodiment, Python can be used to implement text recognition (also known as optical character recognition, Optical Character Recognition, referred to as OCR), among which Tesseract-OCR, EasyOCR, etc. are commonly used. Tesseract-OCR and EasyOCR are two mainstream open source optical character recognition (OCR) frameworks on the market. Taking Tesseract-OCR as an example, Python and pytesseract (OCR library, which can recognize text in pictures) library are used to recognize text from the design screenshot. The specific implementation code example is as follows:

[0117] #Calling the library

[0118] import pytesseract # The pytesserac library is a Python wrapper for the Tesseract OCR engine and is used to recognize text in images

[0119] from PIL import Image

[0120] # Open the image file

[0121] img = Image.open('Design screenshot.png')

[0122] # Use pytesseract for OCR processing

[0123] text = pytesseract.image_to_string(img, lang='ch_sim ') # The lang parameter is set to the language you want to recognize, here is Simplified Chinese

[0124] # Output the recognized text

[0125] print(text)

[0126] Furthermore, this embodiment can also perform cleaning processing on the recognized text after extracting the recognized text. The specific implementation code example is as follows:

[0127] # Text cleaning (for example: removing extra spaces to reduce interference calculations)

[0128] cleaned_text = re.sub(r'\s+', ' ', ocr_text).strip()

[0129] Step 23: Use regular expressions to filter the recognized text fields and obtain the target fields.

[0130] Step 24: Perform digital extraction on the target field to obtain the component quantity information of each string and the component row and column arrangement information of each string.

[0131] In order to better understand the field screening and digital extraction, step 23 and step 24 are explained as a whole: This embodiment is based on the common expression of the number of components of the string and the arrangement of the components of the string, and uses Python to compile regular expressions respectively to obtain the regular expression of the number of components of the string and the regular expression of the arrangement of the components of the string, and based on the respective regular expressions, the recognized text is screened for fields to obtain the target field, and the target field is extracted. The specific implementation code example is as follows:

[0132] # Compile the first regular expression to match the pattern of "digit + block + any character + string"

[0133] pattern = r'(\d+)块.*?串'

[0134] # Use the first regular expression to find matches, i.e., field filtering

[0135] matches = re.findall(pattern, ocr_text)

[0136] # If a match is found (i.e., the target field is found), extract the digit and output the component quantity information of the string

[0137] if matches:

[0138] number_of_units = int(matches[0]) # Convert the matched digit to an integer

[0139] print(f"组串的组件数量信息: {number_of_units}块")

[0140] else:

[0141] print("未找到组串的组件数量信息匹配项")

[0142] # Compile the second regular expression to match the pattern of "digit X digit + any character + string + any character + connection"

[0143] pattern = r'(\d+)X(\d+).*?串.*?接线'

[0144] # Use the second regular expression to find matches, i.e., field filtering

[0145] matches = re.findall(pattern, ocr_text)

[0146] # If a match is found (i.e., the target field is found), extract the digits and output the component row and column arrangement information of the string

[0147] if matches:

[0148] first_number, second_number = map(int, matches[0])

[0149] print(f"Component row and column arrangement information of the string: {first_number}X{second_number}")

[0150] else:

[0151] print("No matching item for the component row and column arrangement information of the string was found")

[0152] Output:

[0153] Component quantity information of the string: 22 pieces

[0154] Component row and column arrangement information of the string: 2X11

[0155] The above first regular expression "(\d+) pieces.*? string" is used to match the pattern where one or more digits are followed by the word "pieces", then any number of any characters (using.*? for non-greedy matching), and finally the word "string". This regular expression can be compatible with texts such as "22 pieces of component in a string", "22 pieces of battery components in a string", etc., because.*? will match the part "battery components are" or "component one". Further, the accuracy of the matching can be increased by restricting the number of any characters.

[0156] The above second regular expression "(\d+)X(\d+).*? string.*? connection" is used to match the pattern where "digit X digit" is followed by any characters, the word "string", then any characters and the word "connection". This regular expression can be compatible with formats such as "2X11 component string connection" and "2X11 battery string connection" in the text. The characters between "string" and "connection" can be arbitrary, and there can also be any characters between "string" and "connection". Further, the accuracy of the matching can be increased by restricting the number of any characters.

[0157] S103: Use image processing technology to identify the strings in the true orthophoto image, and obtain the contour coordinate set of all strings based on the component quantity information of each string and the component row and column arrangement information of each string.

[0158] This embodiment uses image processing technology to identify the strings in the true orthogonal image. According to the recognition result and the previously obtained information on the number of components of the string and the arrangement of the components of the string, the outline coordinates of each string can be determined to obtain an outline coordinate set. This embodiment does not limit the specific process of recognition, as long as the strings in the true orthogonal image can be recognized by using image processing technology. The code implementation process is: execute step S103 through Python, OpenCV (OpenCV is a library designed for computer vision, which provides rich image processing functions. Through Python, you can easily call OpenCV functions to perform image analysis, feature detection, image conversion and other operations) library, Pillow (Pillow is an image processing library for Python that supports opening, operating and saving image files in various formats. It provides Python with basic image processing capabilities, such as image cropping, resizing, color conversion, etc.) library and NumPy (NumPy is a numerical computing extension library for Python, which provides support for a large number of dimensional arrays and matrix operations. In addition, it also provides a large number of mathematical function libraries for array operations. In image processing, NumPy is used to efficiently process image data and represent images as arrays to facilitate numerical operations and analysis) library.

[0159] Furthermore, in order to improve the accuracy of string identification, the image processing technology is used to identify the strings in the true image, and the outline coordinate set of all strings is obtained based on the number of components of each string and the arrangement of the components of each string, which may specifically include:

[0160] Step 31: Take a screenshot of the true orthogonal image to obtain a screenshot of the true orthogonal image.

[0161] It is understandable that before executing step 31, Python is used to use CAD to open the ".dxf" format true image of the target ground power station, and the adjustment information is prompted: adjust the display to full screen display, adjust the display ratio (the default is 100%, which can be adjusted according to the actual screen resolution and the size of the ground power station. Further, when the image is large, batch processing can be selected, for example, the local areas of different positions of the target ground power station are enlarged and displayed. After the contour coordinates of the group string in the area are obtained, other local positions are changed and repeated until all areas that need to be marked are covered. Because the opening process and the part that prompts adjustment after opening are the same as the principle of the aforementioned design drawing part, they are omitted here and will not be repeated. The specific implementation code example of the selected CAD part is as follows:

[0162] #Call the library by using the filedialog module of tkinter. In this way, the user can browse the local file system and select the executable file of the CAD software. The subprocess module is used to call the CAD software.

[0163] import os (for operating system interaction)

[0164] import subprocess

[0165] import tkinter as tk

[0166] from tkinter import filedialog, messagebox

[0167] def on_select_cad_software():

[0168] # Allow the user to select the executable file of the CAD software

[0169] file_path = filedialog.askopenfilename(

[0170] title="Choose CAD software",

[0171] filetypes=[("Executable files", "*.exe"), ("All files","*.*")] )

[0173] if file_path:

[0174] # Update the label to show the selected path

[0175] cad_software_label.config(text=file_path)

[0176] # You can add logic here to save the selected path for next use

[0177] The above implementation code adds an on_select_cad_software function, which uses filedialog.askopenfilename to let the user browse and select the executable file of the CAD software. The selected path will be displayed on a label and used to open the specified file when the user clicks the "Open File" button.

[0178] The OpenCV library in Python is mainly used to process bitmap images (i.e. pixel images). Screenshots can conveniently save the complicated format conversion between vector images and bitmap images. Specifically, use the pyautogui library (used to programmatically control the mouse and keyboard) in Python to take a screenshot of the current screen and save the true-image screenshot. The specific implementation code example is as follows:

[0179] #Calling the library

[0180] import pyautogui

[0181] # Take a screenshot of the entire screen

[0182] screenshot = pyautogui.screenshot()

[0183] # Save the screenshot to a file

[0184] screenshot.save('Real photogram screenshot.png')

[0185] Step 32: Take a screenshot of any component in the true-image screenshot to obtain a component screenshot.

[0186] Since the operation steps and screenshot operation of the prompt box are similar to the previous ones, they will not be described here. Although image recognition can also identify individual components based on grid lines, this embodiment adopts the method of manually intercepting individual components, such as Figure 6 As shown, the purpose is to reduce the amount of calculation, reduce the amount of error correction, and improve system efficiency. At the same time, it also has the effect of modifying the string connection method and display by intercepting different size areas according to the operation to simulate different size components.

[0187] Step 33: Get the length, width and area of ​​the component based on the component screenshot.

[0188] When a component screenshot is obtained, the length, width and area of ​​the component can be calculated based on the component screenshot. The implementation code example is as follows:

[0189] # Get the length (number of pixel columns) and width (number of pixel rows) of the "component.png" image

[0190] height, width = image.shape[:2]

[0191] # Calculate the area of ​​"component.png" (total number of pixels)

[0192] area = height * width

[0193] # Output the length (width), width (height), and area of ​​the "component.png" image

[0194] print(f"Image area: {area} pixels")

[0195] Step 34: Calculate the length, width and area of ​​the string based on the number of components in the string, the arrangement of the components in rows and columns, and the length, width and area of ​​the components.

[0196] When the length, width and area of ​​the component are obtained, and the number of components in the string and the arrangement of the components in the string are also obtained, the length, width and area of ​​the string can be calculated. The implementation code is as follows:

[0197] #Call the component quantity information of the string, for example, the number of components in the string: 22 pieces

[0198] # The area of ​​the string is the sum of the areas of the 22 components

[0199] zc_area = {number_of_units} * area #22

[0200] # Output the area of ​​the string

[0201] print(f"The area of ​​the string: {zc_area} pixels")

[0202] #Call the row and column arrangement information of the components of the string, for example: the string is arranged as 2 rows * 11 columns

[0203] # Call the calculated row and column values ​​and substitute them into the row and column values

[0204] rows = second_number #2

[0205] cols = first_number #11

[0206] # Calculate the new width and height

[0207] zc_length = image.width * cols

[0208] zc_ width = image.height * rows

[0209] # Output the length (pixel width) and width (pixel height) of the string

[0210] print(f"The length of the string: {zc_length} pixels")

[0211] print(f"Width of the string: {zc_width} pixels")

[0212] Step 35: Use the color that appears most frequently in the component screenshot to perform a color mask recognition operation on the true orthogonal image screenshot to obtain the contours of each similar color range in the true orthogonal image screenshot.

[0213] This implementation identifies the colors in the component screenshot, and creates a color mask by taking the color that appears most frequently in the component, i.e., the color with the widest coverage area, as the target color. It is understandable that step 35 may specifically include loading component .png, converting the image BGR to HSV, calculating the histogram of the HSV color space, normalizing the histogram, finding the index corresponding to the maximum value in the histogram, converting back to the HSV color range, and taking a smaller range near the maximum value to create a component color mask. The specific implementation code example of color mask determination is as follows:

[0214] # Calling the library

[0215] import cv2 #OpenCV Python interface

[0216] import numpy as np #for numerical calculations

[0217] # Assume that image is the image loaded in this step

[0218] image = cv2.imread('component.png')

[0219] # Convert the image from BGR to HSV color space

[0220] hsv_image = cv2.cvtColor(image, cv2.COLOR_BGR2HSV)

[0221] # Calculate the histogram of HSV color space

[0222] # OpenCV's histogram calculation uses 8-bit single-channel images by default

[0223] hsv_planes = cv2.split(hsv_image)

[0224] hist_size = [180, 256, 256]

[0225] hist_ranges = [0, 180, 0, 256, 0, 256]

[0226] hist = cv2.calcHist([hsv_planes[0], hsv_planes[1], hsv_planes[2]],[0, 1, 2], None, hist_size, hist_ranges, [8, 8, 8])

[0227] # Normalize the histogram

[0228] cv2.normalize(hist, hist, alpha=0, beta=1, norm_type=cv2.NORM_MINMAX,dtype=cv2.CV_32F)

[0229] # Find the index corresponding to the maximum value in the histogram

[0230] _, max_val, _, max_loc = cv2.minMaxLoc(hist)

[0231] # max_loc contains the index values ​​of the three HSV channels

[0232] h_max, s_max, v_max = np.unravel_index(max_loc, hist_size)

[0233] # Convert back to HSV color range

[0234] h_max = int(h_max)

[0235] s_max = int(s_max)

[0236] v_max = int(v_max) #For example, the sample image recognition value is h206 s22 v44

[0237] h_max = h_max % 180 # Use modulo operation to convert the H value to the range [0, 180)

[0238] # Now h_max, s_max, v_max are the HSV values ​​of the most frequent colors

[0239] # If you want to use this color for masking, you need to determine a color range

[0240] # Usually you can take a smaller range near the maximum value as the representative color

[0241] h_range = (max(0, h_max - 10), min(180, h_max + 10))

[0242] s_range = (max(0, s_max - 10), min(256, s_max + 10))

[0243] v_range = (max(0, v_max - 10), min(256, v_max + 10))

[0244] # Create a color mask. You can use color_mask to identify the most colorful areas in the image, for example:

[0245] color_mask = cv2.inRange(hsv_image, (h_range[0], s_range[0], v_range[0]), (h_range[1], s_range[1], v_range[1]))

[0246] Identify similar color domains in the true orthogonal image screenshot according to the component color mask. The specific steps may include: loading "true orthogonal image screenshot.png", converting the image from BGR to HSV space, and finding similar color domains according to the component color mask, such as Figure 7 As shown; perform morphological closing operation, such as Figure 8 As shown, find the contour of similar color gamut, such as Fig. 9 As shown. Through Python. The code for determining the outline of similar color gamut is as follows:

[0247] #Assume that dxf_image is the image loaded in this step,

[0248] dxf_image = cv2.imread('Real orthogonal image screenshot.png')

[0249] # Convert the image from BGR to HSV space

[0250] hsv_ dxf_image = cv2.cvtColor(dxf_image, cv2.COLOR_BGR2HSV)

[0251] #Find similar color domains based on component color masks and perform morphological closing operations, and apply morphological closing operations

[0252] color_mask = cv2.inRange(hsv_image, (h_range[0], s_range[0], v_range[0]), (h_range[1], s_range[1], v_range[1]))

[0253] #Assume kernel_size is the size of the structure element in the morphological operation

[0254] kernel = np.ones((kernel_size, kernel_size), np.uint8)

[0255] closed_mask = cv2.morphologyEx(color_mask, cv2.MORPH_CLOSE, kernel)

[0256] # Find contours of similar color domains in the mask

[0257] contours, _ = cv2.findContours(closed_mask, cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_SIMPLE)

[0258] Among them, the cv2.morphologyEx function is used to perform morphological operations on binary images. cv2.MORPH_CLOSE is a closing operation, which first performs a dilation operation and then an erosion operation. Closing operations are often used to eliminate small black holes (in the foreground) and connect small foreground objects. kernel is a structural element used by morphological operations, which determines the scope and shape of the operation. The cv2.findContours function is used to detect contours in an image. A contour can be simply understood as a closed curve that represents the boundary of an object in an image. cv2.RETR_EXTERNAL` represents the contour retrieval mode. `cv2.RETR_EXTERNAL` means that only the outermost contour is retrieved, ignoring any nested contours or holes in the image. cv2.CHAIN_APPROX_SIMPLE` represents the contour approximation method. `cv2.CHAIN_APPROX_SIMPLE` compresses horizontal, vertical, and diagonal line segments, that is, it only saves their endpoints. This means that for a straight line segment, it only stores two endpoints. This method can reduce the number of points in the contour, thus saving storage space and processing time.

[0259] Step 36: Calculate the area of ​​each similar color gamut contour respectively, and divide the similar color gamut contour according to the quantitative relationship between the area of ​​the similar color gamut contour and the area of ​​the group string to obtain a contour coordinate set.

[0260] After obtaining each similar color gamut outline, the area of ​​the region surrounded by each similar color gamut outline can be calculated and compared with the previously obtained group string area.

[0261] Since similar color gamut contours may have certain errors during image recognition, and the similar color gamut contours recognized at the same time may cover one or more groups, or there may be separate groups that are different from the arrangement rules due to terrain reasons, or they are not groups. In this embodiment, the minimum difference of integer multiples is used to judge and identify and divide the similar color gamut contours into groups.

[0262] Specifically, they may include:

[0263] Step 370: Determine whether the area of ​​the similar color gamut contour is equal to an integer multiple of the group string area;

[0264] Step 371: If they are equal, then the similar color gamut contour is equally divided according to the integer multiple, the length and width of the similar color gamut contour, and the length and width of the string;

[0265] Step 372: If not, determine whether the minimum difference between the area of ​​the similar color gamut contour and the integer multiple of the group string area is greater than or equal to the area of ​​one component;

[0266] Step 373: If the minimum difference is greater than or equal to the area of ​​a component, no processing is performed;

[0267] Step 374: if the minimum difference is smaller than the area of ​​a component, the similar color gamut contour is equally divided according to the integer multiple corresponding to the minimum difference, the length and width of the similar color gamut contour, and the length and width of the string;

[0268] Step 375: Obtain the coordinates of the similar color gamut contour after bisection, and obtain a contour coordinate set.

[0269] This embodiment determines whether the area of ​​each similar color gamut contour (i.e., contour area) is an integer multiple of the group string area. If so, the number of rows is divided equally according to the multiples of the length of the similar color gamut contour and the length of the group string, and the number of columns is divided equally according to the width of the similar color gamut contour and the multiple of the width of the group string. If not, it is determined whether the minimum difference between the area of ​​the similar color gamut contour and the integer multiple of the group string area is greater than or equal to the area of ​​a component, wherein the minimum difference can also be obtained by comparing the decimal part of the ratio of the two areas and the absolute value of the difference between the decimal part and 1 and the group string area. If so, no processing is performed; if not, the similar color gamut contour is divided equally according to the integer multiple corresponding to the minimum difference, the number of rows is divided equally according to the integer multiple corresponding to the minimum difference between the length of the similar color gamut contour and the length of the group string, and the number of columns is divided equally according to the integer multiple corresponding to the minimum difference between the width of the similar color gamut contour and the width of the group string. After dividing the similar color gamut contour, multiple sub-contours are obtained, such as Fig.10 Each sub-contour contains four corner point coordinates, and the corner point coordinates of all sub-contours together constitute the contour coordinate set.

[0270] To better understand this section, refer to the following code examples:

[0271] (1) Integer multiples:

[0272] # Iterate over each contour

[0273] for cnt in contours:

[0274] # Calculate the contour area. cv2 is the Python interface of the OpenCV library, and contourArea is a function used to calculate the area of ​​the contour.

[0275] ct_area = cv2.contourArea(cnt)

[0276] # Determine whether the area is an integer multiple of the string area

[0277] if ct_area % zc_area == 0:

[0278] # Integer multiples, directly divide the contour according to the multiples. The / / operator performs integer division and the result will be rounded down to the nearest integer.

[0279] num_panels = ct_area / / zc_area

[0280] # Calculate the bounding box of the contour cv2.boundingRect function to calculate the bounding box of the contour cnt, x and y are the coordinates of the upper left corner of the bounding box, w and h are the width and height of the bounding box respectively

[0281] x, y, w, h = cv2.boundingRect(cnt)

[0282] # Calculate the number of rows and columns that are equally divided

[0283] rows = h / / zc_width

[0284] cols = w / / zc_length

[0285] # Initialize the segmented contour list and segment according to rows and columns

[0286] divided_contours = []

[0287] for i in range(rows):

[0288] for j in range(cols):

[0289] # Calculate the coordinates of the upper left corner of the current segmentation area

[0290] start_x = j * panel_length

[0291] start_y = i * panel_width

[0292] # Get the segmented sub-contours

[0293] divided_contour = []

[0294] for point in cnt:

[0295] if start_x <= point[0] < start_x + panel_length and start_y <=point[1] < start_y + panel_width:

[0296] divided_contour.append(point)

[0297] # Add the segmented sub-contours to the list

[0298] divided_contours.append(np.array(divided_contour))

[0299] (2) Non-integer multiples:

[0300] #Get the minimum area difference min_diff and the corresponding integer multiple n_multiple

[0301] else:

[0302] min_diff_with_n = min([abs(contour_area - n * zc_area) for n in range(1, int(contour_area / / zc_area) + 2)]) # min function and list comprehension are used to find the minimum absolute value of area difference

[0303] # Unpack the tuple. In this example, min_diff_with_n is a list of tuples, where each tuple contains the area difference and the corresponding n value.

[0304] min_diff, n_multiple = min_diff_with_n

[0305] if min_diff >= zj_area:

[0306] # If the difference is greater than or equal to the area of ​​a component, it will not be processed. The unprocessed part will be reflected as a blank part in the CAD ".dxf" format drawing. The situation may be that the part is not prepared for identification, or it is an outlier caused by terrain restrictions during design, or it is an outlier in actual construction. For example, the design is 2*11, but it cannot be put in reality, so 2*10 or an outlier 2*12 is put in. Since the blank part is easy to see, it can be processed separately later. The processing method can be manual processing or the system method can be run again for this part separately.

[0307] continue

[0308] # If the difference is less than one block of component area, it will be treated as an integer multiple, and the integer multiple n_multiple corresponding to the minimum difference will be brought into the process of repeating integer multiples; if the difference is less than one block, because the arrangement of the strings is generally neat and there are rarely any odd numbers, it can be regarded as an error caused by the image recognition process, and these errors do not affect the processing or display of the mark.

[0309] else: (repeated omission)

[0310] Among them, min(...)`: finds the smallest difference among all the calculated differences in the list derivation in the brackets;

[0311] range(1, int(contour_area / / zc_area) + 2)`: This part generates a range starting from 1 until the integer part of the contour area `contour_area` divided by the group string area `zc_area` plus 1. The +2 in the code is because the sequence generated by range starts at 1, and the end boundary of the range function is not included. For example, if `contour_area` is 99 and `zc_area` is 20, then int(contour_area / / zc_area) is #99 / / 20 = 4, and the end boundary is not included after adding 2, so the range is 1 to 5. abs(contour_area - n * zc_area)`: For each `n` in the above range, calculate the absolute difference between `contour_area` and `n` multiplied by `zc_area`. That is

[0312] [abs(99 - 1 * 20), abs(99 - 2 * 20), abs(99 - 3 * 20), abs(99 - 4 *20), abs(99 - 5 * 20)]

[0313] # equals [79, 59, 39, 19, 1]

[0314] Then the minimum difference is 1, and the integer multiple of the minimum difference is 5.

[0315] Example of steps to get the contour coordinate set:

[0316] #Calculate the coordinate set of the four points in each segmented sub-contour list

[0317] #Here are two examples. In the case of a relatively regular group parallelism, just traverse each sub-contour and find the minimum and maximum values ​​of x and y, which will correspond to the four corner points of the sub-contour

[0318] for index, contour in enumerate(divided_contours):

[0319] x_min, y_min = np.min(contour, axis=0)

[0320] x_max, y_max = np.max(contour, axis=0)

[0321] # Construct the coordinate set of the four corner points

[0322] corners = np.array([[x_min, y_min], [x_max, y_min], [x_max, y_max],[x_min, y_max],[x_min, y_min]])#Repeat the first coordinate to form a closed figure when drawing with coordinate points.

[0323] # Another way, when the terrain of the group string is irregular, after traversing each sub-contour, use the cv2.convexHull function to calculate the convex hull of the contour for index, contour in enumerate(divided_contours):

[0324] hull = cv2.convexHull(contour)

[0325] # If the convex hull has more than four points, use cv2.approxPolyDP function to approximate the convex hull and further process it to find the four corner points of the rectangle

[0326] if len(hull) > 4:

[0327] # Approximate the convex hull to obtain the four corner points of the rectangle. Epsilon is a parameter used to control the accuracy of the approximation.

[0328] epsilon = 0.01 * cv2.arcLength(hull, True)

[0329] approx = cv2.approxPolyDP(hull, epsilon, True)

[0330] # Get the four corner points of the rectangle and arrange them in clockwise or counterclockwise order

[0331] rect_corners = approx.reshape((-1, 2))

[0332] # Initialize a list to store the corner coordinates of all sub-contours, that is, let all_contour_corners be a list to store the set of corner coordinates of all sub-contours

[0333] all_contour_corners = []

[0334] # Add the obtained corner coordinates of the current sub-contour to the list. rect_corners.tolist() converts the NumPy array to a Python list, which is used to store the contour coordinates.

[0335] all_contour_corners.append(rect_corners.tolist()) #Further repeat the first coordinate point

[0336] Furthermore, in order to facilitate external viewing, the contour coordinate set can be directly referenced or output as a txt file. The specific implementation code example is as follows:

[0337] # For example, save the contour coordinate set to a file

[0338] with open('contour_corners.txt', 'w') as file:

[0339] for index, corners in enumerate(all_contour_corners):

[0340] # Convert the index and corner coordinates of each subcontour into a string and write to the file

[0341] file.write(f"Sub-contour {index} corners:\n")

[0342] for corner in corners:

[0343] file.write(f"({corner[0]}, {corner[1]})\n")

[0344] file.write('\n') # Output a blank line to separate the coordinate sets of different sub-contours

[0345] # The 'contour_corners.txt' file contains the coordinates of all sub-contour corners

[0346] S104: Obtaining a string marking file corresponding to the target ground power station according to the contour coordinate set.

[0347] It should be noted that the string marker file in this embodiment is a KML file (a landmark file format; the file is used to record the time, longitude, latitude, altitude and other geographic information data of a certain place or continuous places). This embodiment does not limit the specific method of obtaining the string marker file. For example, (1) after obtaining the coordinates, the string marker file can be directly generated according to the coordinate values, specifically including: when the contour coordinate set is obtained, they are converted from the image coordinate system back to the real geographic coordinate system, which involves a transformation matrix or a series of mathematical operations. These operations depend on the projection method and coordinate system settings, and it is necessary to know the projection method, scale and any possible rotation or translation transformation of the original map. This method involves mathematical operations, which is computationally intensive, and requires the composition information of the drone system and the mathematical operations of coordinate conversion, which is difficult and costly (generally encrypted and cannot be obtained). Alternatively, (2) in the CAD software, through the pyautogui library, according to the contour coordinate set, the mouse operation is simulated to draw the corresponding contour on the real orthogonal image base map as the basic composition of the string marker file; the contour can be a frame line or a solid color fill. This method requires little computation and does not require conversion from bitmap to vector image or from screen coordinates to real geographic coordinate systems.

[0348] Furthermore, in order to reduce the amount of calculation, the above-mentioned contour coordinate set obtains the string marking file corresponding to the target ground power station, which may specifically include:

[0349] Step 41: Draw corresponding contours in batches on the base map of the true orthogonal image according to the contour coordinate set to obtain a marked computer-aided design file.

[0350] This embodiment batch draws corresponding contours on the base map of the true orthogonal image according to the contour coordinate set. After drawing, it prompts to save as a .dxf CAD file. After the output is completed, the marked cad file (.dxf format file) is output. The prompt operation example code is the same as the previous prompt principle. You only need to replace the prompt content. You can also add a shortcut command for simulation saving.

[0351] Step 42: Obtain a group string tag file for describing and storing geographic information based on the marked computer-aided design file.

[0352] This embodiment can import the completed CAD file into the Aowei interactive map browser, select "latitude and longitude analysis" for the imported file, batch name and mark the corresponding contour windows generated, generate and export the KML file, that is, the group string marking file.

[0353] In order to better understand this section, step 41 and step 42 are explained together:

[0354] It is understandable that before executing step 41 and step 42, it is necessary to switch from the screenshot image processing interface to the CAD window. The specific implementation code example is as follows:

[0355] # This usually involves finding the title or handle of the CAD window and then switching to it. Here is a simplified example. You can actually design more complex logic to find and switch to the CAD window.

[0356] pyautogui.hotkey('alt', 'tab') # Assume that you can switch to CAD via Alt+Tab

[0357] time.sleep(1) # Wait for the switch to complete

[0358] Because full screen display was selected and the display ratio was adjusted when the CAD window was captured, the coordinates of the image recognition after switching are also the coordinates of the mouse simulation operation. Even if there is a certain reduction in proportion due to the loading of the image, the contour coordinate set can be corrected according to the reduction ratio. For example, the reduction ratio is based on the pixel width and height of the image obtained by the screenshot, and the image width and height of the full screen (screen resolution) are compared. The screen resolution can be obtained using the tkinter library. The principle of calling the library is relatively simple and will not be repeated here. Then the scaling factor is calculated based on the ratio of the screenshot size and the screen resolution, and the coordinate offset is calculated based on the upper left corner point in the CAD ".dxf" format drawing and the upper left corner point of the screenshot. With the scaling factor and coordinate offset, the contour coordinate set in the screenshot can be corrected. The code principle for implementing the correction calculation is mainly selection, multiplication and division, and most cases do not require correction, so the specific code is not repeated.

[0359] The outline in this embodiment can be a frame line or a solid color fill. There are many ways to fill. For example, use the pl polyline command to draw the outline; use the h fill command to select solid fill; or directly use the so solid fill for the regular outline. In this embodiment, the solid color of the corresponding outline shape can be filled on the base map of the true orthogonal image in CAD, such as Fig.11 As shown. The following is an explanation of the implementation process of each entity color filling method:

[0360] (1) Use the pl polyline command to draw the outline of the polyline.

[0361] # Traverse the corner point coordinate set of each sub-contour

[0362] for contour_corners in all_contour_corners:

[0363] # Enter the "pl" command and press the spacebar to start drawing a polyline

[0364] pyautogui.typewrite('pl ') # Note: The typewrite function simulates keyboard input, including spaces

[0365] time.sleep(0.1) # Wait a little while to make sure the command is entered correctly

[0366] # Traverse each corner point coordinate and simulate click

[0367] for corner in contour_corners:

[0368] # Move the mouse to the specified coordinates

[0369] pyautogui.moveTo(corner[0], corner[1], duration=0.25)

[0370] time.sleep(0.1) # Wait for a while to ensure the mouse position is stable

[0371] # Click the mouse to simulate drawing points

[0372] pyautogui.click()

[0373] # Enter two spaces after each point to simulate the operation of continuing to draw polylines in CAD software

[0374] pyautogui.press('space') # Press the space bar

[0375] pyautogui.press('space') # Press the space bar again

[0376] time.sleep(0.1) # Wait a little while to make sure the space is entered correctly

[0377] (2) Use the h fill command to select solid fill.

[0378] #When filling the selected target contour, you can select the center point coordinates of each sub-contour, and calculate the average value of the set of corner point coordinates of each sub-contour. This can be achieved by calculating the sum of the x and y values ​​of all corner point coordinates and then dividing by the number of corner points.

[0379] # Store a list of the center point coordinates of each subcontour

[0380] centers = []

[0381] # Traverse the corner point coordinate set of each sub-contour

[0382] for contour_corners in all_contour_corners:

[0383] # Initialize the sum of x and y coordinates

[0384] sum_x = 0

[0385] sum_y = 0

[0386] # Traverse the coordinates of each corner point of the current sub-contour

[0387] for x, y in contour_corners:

[0388] sum_x += x

[0389] sum_y += y

[0390] # Calculate the center point coordinates (average value)

[0391] center_x = sum_x / len(contour_corners)

[0392] center_y = sum_y / len(contour_corners)

[0393] # Add the center point coordinates to the list

[0394] centers.append((center_x, center_y))

[0395] #You can be prompted to set the entity color that needs to be filled or use the default style. Use the "h" command and press the space bar, then click the center coordinate point set in sequence.

[0396] The prompt operation example code is the same as the previous prompt principle. You only need to replace the prompt content. I will not go into details here. After using the instruction, the principle of simulating mouse clicks in sequence is the same as the principle of using the "pl" instruction before. You only need to replace the instruction collection. I will not go into details here.

[0397] (3) Fill in with the so entity.

[0398] #Use the "SO" command and press the spacebar to traverse each corner point coordinate and simulate clicking. The principle is the same as that of the "pl" command. Just replace the command set. I will not go into details here. The command set may be different according to the requirements of different versions of CAD. You can adjust the order of coordinate points in the coordinate set according to different requirements. For example:

[0399] # The coordinates of the four corner points with relatively regular string parallelism are in the clockwise order of lower left, lower right, upper right, and upper left

[0400] corners = np.array([[x_min, y_min], [x_max, y_min], [x_max, y_max],[x_min, y_max]])

[0401] Adjust to the order of upper left, lower left, upper right, lower right

[0402] corners = np.array([[x_min, y_max],[x_min, y_min], [x_max, y_ max],[x_max, y_, min]])

[0403] #If the parallelism of the string is irregular, add it to the calculation

[0404] # Convert the approxed points to floating point numbers. This line converts the data type of the approx array to floating point numbers. This is done to ensure that accurate results are obtained when performing mathematical operations (such as finding the minimum and maximum values).

[0405] approx = approx.astype("float")

[0406] # Calculate the corresponding boundary points

[0407] top_left = approx[np.argmin(approx[:, 1, 0])] #The point with the smallest y coordinate in the array, that is, the top point, extracts the y coordinates of all points. The np.argmin function returns the index of the minimum value of these y coordinates. This index is used to select the corresponding point from the approx array as top_left

[0408] bottom_right = approx[np.argmax(approx[:, 1, 0] + approx[:, 1, 1])]#The point with the largest sum of x and y coordinates in the array is the bottom right point. By adding the x and y coordinates, we can find the points on the diagonal, and the point with the largest sum is the bottom right point

[0409] top_right = approx[np.argmax(approx[:, 1, 1])] #The point with the largest x coordinate in the array, that is, the rightmost point

[0410] bottom_left = approx[np.argmin(approx[:, 1, 1])] #The point with the smallest x coordinate in the array, that is, the leftmost point

[0411] # Arrange in the order of top left, bottom left, top right, bottom right

[0412] rect_corners = np.array([top_left, bottom_left, top_right, bottom_right], dtype="float32")

[0413] Furthermore, in order to increase the mutual deviation of coordinates between adjacent contours for easier display, after the above step S103, the following steps may be further included:

[0414] If it is determined that there are adjacent contours according to the contour coordinate set, the coordinates of the adjacent contours are deviated from each other in the length direction to obtain a deviated contour coordinate set;

[0415] Correspondingly, step S104 may specifically include: obtaining a string marking file corresponding to the target ground power station according to the offset contour coordinate set.

[0416] Specifically, there may be adjacent contours in the obtained contour coordinate set. If they are filled with the same entity color during display, it is difficult to distinguish adjacent groups. Therefore, the coordinates between adjacent contours are further deviated from each other in the length direction to form gaps between adjacent contours, so that the marked diagram is more intuitive, such as Fig.12 shown.

[0417] The deviation principle is: traverse the single contour coordinate sets with the same corner point coordinates in the contour coordinate set, and perform different positive and negative numerical deviation calculations on the same corner point coordinates in the length direction. For example, the coordinates of two single contour coordinate sets are ([[x1, y1, [x2, y2], [x3, y3], [x4, y3]]), ([[x3, y3, [x4, y4], [x5, y5],[x6, y6]]). For example, when the strings are arranged regularly, the length direction of the strings is deviated on the y-axis. Assuming that the deviation value is a, (a can be adjusted according to the actual expected graphical effect, and a value of 1-10 can be generally taken), the coordinates after deviation are ([[x1, y1, [x2, y2], [x3, y3-a], [x4, y3-a]]), ([[x3, y3+a, [x4, y4+a], [x5,y5], [x6, y6]]), a gap of 2a pixels is formed between the two deviated contour coordinate sets, which can make the marked diagram more intuitive to distinguish different groups of strings. The calculation involved in this step is similar to the calculation principle of the center point, and the specific code is not expanded for further description.

[0418] Furthermore, in order to increase the applicability and wide application of the present method, after the above step S103, the following steps may be further included:

[0419] When the regular expression is used to perform field screening on the recognized text, the target field is not obtained, and the number of columns is determined to be a non-integer according to the obtained row number supplementary information, the coordinates in the contour coordinate set are corrected to obtain a corrected contour coordinate set;

[0420] Correspondingly, step S104 may specifically include: obtaining a string marking file corresponding to the target ground power station according to the corrected contour coordinate set.

[0421] Specifically, when the regular expression fails to find a match for the arrangement information of the string "rows x columns", a prompt will be given to manually supplement the number of rows, and the arrangement of the output string "rows x columns" is "number of rows * (number of strings divided by number of rows)", and it is determined whether the number of columns (i.e. number of strings divided by number of rows) is an integer. If it is not an integer, it is necessary to increase the step coordinate offset after step S103. Failure to find the arrangement information of the string "rows x columns" may be because the number of rows is 1 or forgotten to be marked. In this case, when the number of columns is an integer, it is a regular arrangement, and the normal process can be continued. Another case is that in a multi-row situation, the number of components in each row is different. For example, for a string of 27 pieces, 1 row has 13 and 14. This is usually an even number of groups combined into a rectangular array, and the components that intersect in the middle are staggered, for example Fig.13As shown, in this case, the value of the column number is a value with a decimal point (5 decimal places), for example, 27 / 2=13.5. Although the value 13.5 is not an integer, it only affects the length of the group string in the calculation and does not affect the subsequent contour division. For this case, a coordinate offset step is added after step S103 to correct the contour.

[0422] The correction principle is: find the adjacent coordinate corner points in the coordinate set in the x-axis direction or the length direction of the string, calculate the midpoint coordinates of the two adjacent coordinate corner points according to the coordinates of the two adjacent coordinate corner points, and calculate the coordinate values ​​of half the width of the component according to the coordinates of the two adjacent coordinate corner points and the midpoint coordinates of the two adjacent coordinate corner points in the x-axis direction or the length direction of the string. The new coordinates are composed of the two originally non-adjacent coordinates, the two coordinates after the midpoint offset, and the offset coordinates of the adjacent coordinate corner points in two opposite directions. The opposite direction can be adjusted according to the actual situation of the power station. Generally, the lower part on the left is convex and the upper part on the right is convex, such as the lower 14 on the left and the upper 14 on the right. Of course, this is the opposite, that is, the upper 14 on the left and the lower 14 on the right. This has little effect on the mark recognition of the ground power station, and the operation of prompt selection can be added for quick correction. The code implementation principle example defines the custom function of the above logic, such as midpoint calculation and coordinate value offset, and constructs a new coordinate string set in sequence. The calculation involved in this step is similar to the calculation principle of the center point, and the specific code is not expanded for elaboration.

[0423] Furthermore, in order to adapt to diverse needs and to be more suitable for practical applications, after step S104, the following steps may be performed: determining the power generation unit area according to the drawing of the power generation unit, selecting the outline of the string in the power generation unit area, and modifying the color display of the outline of the string in the power generation unit area; wherein the power generation unit area is an area composed of several strings. For details, please refer to Fig.14 and Fig.15 In order to facilitate the clear display of the attached drawings, Fig.14 The text in the material table of the power generation unit in the lower left corner, the explanatory text on the table and the label text in each string are hidden. It can be understood that when identifying the rectangular outlines in the drawings, calculating the area of ​​the identified rectangular outlines, and filtering the area values ​​with the most occurrences, and only retaining all the rectangular outlines of the area, the above texts are all recognized noises, and the hiding of the text content does not affect the understanding of the overall solution.

[0424] The specific implementation steps are as follows:

[0425] Step 51: Identify the shape of the power generation unit in the drawing of the power generation unit.

[0426] Specifically, load the power generation unit drawing, convert the drawing format to a format that can be recognized by OpenCV, recognize the rectangular contours in the drawing, calculate the area of ​​the recognized rectangular contours, filter the area value with the most occurrences, and only retain all the rectangular contours of the area as the recognition shape of the power generation unit area. Among them, the rectangular contours in the drawing can be recognized using the contour detection function of OpenCV (such as findContours). For each recognized rectangular contour, the contourArea function of OpenCV can be used to calculate its area. The principle is similar to the previous component area calculation and will not be repeated.

[0427] Step 52: matching and identifying similar shapes in the true orthogonal image screenshot according to the shape of the power generation unit, and obtaining the coordinate set of the power generation unit after identification.

[0428] Specifically, similar shapes can be matched and identified using feature matching, which detects key points (such as corners, edges, etc.) in an image, extracts descriptors of these key points, and then compares these descriptors between different images to find similar or matching features. SIFT (Scale Invariant Feature Transform) and SURF (Speeded Up Robust Features) are two commonly used feature matching algorithms.

[0429] Because the drawing of the power generation unit has a large difference in scale from the real orthographic image interface opened earlier, feature point detection algorithms (such as SIFT, SURF, ORB, etc.) are used to extract feature points in the template image and the target image, and calculate the descriptors between them. Then, matching feature point pairs are found by comparing the descriptors. This method is robust to scaling, rotation, and a certain degree of perspective changes. The specific implementation code example is as follows:

[0430] #Calling the library

[0431] import cv2 #OpenCV Python interface

[0432] import numpy as np #for numerical calculations

[0433] # Read the template image and the target image

[0434] template_image = cv2.imread('template.png', 0) #The shape of the power generation unit area

[0435] dxf_image = cv2.imread('Real orthogonal image screenshot.png', 0) #Real orthogonal image screenshot.png

[0436] # Initialize the feature point detector (ORB is used as an example here). The ORB (Oriented FAST and Rotated BRIEF) algorithm is used here to detect key points in the image and calculate their descriptors. ORB is a fast and effective feature point detection and description algorithm.

[0437] orb = cv2.ORB_create()

[0438] # Detect key points in template image and target image and calculate descriptors These two lines of code perform ORB feature point detection and descriptor calculation on the template image (template_image) and target image (dxf_image) respectively. kp1 and kp2 are the lists of detected key points, and des1 and des2 are the corresponding descriptor lists.

[0439] kp1, des1 = orb.detectAndCompute(template_image, None)

[0440] kp2, des2 = orb.detectAndCompute(dxf_image, None)

[0441] # Create a BFMatcher object. Here, a Brute-Force Matcher (BFMatcher) object is created to match two descriptor sets. cv2.NORM_HAMMING is the type of distance metric between descriptors, which is suitable for binary descriptors (such as ORB descriptors). crossCheck=True means that only matching point pairs in the two descriptor sets are retained, which helps to remove false matches.

[0442] bf = cv2.BFMatcher(cv2.NORM_HAMMING, crossCheck=True)

[0443] # Match descriptors, use the BFMatcher object to match the template image descriptor (des1) and the target image descriptor (des2). matches is a list of matching results, each element of which is a DMatch object, containing information such as the matching key point index and the distance between descriptors.

[0444] matches = bf.match(des1, des2)

[0445] # Sort by distance Sort the matches according to the distance between the descriptors in the matching results. The smaller the distance, the more accurate the match.

[0446] matches = sorted(matches, key=lambda x: x.distance)

[0447] #Select the best match

[0448] best_match = matches[0] if matches else None

[0449] # If a match is found

[0450] if best_match:

[0451] # Get the coordinates of the matching points in the target image

[0452] train_pt = kp2[best_match.trainIdx].pt

[0453] # Output coordinate points

[0454] print(f"dxf Image Point: {train_pt}")

[0455] Step 53: Based on the coordinate set of the power generation unit, the colors of the strings in the power generation unit area are modified in batches on the base map of the true orthogonal image.

[0456] Specifically, simulate the "esc" keyboard input clear command to restore to the default box selection, simulate the mouse click on the first point coordinate, slide through the remaining point coordinates in sequence, and finally return to the first point coordinate to form a box selection area, prompt to execute a new layer color to modify the layer color, and perform a new layer operation on the box selection area to modify the layer color to modify the color display of the power generation unit area. The principle is similar to the drawing of the string outline, and the code is not repeated.

[0457] The digital twin modeling and marking method for ground power stations provided by the embodiment of the present invention is applied, and the automatic marking of string information is realized by using methods such as image recognition and batch operation, by obtaining the design drawing and true orthogonal image of the target ground power station; using text recognition technology to extract text information in the design drawing, and obtaining the component quantity information of each string and the component row and column arrangement information of each string; using image processing technology to identify the strings in the true orthogonal image, and based on the component quantity information of each string and the component row and column arrangement information of each string, the contour coordinate set of all strings is obtained; according to the contour coordinate set, the string marking file corresponding to the target ground power station is obtained. The present invention fills the gap in the research on the automatic marking of string information in the process of digital twin modeling of ground power stations, and also improves the marking efficiency of strings in the process of digital twin modeling of ground power stations. In addition, the mutual deviation of coordinates between adjacent contours is increased for easy display; and the color of the strings in the electric unit area is also modified to adapt to diverse needs and be more suitable for practical applications; and when the component arrangement information is not recognized by the text recognition technology and the number of columns is not an integer, the coordinates in the contour coordinate set need to be corrected to ensure the accuracy of the coordinates in the contour coordinate set; and the design drawing is screenshotted and the screenshot is processed for text recognition, which eliminates the need for complex format conversion, is convenient and fast, and reduces the difficulty; and the component is used to determine the color mask, and the true orthogonal image screenshot is masked based on the color mask to determine the similar color gamut contour, thereby improving the accuracy of the recognition of similar color gamut contours in the true orthogonal image screenshot; and the multiple relationship between the area of ​​the calculated similar color gamut contour and the string area is divided in detail, and there is an adaptive processing method for each situation, which increases the applicability; and the strings in a certain area of ​​the figure, such as the power generation unit area, can also be highlighted, so as to adapt to diverse needs and be more suitable for practical applications.

[0458] The following is an introduction to the ground power station digital twin modeling and marking system provided by an embodiment of the present invention. The ground power station digital twin modeling and marking system described below and the ground power station digital twin modeling and marking method described above can be referenced to each other.

[0459] Please refer to Fig.16 , Fig.16 A structural diagram of a ground power station digital twin modeling and marking system provided by an embodiment of the present invention may include:

[0460] An acquisition module 100 is used to acquire a design drawing and a true orthogonal image of a target ground power station;

[0461] The text extraction module 200 is used to extract the text information in the design drawing by using text recognition technology to obtain the number of components of each string and the arrangement of the components of each string;

[0462] The image processing module 300 is used to identify the strings in the true orthogonal image using image processing technology, and obtain the outline coordinate set of all the strings based on the number of components of each string and the arrangement information of the components of each string;

[0463] The marking module 400 is used to obtain a string marking file corresponding to the target ground power station according to the contour coordinate set.

[0464] Based on the above embodiment, the text extraction module 200 may include:

[0465] A design drawing screenshot unit, used to take a screenshot of the design drawing to obtain a design drawing screenshot;

[0466] A text recognition unit, used to perform text recognition on the design screenshot to obtain recognized text;

[0467] A field screening unit, used for screening the identified text by using a regular expression to obtain a target field;

[0468] The digital extraction unit is used to perform digital extraction on the target field to obtain the component quantity information of each string and the component row and column arrangement information of each string.

[0469] Based on the above embodiment, the image processing module 300 may include:

[0470] A true-to-orthogonal image screenshot unit, used to take a screenshot of the true-to-orthogonal image to obtain a true-to-orthogonal image screenshot;

[0471] A component screenshot unit, used to take a screenshot of any component in the true-image screenshot to obtain a component screenshot;

[0472] A component unit, used to obtain the length, width and area of ​​a component according to the component screenshot;

[0473] A string unit, used to calculate the length, width and area of ​​the string according to the number of components of the string and the arrangement of the components of the string, as well as the length, width and area of ​​the components;

[0474] A mask operation unit, configured to perform a color mask recognition operation on the true orthogonal image screenshot using the color that appears most frequently in the component screenshot, to obtain contours of similar color gamuts in the true orthogonal image screenshot;

[0475] The division unit is used to respectively calculate the area of ​​each of the similar color gamut contours, and divide the similar color gamut contours according to the quantitative relationship between the area of ​​the similar color gamut contours and the area of ​​the group string to obtain the contour coordinate set.

[0476] Based on the above embodiment, the division unit may include:

[0477] A first judging subunit, used to judge whether the area of ​​the similar color gamut contour is equal to an integer multiple of the group string area;

[0478] A first division subunit is used for, if equal to, dividing the similar color gamut contour equally according to the integer multiple, the length and width of the similar color gamut contour, and the length and width of the group string;

[0479] The second judgment subunit is used to judge whether the minimum difference between the area of ​​the similar color gamut contour and the integer multiple of the group string area is greater than or equal to the area of ​​one component if it is not equal to;

[0480] A first result subunit, configured to not process if the minimum difference is greater than or equal to an area of ​​a component;

[0481] A second division subunit is used for dividing the similar color gamut contour equally according to the integer multiple corresponding to the minimum difference, the length and width of the similar color gamut contour, and the length and width of the group string if the minimum difference is smaller than an area of ​​a component;

[0482] The contour coordinate set acquisition subunit is used to acquire the coordinates of the similar color gamut contour after being equally divided to obtain the contour coordinate set.

[0483] Based on the above embodiment, the ground power station digital twin modeling and marking system may further include:

[0484] A coordinate offset processing module is used for, after obtaining the contour coordinate sets of all strings based on the component quantity information of each string and the component row and column arrangement information of each string, if it is determined according to the contour coordinate sets that there are adjacent contours, deviating the coordinates between the adjacent contours in the length direction to obtain the offset contour coordinate set;

[0485] Correspondingly, the marking module 400 may be specifically configured to obtain a string marking file corresponding to the target ground power station according to the offset contour coordinate set.

[0486] Based on the above embodiment, the ground power station digital twin modeling and marking system may further include:

[0487] A coordinate correction processing module is used to correct the coordinates in the outline coordinate set to obtain a corrected outline coordinate set when the target field is not obtained by using a regular expression to perform field screening on the recognized text and the number of columns is determined to be a non-integer according to the obtained row number supplementary information;

[0488] Correspondingly, the marking module 400 can be specifically used to obtain a string marking file corresponding to the target ground power station according to the corrected contour coordinate set.

[0489] Based on the above embodiment, the marking module 400 may include:

[0490] A contour drawing unit, used for batch drawing corresponding contours on the base map of the true orthogonal image according to the contour coordinate set, to obtain a marked computer-aided design file;

[0491] The string marking file acquisition unit is used to obtain the string marking file for describing and storing geographic information according to the marked computer-aided design file.

[0492] Based on the above embodiment, the ground power station digital twin modeling and marking system may further include:

[0493] The power generation unit component color modification module is used to determine the power generation unit area according to the power generation unit drawing, select the string outline in the power generation unit area, and modify the color display of the string outline in the power generation unit area; the power generation unit area is an area composed of several strings.

[0494] Based on the above embodiment, the power generation unit component color modification module may include:

[0495] A power generation unit shape recognition unit, used to recognize the shape of the power generation unit in a drawing of the power generation unit;

[0496] A generating unit coordinate set determination unit, used for matching and identifying similar shapes according to the shape of the generating unit in the true orthogonal image screenshot, and obtaining the coordinate set of the generating unit after identification;

[0497] The color modification unit is used to batch modify the colors of the strings in the area of ​​the power generation unit on the base map of the true orthogonal image according to the coordinate set of the power generation unit.

[0498] It should be noted that the order of modules and units in the above-mentioned ground power station digital twin modeling marking system can be changed before or after without affecting the logic.

[0499] The digital twin modeling and marking system for ground power stations provided by the embodiment of the present invention is applied to realize the automatic marking of string information by using methods such as image recognition and batch operation. The acquisition module 100 is used to obtain the design drawing and true orthogonal image of the target ground power station; the text extraction module 200 is used to extract the text information in the design drawing by using text recognition technology to obtain the component quantity information of each string and the component row and column arrangement information of each string; the image processing module 300 is used to identify the strings in the true orthogonal image by using image processing technology, and obtain the contour coordinate set of all strings based on the component quantity information of each string and the component row and column arrangement information of each string; the marking module 400 is used to obtain the string marking file corresponding to the target ground power station according to the contour coordinate set. This method fills the gap in the research on the automatic marking of string information in the process of digital twin modeling of ground power stations, and also improves the marking efficiency of strings in the process of digital twin modeling of ground power stations. In addition, the mutual deviation of coordinates between adjacent contours is increased for easy display; and the color of the strings in the electric unit area is also modified to adapt to diverse needs and be more suitable for practical applications; and when the component arrangement information is not recognized by the text recognition technology and the number of columns is not an integer, the coordinates in the contour coordinate set need to be corrected to ensure the accuracy of the coordinates in the contour coordinate set; and the design drawing is screenshotted and the screenshot is processed for text recognition, which eliminates the need for complex format conversion, is convenient and fast, and reduces the difficulty; and the component is used to determine the color mask, and the true orthogonal image screenshot is masked based on the color mask to determine the similar color gamut contour, thereby improving the accuracy of the recognition of similar color gamut contours in the true orthogonal image screenshot; and the multiple relationship between the area of ​​the calculated similar color gamut contour and the string area is divided in detail, and there is an adaptive processing method for each situation, which increases the applicability; and the strings in a certain area of ​​the figure, such as the power generation unit area, can also be highlighted, so as to adapt to diverse needs and be more suitable for practical applications.

[0500] The following is an introduction to the ground power station digital twin modeling and marking device provided in an embodiment of the present invention. The ground power station digital twin modeling and marking device described below and the ground power station digital twin modeling and marking method described above can be referenced to each other.

[0501] Please refer to Fig.17 , Fig.17 A structural schematic diagram of a ground power station digital twin modeling and marking device provided in an embodiment of the present invention may include:

[0502] A memory 10, used for storing computer programs;

[0503] The processor 20 is used to execute a computer program to implement the above-mentioned ground power station digital twin modeling and marking method.

[0504] The memory 10 , the processor 20 , and the communication interface 31 all communicate with each other via the communication bus 32 .

[0505] In the embodiment of the present invention, the memory 10 is used to store one or more programs, and the program may include program code, and the program code includes computer operation instructions. In the embodiment of the present invention, the memory 10 may store programs for implementing the following functions:

[0506] Obtain the design drawings and true orthogonal images of the target ground power station;

[0507] Use text recognition technology to extract text information in the design drawing to obtain the number of components of each string and the arrangement of the components of each string;

[0508] The image processing technology is used to identify the strings in the true orthogonal image, and the contour coordinate set of all the strings is obtained based on the number of components of each string and the arrangement of the components of each string;

[0509] The string marking file corresponding to the target ground power station is obtained according to the contour coordinate set.

[0510] In a possible implementation, the memory 10 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required for at least one function, etc.; the data storage area may store data created during use.

[0511] In addition, the memory 10 may include a read-only memory and a random access memory, and provide instructions and data to the processor. A portion of the memory may also include an NVRAM. The memory stores an operating system and operating instructions, executable modules or data structures, or a subset thereof, or an extended set thereof, wherein the operating instructions may include various operating instructions for implementing various operations. The operating system may include various system programs for implementing various basic tasks and processing hardware-based tasks.

[0512] The processor 20 may be a central processing unit (CPU), an application specific integrated circuit, a digital signal processor, a field programmable gate array or other programmable logic device, a microprocessor or any conventional processor, etc. The processor 20 may call a program stored in the memory 10 .

[0513] The communication interface 31 may be an interface of a communication module, and is used to connect to other devices or systems.

[0514] Of course, it should be noted that Fig.17The structure shown does not constitute a limitation on the equipment in the embodiment of the present invention. In practical applications, the ground power station digital twin modeling marking equipment may include Fig.17 More or fewer components than shown, or combinations of certain components.

[0515] The medium provided in an embodiment of the present invention is introduced below. The medium described below and the ground power station digital twin modeling marking method described above can be referenced to each other.

[0516] The present invention also provides a medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned ground power station digital twin modeling and marking method are implemented.

[0517] The medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.

[0518] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0519] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in 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 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 may 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.

[0520] Finally, it should be noted that, in this article, relationships such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprises" or any other variations are intended to cover non-exclusive inclusion, so that a process, method, article or device that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.

[0521] The above is a detailed introduction to a ground power station digital twin modeling and marking method, system, equipment and medium provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for general technical personnel in this field, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A ground power station digital twin modeling and marking method, characterized in that: include: Obtain the design drawings and true orthogonal images of the target ground power station; Using text recognition technology to extract text information in the design drawing to obtain component quantity information of each string and component row and column arrangement information of each string; Using image processing technology to identify the strings in the true orthogonal image, and obtaining the outline coordinate set of all the strings based on the number of components of each string and the arrangement of the components of each string; Obtaining a string marking file corresponding to the target ground power station according to the contour coordinate set; The strings in the true orthogonal image are identified by using image processing technology, and the contour coordinate sets of all strings are obtained based on the number of components of each string and the arrangement of the components of each string, including: Taking a screenshot of the true orthogonal image to obtain a true orthogonal image screenshot; Taking a screenshot of any component in the true image screenshot to obtain a component screenshot; Obtain the length, width and area of ​​the component according to the component screenshot; Calculate the length, width and area of ​​the string according to the number of components of the string, the arrangement of the components of the string, and the length, width and area of ​​the components; Performing a color mask recognition operation on the true orthogonal image screenshot using the color that appears most frequently in the component screenshot, and obtaining contours of similar color gamuts in the true orthogonal image screenshot; The areas of the similar color gamut contours are calculated respectively, and the similar color gamut contours are divided according to the quantitative relationship between the areas of the similar color gamut contours and the area of ​​the group strings to obtain the contour coordinate set.

2. The ground power station digital twin modeling and marking method according to claim 1 is characterized in that: The text information in the design drawing is extracted by using text recognition technology to obtain the number of components of each string and the arrangement of the components of each string, including: Taking a screenshot of the design drawing to obtain a screenshot of the design drawing; Performing text recognition on the screenshot of the design drawing to obtain recognized text; Using regular expressions to perform field screening on the recognized text to obtain a target field; Digital extraction is performed on the target field to obtain component quantity information of each string and component row and column arrangement information of each string.

3. The ground power station digital twin modeling and marking method according to claim 1 is characterized in that: The similar color gamut contour is divided according to the quantitative relationship between the area of ​​the similar color gamut contour and the area of ​​the group string to obtain the contour coordinate set, including: Determine whether the area of ​​the similar color gamut contour is equal to an integer multiple of the group string area; If they are equal, then the similar color gamut contour is equally divided according to the integer multiple, the length and width of the similar color gamut contour, and the length and width of the group string; If not, determining whether the minimum difference between the area of ​​the similar color gamut contour and the integer multiple of the group string area is greater than or equal to the area of ​​one component; If the minimum difference is greater than or equal to the area of ​​a component, no processing is performed; If the minimum difference is smaller than the area of ​​a component, the similar color gamut contour is equally divided according to the integer multiple corresponding to the minimum difference, the length and width of the similar color gamut contour, and the length and width of the string; The coordinates of the similar color gamut contour after being bisected are obtained to obtain the contour coordinate set.

4. The ground power station digital twin modeling and marking method according to claim 1 is characterized in that: After obtaining the outline coordinate sets of all strings based on the number of components of each string and the arrangement information of the components of each string, the following is also included: If it is determined according to the contour coordinate set that there are adjacent contours, the coordinates of the adjacent contours are deviated from each other in the length direction to obtain a deviated contour coordinate set; Correspondingly, the string marking file corresponding to the target ground power station is obtained according to the contour coordinate set, including: A string marking file corresponding to the target ground power station is obtained according to the offset contour coordinate set.

5. The ground power station digital twin modeling and marking method according to claim 1, characterized in that: After obtaining the outline coordinate sets of all strings based on the number of components of each string and the arrangement information of the components of each string, the following is also included: When the regular expression is used to perform field screening on the recognized text and the target field is not obtained, and the number of columns is determined to be a non-integer according to the obtained row number supplementary information, the coordinates in the contour coordinate set are corrected to obtain a corrected contour coordinate set; Correspondingly, the string marking file corresponding to the target ground power station is obtained according to the contour coordinate set, including: A string marking file corresponding to the target ground power station is obtained according to the corrected contour coordinate set.

6. The ground power station digital twin modeling and marking method according to claim 1, characterized in that: Obtaining a string marking file corresponding to the target ground power station according to the contour coordinate set includes: Drawing corresponding contours in batches on the base map of the true orthogonal image according to the contour coordinate set to obtain a marked computer-aided design file; The group string marking file for describing and storing geographic information is obtained according to the marked computer-aided design file.

7. The ground power station digital twin modeling and marking method according to claim 1 is characterized in that: Also includes: The power generation unit area is determined according to the drawing of the power generation unit, the outline of the string in the power generation unit area is framed, and the color display of the outline of the string in the power generation unit area is modified; the power generation unit area is an area composed of several strings.

8. The ground power station digital twin modeling and marking method according to claim 7, characterized in that: The step of determining the power generation unit area according to the drawing of the power generation unit, selecting the outline of the string in the power generation unit area, and modifying the color display of the outline of the string in the power generation unit area includes: identifying a shape of a power generation unit in a drawing of the power generation unit; In the true orthogonal image screenshot, matching and identifying similar shapes according to the shape of the power generation unit, and obtaining a coordinate set of the power generation unit after identification; The colors of the strings in the area of ​​the power generation units are modified in batches on the base map of the true orthogonal image according to the coordinate set of the power generation units.

9. A ground power station digital twin modeling and marking system, characterized in that: include: An acquisition module is used to acquire the design drawing and true orthogonal image of the target ground power station; A text extraction module is used to extract text information in the design drawing using text recognition technology to obtain component quantity information of each string and component row and column arrangement information of each string; An image processing module, used to identify the strings in the true orthogonal image using image processing technology, and obtain the outline coordinate set of all the strings based on the number of components of each string and the arrangement information of the components of each string; A marking module, used for obtaining a string marking file corresponding to the target ground power station according to the contour coordinate set; The image processing module comprises: A true-to-orthogonal image screenshot unit, used to take a screenshot of the true-to-orthogonal image to obtain a true-to-orthogonal image screenshot; A component screenshot unit, used to take a screenshot of any component in the true-image screenshot to obtain a component screenshot; A component unit, used to obtain the length, width and area of ​​a component according to the component screenshot; A string unit, used to calculate the length, width and area of ​​the string according to the number of components of the string and the arrangement of the components of the string, as well as the length, width and area of ​​the components; A mask operation unit, configured to perform a color mask recognition operation on the true orthogonal image screenshot using the color that appears most frequently in the component screenshot, to obtain contours of similar color gamuts in the true orthogonal image screenshot; The division unit is used to respectively calculate the area of ​​each of the similar color gamut contours, and divide the similar color gamut contours according to the quantitative relationship between the area of ​​the similar color gamut contours and the area of ​​the group string to obtain the contour coordinate set.

10. A ground power station digital twin modeling and marking device, characterized in that: include: Memory for storing computer programs; A processor is used to implement the steps of the ground power station digital twin modeling and marking method as described in any one of claims 1 to 8 when executing the computer program.

11. A medium, characterized in that The medium stores computer executable instructions, and when the computer executable instructions are loaded and executed by the processor, the steps of the ground power station digital twin modeling and marking method as described in any one of claims 1 to 8 are implemented.