Electric power line image defect area segmentation method, system, equipment and medium

By generating gradient response maps and demarcating target areas of interest, the problems of background interference and environmental factors in power line image analysis are solved, and more efficient and accurate defect detection is achieved.

CN120451189AActive Publication Date: 2025-08-08GUIZHOU POWER GRID CO LTD

Patent Information

Application Number
CN202510908269.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-02
Publication Date
2025-08-08
Estimated Expiration
2045-07-02

AI Technical Summary

Technical Problem

Existing power line image analysis technology is susceptible to background interference, difficult to cope with environmental factors, and cannot effectively distinguish different anomalies, resulting in low computing efficiency and high possibility of false alarms.

Method used

By obtaining power line image data, a gradient response map is generated, the preliminary geometric outline of the power equipment is obtained, the line structure information is established, the target area of interest is delineated, local features are extracted, and defect area masks are generated.

Benefits of technology

Reduce background interference, improve processing efficiency and detection accuracy, enhance the ability to identify defect types, and improve the accuracy and robustness of defect detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120451189A_ABST
    Figure CN120451189A_ABST
Patent Text Reader

Abstract

The invention belongs to the field of image defect region segmentation, and discloses a power line image defect region segmentation method, system and device and a medium, and the method comprises the steps: obtaining power line image data, and analyzing the power line image data to obtain original image data; generating a gradient response diagram based on the original image data, obtaining a preliminary geometric contour of the power equipment, matching the preliminary geometric contour with a power equipment template, and establishing line structure information; based on the line structure information, selecting pixel coordinates of the power equipment, and delimiting a target attention area according to the pixel coordinates of the power equipment; and extracting local features of the target region of interest to obtain a preliminary defect segmentation map, and generating a defect region mask according to the preliminary defect segmentation map. According to the method, the target attention area is delimited, background interference is reduced, information is synthesized in the attention area to judge the defect mode, the defect area is segmented, the result is analyzed and optimized through the connected area, and the defect detection accuracy, robustness and defect type identification capability can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image defect area segmentation, and in particular to a method, system, device and medium for segmenting a power line image defect area. Background Art

[0002] The power line image defect region segmentation method is a specific application of the aforementioned image defect region segmentation technology in the field of power system inspection and maintenance. It specifically uses computer vision algorithms to analyze images of power lines and their ancillary equipment captured by drones, robots, or humans.

[0003] Existing power line image analysis technologies often waste analysis resources on irrelevant background areas. For example, complex background images adjacent to power lines, such as the texture of tree branches, can be misidentified as defects in line components. This not only reduces computational efficiency but also increases the likelihood of false positives. Furthermore, most existing technologies rely on feature analysis of single-frame static images, such as those based solely on the grayscale, color, or simple texture of a localized area. This approach struggles to effectively address environmental factors such as lighting changes and shadows, and it also struggles to distinguish between anomalies of varying nature. For example, it's impossible to distinguish between stable contamination on the surface of an insulator and transient corona discharge, as both can exhibit similar visual characteristics in a single-frame image. Therefore, improvements are needed. Summary of the Invention

[0004] In view of the above existing problems, the present invention is proposed.

[0005] Therefore, the present invention provides a method for segmenting defective areas in power line images to solve the problems that existing power line image analysis technologies are susceptible to background interference, have difficulty coping with environmental factors, and cannot effectively distinguish different anomalies.

[0006] To solve the above technical problems, the present invention provides the following technical solution: a method for segmenting defective areas of power line images, comprising the following steps: Acquiring power line image data, and analyzing the power line image data to obtain original image data; generating a gradient response map based on the original image data, obtaining a preliminary geometric outline of the power equipment, matching the preliminary geometric outline with a template of the power equipment, and establishing line structure information; Based on the line structure information, selecting pixel coordinates of the power equipment, and delineating a target area of interest according to the pixel coordinates of the power equipment; Extract local features of the target area of interest to obtain a preliminary defect segmentation map, and generate a defect area mask according to the preliminary defect segmentation map.

[0007] As a preferred solution of the method for segmenting defective areas of power line images described in the present invention, generating a gradient response map based on the original image data includes: Based on the original image data, using a difference operator to calculate the intensity difference between horizontally adjacent pixels and vertically adjacent pixels to obtain a horizontal difference component and a vertical difference component; The gradient amplitude is calculated according to the horizontal difference component and the vertical difference component, and the gradient direction is calculated using an inverse tangent function to generate a gradient response map.

[0008] As a preferred solution of the method for segmenting defective areas in power line images described in the present invention, obtaining a preliminary geometric outline of power equipment, matching the preliminary geometric outline with a template of the power equipment, and establishing line structure information includes: Based on the gradient response graph, a gradient amplitude lower limit is set to filter non-edge points, the remaining edge points are grouped to obtain optimal straight line parameters and curve equations, the power equipment positions are marked, and a preliminary geometric outline is obtained; According to the template image of the power equipment, the maximum position of the marker is calculated pixel by pixel within the preliminary geometric outline to establish the line structure information.

[0009] This preferred technical solution has the following beneficial effects: By setting a lower limit on the gradient amplitude to filter non-edge points, it effectively removes noise and non-critical information from the image, reducing the amount of data required for subsequent processing. Template matching is performed within the initial geometric contour, narrowing the search area and improving matching efficiency, enabling faster and more accurate generation of line structure information.

[0010] As a preferred solution of the method for segmenting defective areas of power line images described in the present invention, the method includes: selecting pixel coordinates of power equipment based on the line structure information, and delineating a target area of interest based on the pixel coordinates of the power equipment, including: According to the line structure information, the geometric position and shape data of the power equipment are obtained, a two-dimensional coordinate list of all pixel points constituting the shape boundary is extracted, and a component boundary coordinate set is obtained; Traverse the component boundary coordinate set, calculate the normal vector direction of each point, expand the preset pixel distance according to the normal vector direction to obtain new coordinates, connect the new coordinates into a polygon or a circumscribed rectangle, and define a region mask to delineate the target area of interest.

[0011] The beneficial effects of this preferred technical solution are: accurately determining the boundary range of power equipment, reducing the interference of background areas on subsequent defect detection, concentrating computing resources in key areas, improving processing efficiency and targeted detection, and making subsequent defect analysis more efficient and accurate.

[0012] As a preferred solution of the method for segmenting defective areas in power line images described in the present invention, extracting local features of the target area of interest to obtain a preliminary defect segmentation map includes: In the target area of interest, based on the line structure information, a neighborhood window is defined with each pixel as the center, and the average value of the gradient amplitude of all pixels in the window, the dispersion of the gradient direction, the energy and contrast value of the gray-level co-occurrence matrix, and the mean and variance of the gray value are calculated to obtain local feature statistics; Combined with local feature statistics and dynamically changing area indications, they are input into a preset decision logic or lookup table to determine the adaptive structural unit. The pixel values are updated according to the adaptive structural unit to obtain a preliminary defect segmentation map.

[0013] The beneficial effects of this preferred technical solution are: calculating a variety of local feature statistics in the target area of interest can comprehensively describe the characteristics of the pixels in the area and provide rich data for defect judgment; updating the pixel values based on the adaptive structural unit to obtain a preliminary defect segmentation map can improve the accuracy and precision of defect segmentation, making the preliminary segmentation result closer to the actual defect situation.

[0014] As a preferred solution of the method for segmenting defective areas of power line images described in the present invention, the dynamically changing area indication includes: Detecting corner points and patch areas with intensity changes in the neighborhood of pixels in each frame of the original image data, calculating a statistical descriptor vector of grayscale distribution or gradient direction around the detected area, and performing a nearest neighbor matching search in a set of consecutive frame descriptors to obtain inter-frame feature matching pairs; Based on the inter-frame feature matching pairs, inlier point matching pairs with consistent coordinate transformation relationships are selected, and an overdetermined set of equations is established using the coordinates of the inlier point pairs to obtain the optimal affine transformation or perspective transformation matrix parameters by solving them. The matrix transformation is applied to adjust the coordinates of all pixels in subsequent frames to obtain aligned pixel coordinates; Based on the aligned pixel coordinates and the registered original image data sequence, the pixel intensity values at the same aligned coordinate position in the two frames of image are accessed, the absolute value of the difference between the two is calculated, the difference is compared with a preset threshold, and all pixel positions where the difference exceeds the limit are marked to obtain an indication of the dynamically changing area.

[0015] As a preferred solution of the method for segmenting defective areas of power line images described in the present invention, generating a defective area mask according to the preliminary defect segmentation map includes: Convert the preliminary defect segmentation map into a binary image by setting a threshold, initialize the label map, sequentially scan the binary image pixels, assign a new label if an unlabeled foreground pixel is encountered, and push all adjacent foreground pixels into a stack or queue, and loop the process until the stack or queue is empty to obtain a labeled connected area; Traversing the label graph through the labeled connected area, using a counter to count the total number of pixels where each unique label appears, establishing a mapping between labels and pixel numbers, recording labels with pixel numbers below a preset area threshold, and setting the pixel values of the corresponding labels as background values, thereby obtaining a size-filtered connected area; Based on the size-filtered connected area, all foreground pixels adjacent to background pixels are detected as boundary points. Each boundary point is filtered by a mean or median filter kernel, and the original value is replaced by the average or median value of the neighboring pixel values to output a defect area mask.

[0016] Another object of the present invention is to provide a system for segmenting defective areas of power line images.

[0017] To solve the above technical problems, the present invention provides the following technical solutions: a power line image defect area segmentation system, comprising: a data acquisition module, configured to acquire power line image data, and analyze the power line image data to obtain original image data; a data processing module, configured to generate a gradient response map based on the raw image data, obtain a preliminary geometric outline of the power equipment, match the preliminary geometric outline with a template of the power equipment, and establish line structure information; based on the line structure information, select pixel coordinates of the power equipment, and delineate a target area of interest according to the pixel coordinates of the power equipment; The defect recognition module is used to extract local features of the target focus area to obtain a preliminary defect segmentation map, and generate a defect area mask according to the preliminary defect segmentation map.

[0018] The present invention provides a computer device comprising a memory and a processor, wherein the memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions. When the computer-executable instructions are executed by the processor, the steps of a method for segmenting defective areas of power line images are implemented.

[0019] In a fourth aspect, the present invention provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the steps of the method for segmenting defective areas of power line images.

[0020] Compared with the existing technology, the beneficial effects of the present invention are as follows: the present invention obtains power line image data, establishes line structure information, delineates target areas of interest to reduce background interference, identifies dynamically changing areas through inter-frame feature matching, determines defect patterns by integrating multiple information in the area of interest, segments defective areas, and optimizes the results through connected area analysis, which can improve the accuracy, robustness and ability to identify defect types of defect detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0022] Figure 1 The figure is a schematic diagram of the overall process of a method for segmenting defective areas in power line images according to an embodiment of the present invention. DETAILED DESCRIPTION

[0023] To make the above-mentioned objects, features, and advantages of the present invention more clearly understood, the following detailed description of the specific embodiments of the present invention is given in conjunction with the accompanying drawings. It is obvious that the described embodiments are only part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary persons in this field without creative work should fall within the scope of protection of the present invention.

[0024] Example 1, with reference to Figure 1 , as one embodiment of the present invention, provides a method for segmenting defective areas in a power line image, comprising: S100: Acquire power line image data, and analyze the power line image data to obtain original image data; S101: Generate a gradient response map based on the original image data, obtain a preliminary geometric outline of the power equipment, match the preliminary geometric outline with the power equipment template, and establish line structure information; S102: Based on the line structure information, select the pixel coordinates of the power equipment and define the target area of interest according to the pixel coordinates of the power equipment; S103: extracting local features of the target focus area to obtain a preliminary defect segmentation map, and generating a defect area mask according to the preliminary defect segmentation map.

[0025] It should be noted that after acquiring the power line image data, the present invention identifies and locates the power equipment and establishes the line structure information, laying the foundation for subsequent targeted analysis. Delineating the target area of interest can concentrate computing resources on the core area where potential defects occur, effectively reducing interference from background areas, and improving processing efficiency and detection directionality. Within the target area of interest, different types of defects can be segmented finely and accurately, and preliminary segmentation results can be obtained, which optimizes the regularity and reliability of the segmentation results. The defect area mask finally generated has higher accuracy and practical value, which improves the accuracy, robustness and identification of specific defect types of defect detection as a whole.

[0026] Example 2, reference Figure 1, which is an embodiment of the present invention, provides a method for segmenting defective areas of power line images based on the above embodiments.

[0027] In the embodiment of the present invention, the specific process of acquiring the power line image data in step S100 and parsing the power line image data to obtain the original image data includes: Acquire power line image data including power equipment such as insulators and conductors, specify the image file path or configure video capture device parameters through the file system interface, start the data reading operation instruction, receive the returned binary byte sequence data, and obtain the image input stream; Based on the image input stream, read the file header identifier at the beginning of the byte stream, compare it with the image format library to determine the encoding type, pixel depth, and image width and height, convert the byte stream into a pixel value array, and establish pixel matrix data; based on the pixel matrix data, create a two-dimensional array, fill it with pixel values in row and column order, and record the row and column indexes and corresponding intensity values of each element to obtain the original image data.

[0028] In an optional embodiment, when obtaining image data of power lines including insulators and conductors, the system file interface function can be called through the API. Use the CreateFile function in Windows system and the open system call in Linux system, pass in the image file path to obtain the file handle. If processing video streams, use the cv::VideoCapture class interface of OpenCV to configure parameters such as device ID, frame rate, resolution, and connect to the video source. Start the data reading instruction for the file or video stream. When reading a file, specify the number of bytes to read based on the preset buffer size (such as 4KB), and use the ReadFile or read function to loop and read to the end of the file; when reading a video stream, call the cv::VideoCapture::read() function to capture the frame data and store it in the buffer. The system or library function receives the returned raw binary byte sequence data, fills the buffer, and the data blocks constitute a complete image input stream.

[0029] In an optional embodiment, when processing data based on an image input stream, the file header identifier can be identified based on the starting byte of the first data block. Files such as JPEG, PNG, and BMP have their own specific starting byte sequence. By maintaining a predefined image format library hash table or dictionary structure and comparing the starting byte of the input stream with the key in the library, the image encoding type can be determined. After determining the encoding type, subsequent bytes are read from a specific offset according to the format specification to obtain metadata. For example, JPEG requires parsing the JFIF or EXIF segment, and PNG requires parsing the IHDR block. After obtaining the encoding type, pixel depth, and image width and height information, the corresponding decoding library, such as libjpeg, libpng, or OpenCV's built-in decoder, is called to process the remaining byte stream, converting the compressed data into raw pixel values and forming a data stream in raster scan order. Finally, according to the image width, height, and pixel depth, the pixel values are rearranged to construct the pixel matrix data.

[0030] In an optional embodiment, a matching two-dimensional array or three-dimensional array is declared or allocated in memory based on the width W and height H parsed from the image metadata, and the array element type must match the pixel depth. The pixel matrix data is traversed through a nested loop, and the pixel values at the corresponding positions are assigned to the new array. For grayscale images, one value is read each time; for RGB images, three values are read. During the assignment process, a record containing the row index, column index, and intensity value is created for each pixel. These records can be data structures parallel to the two-dimensional array, or the two-dimensional array elements can be designed as a composite type containing coordinates and intensity values, such as defining a PixelInfo structure.

[0031] In the embodiment of the present invention, step S101 generates a gradient response map based on the original image data, obtains a preliminary geometric outline of the power equipment, matches the preliminary geometric outline with the power equipment template, and establishes line structure information, further comprising sub-steps A1-A2: A1: Based on the original image data, the difference operator is used to calculate the intensity difference between horizontally adjacent pixels and vertically adjacent pixels to obtain the horizontal difference component and the vertical difference component. The gradient amplitude and the inverse tangent function are calculated based on the horizontal and vertical difference components to generate a gradient response map.

[0032] A2: Based on the gradient response map, set the gradient amplitude lower limit to filter non-edge points, group the remaining edge points to obtain the optimal line parameters and curve equations, mark the power equipment location, and obtain a preliminary geometric outline. Based on the power equipment template image, calculate the maximum value position of the mark pixel by pixel within the preliminary geometric outline to establish the line structure information.

[0033] In the embodiment of the present invention, obtaining the line structure information specifically includes: Based on the original image data, that is, a structured two-dimensional array containing the mapping relationship between pixel coordinates and intensity values, traverse each pixel in the array , apply a specific difference operator to it, for example, The Sobel operator contains two convolution kernels, the horizontal kernel and vertical kernel , and the two kernels are respectively combined with the pixel points Central Pixel intensity values within the neighborhood Perform convolution operation to calculate the intensity difference in the horizontal direction and the vertical intensity difference , where * represents the convolution operation, and the two difference components and Reflects the pixel The rate of change of image intensity in the horizontal and vertical directions; Based on these two orthogonal difference components, the gradient amplitude of the pixel is calculated. The gradient amplitude represents the total amount or significance of the intensity change at the point, and the gradient direction is calculated at the same time. Repeat this process for all pixels in the original image data, and finally obtain two new matrices of the same size as the original image, one storing the gradient amplitude of each pixel and the other storing the gradient direction of each pixel. , and the other stores the corresponding gradient direction , these two matrices together constitute the gradient response map.

[0034] Based on the gradient response map, especially the gradient amplitude , set a gradient amplitude lower limit threshold It is used to filter out pixels with insignificant intensity changes, which usually correspond to flat areas or noise in the image, and retain the gradient amplitude. The pixels are regarded as potential edge points.

[0035] In an optional embodiment, the threshold The setting method can use statistical analysis, such as calculating the entire gradient amplitude The histogram is then generated using the Otsu algorithm to automatically calculate an optimal threshold that can classify pixels into edge and non-edge categories.

[0036] In another optional embodiment, based on empirical settings, for 8-bit grayscale images, a fixed threshold is set by observing the gradient amplitude range of typical edges in a large number of power line image samples, such as , set all gradient magnitudes below The pixel points are marked as non-edge points and do not participate in subsequent processing.

[0037] The parameter space cumulative peak detection method is used for the edge point set. The Hough transform is used to fit the straight line, and the generalized Hough transform or random sample consistency algorithm is used to fit the curve. By analyzing the spatial position, direction, length and other characteristics of the fitted straight line and curve, combined with the general structural prior knowledge of the power line, it is marked which geometric structures correspond to the conductors and which correspond to the towers, and the preliminary geometric outline is obtained.

[0038] Based on the original image data and preliminary geometric contours, grayscale or binary pattern images for identifying insulators and fittings are loaded from a preset template library, and the preliminary geometric contour information is used to limit the search range of template matching; For example, the insulator template is searched in the area near the identified tower outline, and the fitting template is searched near the end of the insulator template matching position or the end point of the conductor outline. This limitation avoids time-consuming global search on the entire image. Within the limited search range, for each template to be matched, , sliding template window, in the original image data Move pixel by pixel to calculate the current image sub-region With template The similarity between them is quantified by normalized cross-correlation, which is calculated as follows: , in, is the current image sub-region With template The similarity between is the coordinate of the upper left corner of the image sub-region, is the pixel index within the template, is the average grayscale of the image subregion, is the average grayscale of the template, and the calculated NCC value range is The closer the value is to 1, the higher the matching degree is.

[0039] In an optional implementation, the sum of squared differences (SSD) may also be used for calculation: , in, is the coordinate of the upper left corner of the image sub-region, is the pixel index within the template.

[0040] like , then it is considered that at position The power equipment corresponding to the template is successfully matched, and the type and location coordinates of the component are recorded. This process is repeated for all pre-stored insulator and hardware templates, and the type and location information of all successfully matched components are summarized to establish the line structure information.

[0041] It should be noted that the present invention calculates pixel gradient responses to generate gradient response maps, which can highlight areas in the image where pixel intensity changes significantly, effectively capture potential edge information, and provide a basis for the subsequent identification of the contours of power line components. Setting a lower limit for the gradient amplitude to filter non-edge points reduces noise and interference from irrelevant information, and improves the accuracy of edge extraction; grouping the remaining edge points and fitting straight line and curve equations, accurately marking the positions of conductors and towers, and preliminarily constructing the geometric framework of the power line. Template matching is performed within the limited range of the preliminary geometric contour, which narrows the search space and improves matching efficiency. Calculating similarity pixel by pixel and marking the maximum value position can accurately identify the position of insulators and hardware, thereby comprehensively and accurately establishing line structure information, providing a reliable basis for subsequent targeted defect detection and analysis, and enhancing the accuracy and reliability of the entire power line image analysis system.

[0042] In the embodiment of the present invention, step S102 selects the pixel coordinates of the power equipment based on the line structure information, and defines the target area of interest according to the pixel coordinates of the power equipment, further comprising sub-steps B1-B2: B1: Based on the line structure information, the geometric position and shape data of the power equipment are obtained, the two-dimensional coordinate list of all the pixel points that constitute the shape boundary is extracted, and the component boundary coordinate set is obtained; B2: Traverse the component boundary coordinate set, calculate the normal vector direction of each point, expand the preset pixel distance according to the normal vector direction to obtain new coordinates, connect the new coordinates into a polygon or circumscribed rectangle, and define a region mask to delineate the target area of interest.

[0043] Specifically, based on the line structure information, for each identified component, an accurate boundary description is extracted. If the component is identified by template matching, its boundary can be obtained by translating the non-background pixel outline of the matched template image according to the matching position. If the component is a wire or a tower, its boundary is determined by the fitted straight line or curve equation. By sampling or calculating the analytical boundary at a certain step size on the curve, the two-dimensional coordinates of all pixel points that constitute the outer boundary of the component shape are obtained. , collect the boundary pixel coordinates extracted from each component into a list or array; For example, an insulator string may correspond to a coordinate system containing hundreds of boundary points. All of these lists are aggregated together to obtain the set of widget bounds coordinates.

[0044] In an optional embodiment, based on the component boundary coordinate set, the coordinate list of each component is processed and each boundary point in the list is traversed. , calculation point The local boundary normal vector at ; First determine the adjacent points before and after the point on the boundary and , calculate the tangent vector approximation , and then the tangent vector Rotate 90 degrees to get the normal vector or Select the direction pointing to the outside of the component as the correct normal vector direction, and then adjust the normal vector Normalize and get the unit normal vector ,in is the modulus of the normal vector, along the unit normal vector Direction, the original boundary point Coordinate values of Add a preset pixel distance value , calculate the new coordinate point, where the preset pixel distance value Is a positive integer representing the width of the outward-extending border for all points in the widget's border coordinate list. This offset calculation is performed on all the nodes to form a new list of coordinate points and obtain the extended boundary coordinates. Based on the extended boundary coordinates, the new coordinate list corresponding to each power device is processed and the points in the list are connected in the order they are on the original boundary to generate a closed polygonal outline. This new polygon surrounds the original component and a width of approximately The area of pixels is used to define the target area of interest.

[0045] In another optional embodiment, directly calculate the coordinate points of all extended boundaries The minimum enclosing rectangle of the target area is used as the boundary of the target area. Regardless of whether the generated polygonal outline or the enclosing rectangular boundary is used, the next step is to define the area mask consisting of all pixels surrounded by this boundary. For the polygonal outline, a standard graphics filling algorithm is used to create a binary mask image with the same size as the original image. All pixel positions marked as internal are set to 1, and other pixel positions are set to 0. This binary mask image clearly identifies the pixel area that needs to be analyzed in detail later and defines the target area of interest.

[0046] It should be noted that the component boundary coordinate set is obtained based on the line structure information, and the boundary range of each component is accurately determined, providing accurate basic data for subsequent processing. The coordinates are traversed to calculate the normal vector direction and expand the preset pixel distance, fully considering the areas around the components where defects may occur to avoid missing potential defect locations. The extended boundary coordinates are connected to generate polygonal contours or calculate the circumscribed rectangular boundaries, and then the regional mask is defined to delineate the target area of interest, so that subsequent image analysis computing resources can be concentrated in these key areas, reducing interference from background areas and improving processing efficiency. At the same time, focusing on potential defect areas enhances the pertinence and accuracy of power line component defect detection, which helps to identify and analyze defects more quickly and accurately.

[0047] In the embodiment of the present invention, step S103 extracts local features of the target area of interest to obtain a preliminary defect segmentation map, and generates a defect area mask based on the preliminary defect segmentation map, further comprising sub-steps C1-C6: C1: Detect corner points and patch areas with intensity changes within the pixel neighborhood in each frame of the original image data, calculate the statistical descriptor vector of grayscale distribution or gradient direction around the detected area, perform nearest neighbor matching search in the continuous frame descriptor set, and obtain inter-frame feature matching pairs; C2: Based on the inter-frame feature matching pairs, select the inlier point matching pairs with consistent coordinate transformation relationships. Use the coordinates of the inlier point pairs to establish an overdetermined system of equations, solve them to obtain the optimal affine transformation or perspective transformation matrix parameters, and apply the matrix transformation to adjust the coordinates of all pixels in subsequent frames to obtain aligned pixel coordinates. C3: Based on the aligned pixel coordinates and the registered original image data sequence, access the pixel intensity values at the same aligned coordinate position in the two frames of the image, calculate the absolute value of the difference between the two, compare the difference with the preset threshold, mark all pixel positions where the difference exceeds the limit, and obtain an indication of the dynamically changing area.

[0048] C4: Within the target area of interest, based on the line structure information, a neighborhood window is defined with each pixel as the center. The average gradient amplitude of all pixels in the window, the discreteness of the gradient direction, the energy and contrast value of the grayscale co-occurrence matrix, and the mean and variance of the grayscale value are calculated to obtain local feature statistics. The local feature statistics are combined with the dynamic change area indication and input into the preset decision logic or lookup table to determine the adaptive structural unit. The pixel value is updated based on the adaptive structural unit to obtain a preliminary defect segmentation map.

[0049] C5: Convert the preliminary defect segmentation map into a binary image by setting a threshold, initialize the label map, and sequentially scan the binary image pixels. If an unlabeled foreground pixel is encountered, a new label is assigned and all adjacent foreground pixels are pushed into a stack or queue. This process is repeated until the stack or queue is empty to obtain a labeled connected area. The label map is traversed through the labeled connected area, and a counter is used to count the total number of pixels where each unique label appears. A mapping between the label and the number of pixels is established. Labels with pixel counts below a preset area threshold are recorded, and the pixel values of the corresponding labels are set to the background value to obtain the size-filtered connected area. C6: Based on the connected area after size filtering, all foreground pixels adjacent to background pixels are detected as boundary points. Each boundary point is filtered by a mean or median filter kernel, and the original value is replaced by the average or median value of the neighboring pixel values to output the defect area mask. In the embodiment of the present invention, the steps for obtaining the preliminary defect segmentation map are: In the target area of interest, a pixel is defined based on the line structure information. Neighborhood window, calculate the average value of the gradient amplitude of all pixels in the window, the discreteness of the gradient direction, the energy and contrast value of the gray-level co-occurrence matrix, and the mean and variance of the gray value to obtain local feature statistics; Based on local feature statistics and dynamic change area indications, the statistical value and change indication mark are input into the preset decision logic or lookup table, and the corresponding structural unit type is output. If a slender high-contrast area is detected, a linear unit is selected; if a flaky texture change area is detected, a square unit is selected. The length or side length is determined to obtain an adaptive structural unit; Based on the adaptive structural unit, at each pixel in the target area of interest, the neighborhood range is determined according to the selected unit shape and size, the intensity values of all pixels in the neighborhood are read, the maximum value is selected for dilation or the minimum value is selected for erosion, the center pixel value is updated, and the preliminary defect segmentation map is obtained.

[0050] Specifically, within the target focus area, based on the previously established line structure information, each pixel in the target focus area is Perform local feature extraction; Define a The square neighborhood window centered on is ,in is a positive odd number, for example, The selection of this size is based on the relationship between the typical scale of the texture or defect you want to capture and the image resolution. By evaluating the effect of extracting features on the sample image at different sizes, the arithmetic mean of the gradient amplitudes of all pixels in the window is calculated using the gradient response map calculated previously. , calculate the discreteness of the gradient direction, for example, using the variance of the gradient direction vector or calculating the entropy of the gradient direction histogram; In an optional embodiment, the average vector of the direction vector in the window is calculated , then calculate the discreteness based on the original grayscale value within the window , calculate the gray level co-occurrence matrix; based on Calculate the texture features, and finally calculate the statistics of the original grayscale value in the window, including the mean and variance, and combine these calculated eigenvalues into a eigenvector, which is then compared with the pixel point Association, repeat this process for all pixels in the target area of interest to obtain local feature statistics.

[0051] Based on local feature statistics and dynamic change area indication, each pixel in the target area of interest is , its feature vector and the corresponding dynamic change indicator As input, it is fed into a preset decision logic or lookup table; In an optional embodiment, the decision logic or lookup table is established based on prior knowledge of common defect patterns of power lines and analysis of image features. Rules can be formulated by domain experts or learned through machine learning methods from sample data labeled with defect types and corresponding structural units.

[0052] This decision process is performed on each pixel in the target region of interest, resulting in a map where each pixel position stores the type, size, and orientation of the structure unit selected for it, resulting in an adaptive structure unit.

[0053] Based on the adaptive structural unit graph, each pixel in the target area of interest For example, if the decision logic determines that the current pixel needs to be processed with a linear structure unit and the goal is to extract cracks that are brighter than the background, the dilation operation is selected, according to The specified length and direction of the linear element determine the The neighborhood range centered on is , which includes the center point and points extending 2 pixels along the 45-degree and 225-degree directions, for a total of 5 pixels: , read the intensity values of these 5 pixels in the original image data (or preprocessed image, such as grayscale image), and select the maximum value of these intensity values , and this maximum value As the output image If the pixel value at the position is determined to be processed with a square structure unit (possibly corresponding to rust detection), and the goal is to extract rust that is darker than the background (for example, the rust color is darker), then the corrosion operation is selected. The specified square unit side length, for example 3 pixels, determines the Central Neighborhood range, read the intensity values of these 9 pixels, and select the minimum value among these intensity values , and this minimum value As the output image The pixel value of the position, for all pixels within the ROI According to their corresponding adaptive structural units and preset morphological operations (dilation or erosion, depending on whether the target to be extracted is a bright feature or a dark feature, which is usually determined when designing the decision logic), the maximum or minimum value in the neighborhood is calculated, and the pixel value at the corresponding position of the output image is updated. After traversing all pixels in the ROI, the generated output image is the preliminary defect segmentation map.

[0054] In the embodiment of the present invention, the steps of obtaining the defect area mask are: Set a threshold on the preliminary defect segmentation map and convert it into a binary image. Initialize the label map and sequentially scan the binary image pixels. If an unlabeled foreground pixel is encountered, assign a new label and push all adjacent foreground pixels into a stack or queue. Repeat the process until the stack or queue is empty to obtain a labeled connected area. Based on the labeled connected area, the label graph is traversed, and the total number of pixels where each unique label appears is counted using a counter. A mapping between labels and pixel numbers is established, and labels with pixel numbers below a preset area threshold are recorded. The pixel values of the corresponding labels are set as background values to obtain the connected area after size filtering. Based on the connected area after size filtering, all foreground pixels adjacent to background pixels are detected as boundary points. A 3x3 or 5x5 mean or median filter kernel is applied to each boundary point, and the original value is replaced by the average or median value of the neighborhood pixel value to output the defect area mask.

[0055] Specifically, for the preliminary defect segmentation map, a global or local adaptive threshold is set to convert it into a binary image, a label map with the same size as the binary image and all elements are 0 is initialized, and a label counter current_label=1 is initialized. Then, each pixel of the binary image is traversed in raster scanning order. , if the current pixel If it is a foreground pixel and the value of its corresponding position in the label map is 0, it means that it has not been marked yet. Then, a connected area marking process is started, the label counter current_label is increased by 1, and then the next unprocessed pixel of the binary image is scanned. After traversing all pixels, each independent connected foreground area on the label map is assigned a unique positive integer label, and a labeled connected area is obtained.

[0056] Based on the labeled connected area, it is necessary to count the size of each connected area and filter out the areas that are too small. First, create a counter data structure to store the number of pixels corresponding to each label, such as a hash map, where the key is the label value and the value is the number of times the label appears. Then, traverse every pixel of the entire label map again. , read its tag value ,if , then find the key in the hash map The entry and its corresponding value plus 1, if the key If it does not exist, create a new entry in the map , and initialize the value to 1. After the traversal is completed, the hash map stores the unique label of each connected area and the total number of pixels corresponding to it; set a preset area threshold ,This threshold is used to remove connected regions that are too small and are likely to be generated by noise or image artifacts.

[0057] After filtering connected areas based on size, identify the boundary pixels of these retained areas, traverse the filtered image, and for each foreground pixel, that is, the value is 1 or the label > 0, check the pixels in its 4-neighborhood or 8-neighborhood. If at least one neighbor of the foreground pixel is a background pixel, the foreground pixel is judged to be a boundary point, and collect the coordinate list of all such boundary points; Apply smoothing filtering to these detected boundary points to reduce the boundary jagged effect introduced by pixelation or previous steps. You can choose to apply or filter kernel, and mean filtering or median filtering methods.

[0058] In an optional factual approach, if you choose The median filter is a filter that creates a copy of the connected area after size filtering as the output mask image, and traverses each point in the list of boundary point coordinates collected before. , define a The neighborhood window is used to read the values of the 9 pixels in the connected area image after size filtering in the window, sort the 9 values, select the median value after sorting, and then add the corresponding value in the output mask image. The pixel value at the position is updated to the calculated median value. This operation is only performed on the boundary points, and the pixel values inside the area remain unchanged. After processing all boundary points, the output mask image is the final defect area mask, whose boundaries are relatively smooth, and the internal area maintains the connectivity after filtering, and the defect area mask is output.

[0059] It should be noted that by detecting corner points and patch areas and performing feature matching, we can find the correspondence between frames, align pixels through coordinate transformation, calculate intensity differences to mark dynamically changing areas, and provide a basis for distinguishing defects from interference. In the target area of interest, multiple local features are calculated, and adaptive structural units are determined in combination with dynamic change indicators to obtain a preliminary defect segmentation map, which can accurately identify different types of defects. The preliminary segmentation map is binarized, connected areas are marked, and size filtering is performed to remove small noise areas. The boundary points are then filtered and smoothed. The generated defect area mask has more regular boundaries, effectively reducing misjudgments, improving the accuracy of defect detection, and providing support for the maintenance and inspection of power lines.

[0060] In Example 3, the above is a schematic diagram of a method for segmenting defective areas in power line images. It should be noted that the technical solution of this system for segmenting defective areas in power line images and the technical solution of the aforementioned method for segmenting defective areas in power line images share the same concept. For details not described in detail in the technical solution of the system for segmenting defective areas in power line images in this embodiment, please refer to the description of the technical solution of the aforementioned method for segmenting defective areas in power line images.

[0061] This embodiment further provides a power line image defect area segmentation system, comprising: A data acquisition module is used to acquire power line image data and analyze the power line image data to obtain original image data; A data processing module is used to generate a gradient response map based on the original image data, obtain the preliminary geometric outline of the power equipment, match the preliminary geometric outline with the power equipment template, and establish line structure information; based on the line structure information, select the pixel coordinates of the power equipment and delineate the target area of interest based on the pixel coordinates of the power equipment; The defect recognition module is used to extract local features of the target area of interest to obtain a preliminary defect segmentation map, and generate a defect area mask based on the preliminary defect segmentation map.

[0062] This embodiment also provides an electronic device suitable for segmenting defective areas in power line images, comprising: a memory and a processor; the memory is used to store computer-executable instructions, and the processor is used to execute computer-executable instructions to implement the method for segmenting defective areas in power line images proposed in the above embodiment.

[0063] This embodiment further provides a storage medium storing a computer program, which, when executed by a processor, implements the method for segmenting defective areas of power line images proposed in the above embodiment.

[0064] The storage medium proposed in this embodiment and the method for implementing power line image defect area segmentation proposed in the above embodiment belong to the same inventive concept. Technical details not fully described in this embodiment can be referred to the above embodiment, and this embodiment has the same beneficial effects as the above embodiment.

[0065] Through the above description of the embodiments, those skilled in the art will clearly understand that the present invention can be implemented using software and necessary general-purpose hardware, and of course, can also be implemented using hardware. Based on this understanding, the technical solution of the present invention, or the portion that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory (FLASH), hard disk, or optical disk, and includes a number of instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods of various embodiments of the present invention.

[0066] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.

Claims

1. A method for segmenting defective areas of power line images, characterized in that: include: Acquiring power line image data, and analyzing the power line image data to obtain original image data; generating a gradient response map based on the original image data, obtaining a preliminary geometric outline of the power equipment, matching the preliminary geometric outline with a template of the power equipment, and establishing line structure information; Based on the line structure information, selecting pixel coordinates of the power equipment, and delineating a target area of interest according to the pixel coordinates of the power equipment; Extract local features of the target area of interest to obtain a preliminary defect segmentation map, and generate a defect area mask according to the preliminary defect segmentation map.

2. The method for segmenting defective areas of power line images according to claim 1, wherein: Generating a gradient response map based on the original image data includes: Based on the original image data, using a difference operator to calculate the intensity difference between horizontally adjacent pixels and vertically adjacent pixels to obtain a horizontal difference component and a vertical difference component; The gradient amplitude is calculated according to the horizontal difference component and the vertical difference component, and the gradient direction is calculated using an inverse tangent function to generate a gradient response map.

3. The method for segmenting defective areas of power line images according to claim 2, wherein: Obtain the preliminary geometric outline of the power equipment, match the preliminary geometric outline with the power equipment template, and establish line structure information, including: Based on the gradient response graph, a gradient amplitude lower limit is set to filter non-edge points, the remaining edge points are grouped to obtain optimal straight line parameters and curve equations, the power equipment positions are marked, and a preliminary geometric outline is obtained; According to the template image of the power equipment, the maximum position of the marker is calculated pixel by pixel within the preliminary geometric outline to establish the line structure information.

4. The method for segmenting defective areas of power line images according to claim 3, wherein: Based on the line structure information, pixel coordinates of the power equipment are selected, and a target area of interest is defined according to the pixel coordinates of the power equipment, including: According to the line structure information, the geometric position and shape data of the power equipment are obtained, a two-dimensional coordinate list of all pixel points constituting the shape boundary is extracted, and a component boundary coordinate set is obtained; Traverse the component boundary coordinate set, calculate the normal vector direction of each point, expand the preset pixel distance according to the normal vector direction to obtain new coordinates, connect the new coordinates into a polygon or a circumscribed rectangle, and define a region mask to delineate the target area of interest.

5. The method for segmenting defective areas of power line images according to claim 4, wherein: Extracting local features of the target area of interest to obtain a preliminary defect segmentation map includes: In the target area of interest, based on the line structure information, a neighborhood window is defined with each pixel as the center, and the average value of the gradient amplitude of all pixels in the window, the dispersion of the gradient direction, the energy and contrast value of the gray-level co-occurrence matrix, and the mean and variance of the gray value are calculated to obtain local feature statistics; Combined with local feature statistics and dynamically changing area indications, they are input into a preset decision logic or lookup table to determine the adaptive structural unit. The pixel values are updated according to the adaptive structural unit to obtain a preliminary defect segmentation map.

6. The method for segmenting defective areas of power line images according to claim 5, characterized in that: Dynamically changing area indications include: Detecting corner points and patch areas with intensity changes in the neighborhood of pixels in each frame of the original image data, calculating a statistical descriptor vector of grayscale distribution or gradient direction around the detected area, and performing a nearest neighbor matching search in a set of consecutive frame descriptors to obtain inter-frame feature matching pairs; Based on the inter-frame feature matching pairs, inlier point matching pairs with consistent coordinate transformation relationships are selected, and an overdetermined set of equations is established using the coordinates of the inlier point pairs to obtain the optimal affine transformation or perspective transformation matrix parameters by solving them. The matrix transformation is applied to adjust the coordinates of all pixels in subsequent frames to obtain aligned pixel coordinates; Based on the aligned pixel coordinates and the registered original image data sequence, the pixel intensity values at the same aligned coordinate position in the two frames of image are accessed, the absolute value of the difference between the two is calculated, the difference is compared with a preset threshold, and all pixel positions where the difference exceeds the limit are marked to obtain an indication of the dynamically changing area.

7. The method for segmenting defective areas of power line images according to claim 5, wherein: Generating a defect area mask according to the preliminary defect segmentation map includes: Convert the preliminary defect segmentation map into a binary image by setting a threshold, initialize the label map, sequentially scan the binary image pixels, assign a new label if an unlabeled foreground pixel is encountered, and push all adjacent foreground pixels into a stack or queue, and loop the process until the stack or queue is empty to obtain a labeled connected area; Traversing the label graph through the labeled connected area, using a counter to count the total number of pixels where each unique label appears, establishing a mapping between labels and pixel numbers, recording labels with pixel numbers below a preset area threshold, and setting the pixel values of the corresponding labels as background values, thereby obtaining a size-filtered connected area; Based on the size-filtered connected area, all foreground pixels adjacent to background pixels are detected as boundary points. Each boundary point is filtered by a mean or median filter kernel, and the original value is replaced by the average or median value of the neighboring pixel values to output a defect area mask.

8. A power line image defect area segmentation system, applying a power line image defect area segmentation method according to any one of claims 1 to 7, characterized in that: include: A data acquisition module, configured to acquire power line image data and analyze the power line image data to obtain original image data; a data processing module, configured to generate a gradient response map based on the original image data, obtain a preliminary geometric profile of the power equipment, match the preliminary geometric profile with a template of the power equipment, and establish line structure information; Based on the line structure information, selecting pixel coordinates of the power equipment, and delineating a target area of interest according to the pixel coordinates of the power equipment; The defect recognition module is used to extract local features of the target focus area to obtain a preliminary defect segmentation map, and generate a defect area mask according to the preliminary defect segmentation map.

9. A computer device, characterized in that: The invention comprises a memory and a processor, wherein the memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions. When the computer-executable instructions are executed by the processor, the steps of the method for segmenting defective areas of power line images as described in any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium, characterized in that It stores computer-executable instructions, which, when executed by a processor, implement the steps of a method for segmenting defective areas of power line images as claimed in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Method for defect detection of an object

    CN114331961A

  • Tower point cloud template matching method and system

    CN116129156A

  • Intelligent detection method, system and device for circuit board

    CN117392110A

  • Power transmission line discharge detection method, device, equipment, storage medium and product

    CN119379612A

  • Intelligent visual inspection and weighing device and method

    CN120147252A

Cited By

  • Multi-region recognition method, device and equipment for endoscope image and storage medium

    CN120976923A

  • Image enhancement processing method and system for submarine cable inspection

    CN121032880A

  • Image processing method, electronic equipment and storage medium

    CN121353694A

  • Image processing method, electronic device, and storage medium

    CN121353694B

  • Complex line alignment matching method, device and equipment and readable storage medium

    CN121685377A