Telegraph pole crack image rapid detection method and device based on opencv

Through the fast detection method of telescopic pole crack images based on opencv, data is collected using cameras and infrared detectors, image preprocessing and edge detection are solved, and the problems of slow detection speed and poor accuracy in the existing telescopic pole crack detection methods are achieved, and fast and accurate crack recognition is achieved.

CN119887611AActive Publication Date: 2025-04-25XIAN TECH UNIV
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202411646035.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-18
Publication Date
2025-04-25
Estimated Expiration
2044-11-18

AI Technical Summary

Technical Problem

The existing telephoto crack detection methods have slow detection speed and poor detection accuracy.

Method used

The opencv-based telephoto pole crack image detection method is used to collect data through the camera and infrared detector, image preprocessing, filtering and edge detection are performed, and cracks on telephoto poles are identified using an adaptive dual threshold detection algorithm.

Benefits of technology

It realizes rapid and accurate identification of pole cracks, improves detection efficiency and accuracy, and is suitable for real-time identification under complex situations and traditional cumbersome steps.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119887611A_ABST
    Figure CN119887611A_ABST
Patent Text Reader

Abstract

The invention discloses a telegraph pole crack image rapid detection method and device based on opencv, and belongs to the field of image processing technology and target tracking, the telegraph pole crack image rapid detection method based on opencv comprises the following steps: controlling a camera to shoot the outer surface of a telegraph pole, and using an infrared detector to detect the shooting area of the camera; acquiring data of the camera and the infrared detector, and extracting an image shot by the camera when the infrared detector detects a crack signal; the method comprises the following steps: preprocessing an image to obtain a binary image, creating a filtering template according to the binary image, adjusting a first weight of median filtering and a second weight of mean filtering, and filtering the image by using the filtering template according to the first weight and the second weight to obtain a grayscale image, and performing edge detection on the grayscale image to obtain an edge image of the crack on the telegraph pole. The method is applied to identification of cracks in daily maintenance and detection of telegraph poles in power related industries.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of image processing technology and target tracking, and in particular relates to a method and a device for quickly detecting crack images of electric poles based on OpenCV. Background Art

[0002] As the name implies, electric poles are poles for electric wires. They are one of the important infrastructures in my country and ensure the safety of electricity use for Chinese residents. Sometimes, cracks may appear on electric poles due to inadequate production technology, climate and environmental factors, and irregular post-construction operations.

[0003] In order to solve the crack problem in the production process of electric poles and in the later use environment, the existing technology usually adopts manual detection and ultrasonic detection, which has low detection efficiency and low detection accuracy. Summary of the invention

[0004] The purpose of the present invention is to provide a method and device for rapid detection of crack images of electric poles based on OpenCV, which is used to effectively identify the collected crack images of electric poles in real time, and solve the problems of slow detection speed and poor detection accuracy in existing electric pole crack detection.

[0005] In order to achieve the above object, the present invention provides the following technical solutions: A method for rapid detection of crack images of electric poles based on OpenCV, comprising: Control the camera to shoot the outer surface of the utility pole, and use the infrared detector to detect the shooting area of ​​the camera; Acquire the data of the camera and the infrared detector, and extract the image taken by the camera when the infrared detector detects the crack signal; After preprocessing the image, a binary image is obtained, and a filter template is created based on the binary image. According to the first average value of all point variances in the filter template, the first weight of the median filter and the second weight of the mean filter are adjusted. According to the first weight and the second weight, the filter template is used to filter the image to obtain a grayscale image, wherein the first average value is , the first weight is , the second weight is 1- , is the first preset weight, is the second preset weight, is the grayscale mean of the filter template, is the grayscale median of the filter template, when hour: when hour: ; After edge detection of the grayscale image, the edge image of the cracks on the utility pole is obtained.

[0006] The step of obtaining an edge image of a crack on a utility pole after edge detection of the grayscale image specifically includes: Calculate the gradient and amplitude of the grayscale image, and divide the grayscale image pixels after non-maximum suppression into a first pixel set, a second pixel set, and a third pixel set, wherein the first pixel set is a gradient set of non-boundary points of the crack in the grayscale image, the second pixel set is a gradient set of weak boundary points of the crack in the grayscale image, and the third pixel set is a gradient set of strong edges of the crack in the grayscale image; Calculating the gradient values ​​of the first pixel set, the second pixel set, and the third pixel set respectively to obtain the maximum inter-class variance; Using the maximum inter-class variance gradient value of the first pixel set and the maximum inter-class variance gradient value of the third pixel set to replace the high threshold and the low threshold in the double threshold detection; The double threshold check of the grayscale image after non-maximum suppression is completed using the replaced high threshold and low threshold to obtain the edge image of the cracks on the utility pole.

[0007] When the double threshold check of the grayscale image after non-maximum suppression is completed using the replaced high threshold and low threshold, when the gradient modulus is higher than the high threshold, it is considered to be an edge and retained; when the gradient modulus is lower than the low threshold, it is considered to be noise and discarded; when the gradient modulus is between the maximum and minimum values, if it is connected to the boundary, it is retained, otherwise it is discarded.

[0008] The gradient values ​​of the first pixel set, the second pixel set, and the third pixel set are calculated respectively to obtain the maximum inter-class variance: Let the total number of pixels of the crack image be , where the gradient The corresponding number of pixels is , the first pixel set is , the second pixel set is , the third pixel set is , then the gradient value Probability for: right , and The three parts are used to calculate the expectation , and : The inter-class variance is calculated based on the maximum inter-class variance: After continuously iterating the gradient values ​​in the first pixel set, the second pixel set, and the third pixel set, the maximum inter-class variances of the first pixel set, the second pixel set, and the third pixel set are obtained respectively.

[0009] The step of creating a filter template according to the binary image specifically comprises: The first-order derivatives of the binary image are approximately calculated in the horizontal and vertical directions to obtain a filtering template.

[0010] A rapid detection device for crack images of electric poles based on OpenCV, comprising: The command issuing unit is used to control the camera to shoot the outer surface of the electric pole, and use the infrared detector to detect the shooting area of ​​the camera; A data acquisition unit, used to obtain data from the camera and the infrared detector, and extract the image taken by the camera when the infrared detector detects a crack signal; A preprocessing unit, used for preprocessing the image to obtain a binary image, and creating a filtering template according to the binary image; The improved filtering unit is used to adjust the first weight of the median filter and the second weight of the mean filter according to the first average value of all point variances in the filtering template, and filter the image using the filtering template according to the first weight and the second weight to obtain a grayscale image, wherein the first average value is , the first weight is , the second weight is 1- , is the first preset weight, is the second preset weight, is the grayscale mean of the filter template, is the grayscale median of the filter template, when hour: when hour: ; The edge detection unit is used to obtain the edge image of the crack on the utility pole after detecting the edge of the grayscale image.

[0011] The edge detection unit specifically includes: An adaptive edge detection unit, used to calculate the gradient and amplitude of the grayscale image, and divide the grayscale image pixels after non-maximum suppression into a first pixel set, a second pixel set and a third pixel set, wherein the first pixel set is a gradient set of non-boundary points of the crack in the grayscale image, the second pixel set is a gradient set of weak boundary points of the crack in the grayscale image, and the third pixel set is a gradient set of strong edges of the crack in the grayscale image; Calculating the gradient values ​​of the first pixel set, the second pixel set, and the third pixel set respectively to obtain the maximum inter-class variance; Using the maximum inter-class variance gradient value of the first pixel set and the maximum inter-class variance gradient value of the third pixel set to replace the high threshold and the low threshold in the double threshold detection; The double threshold check of the grayscale image after non-maximum suppression is completed using the replaced high threshold and low threshold to obtain the edge image of the cracks on the utility pole.

[0012] In the adaptive edge detection unit, when the double threshold check of the grayscale image after non-maximum suppression is completed using the replaced high threshold and low threshold, when the modulus of the gradient is higher than the high threshold, it is considered to be an edge and retained; when the modulus of the gradient is lower than the low threshold, it is considered to be noise and discarded; when the modulus of the gradient is between the maximum value and the minimum value, if it is connected to the boundary, it is retained, otherwise it is discarded.

[0013] The adaptive edge detection unit calculates the gradient values ​​of the first pixel set, the second pixel set and the third pixel set respectively to obtain the maximum inter-class variance: Let the total number of pixels of the crack image be , where the gradient The corresponding number of pixels is , the first pixel set is , the second pixel set is , the third pixel set is , then the gradient value Probability for: right , and The three parts are used to calculate the expectation , and : The inter-class variance is calculated based on the maximum inter-class variance: After continuously iterating the gradient values ​​in the first pixel set, the second pixel set, and the third pixel set, the maximum inter-class variances of the first pixel set, the second pixel set, and the third pixel set are obtained respectively.

[0014] The step of creating a filter template according to the binary image specifically comprises: The first-order derivatives of the binary image are approximately calculated in the horizontal and vertical directions to obtain a filtering template.

[0015] Compared with the prior art, the method for rapid detection of cracks in electric poles based on OpenCV provided by the present invention uses cracks in electric poles as target detection in image processing, and applies the target detection algorithm based on OpenCV to crack detection in electric poles. The detection method only needs to input images or video frames, and can quickly and accurately locate and identify cracks in electric poles in images and obtain the width of cracks, with a high accuracy rate. It can better achieve real-time target recognition and low-power operation under complex situations and traditional cumbersome steps, and is applied to the recognition of cracks in daily maintenance and detection of electric poles in power-related industries.

[0016] The present invention also provides an OpenCV-based rapid detection device for crack images of electric poles, comprising an instruction issuing unit for controlling a camera to shoot the outer surface of the electric pole, and using an infrared detector to detect the shooting area of ​​the camera; A data acquisition unit, used to obtain data from the camera and the infrared detector, and extract the image taken by the camera when the infrared detector detects a crack signal; A preprocessing unit, used for obtaining a binary image after preprocessing the image, and creating a filtering template according to the binary image; The improved filtering unit is used to adjust the first weight of the median filter and the second weight of the mean filter according to the first average value of the variance of all points in the filtering template, wherein the first average value is , the first weight is , the second weight is 1- , is the first preset weight, is the second preset weight, is the grayscale mean of the filter template, is the grayscale median of the filter template, when hour: when hour: ; According to the first weight and the second weight, the image is filtered using a filter template to obtain a grayscale image; The edge detection unit is used to obtain the edge image of the crack on the utility pole after detecting the edge of the grayscale image.

[0017] Compared with the prior art, the beneficial effects of the device for rapid detection of crack images of utility poles based on OpenCV provided by the present invention are the same as the beneficial effects of the method for rapid detection of crack images of utility poles based on OpenCV described in the above technical scheme, which will not be described in detail here. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 This is a flow chart of a method for quickly detecting cracks in electric poles based on OpenCV in the present invention; Figure 2 It is a flow chart of the adaptive edge detection method in the method for rapid detection of cracks in electric poles based on OpenCV of the present invention; Figure 3 The figure is a flowchart of a method for rapid detection of cracks in electric poles based on OpenCV according to the present invention; Figure 4 It is a block diagram of a rapid detection device for crack images of electric poles based on OpenCV of the present invention; Figure 5 It is a schematic diagram of an embodiment of obtaining a binary image after image preprocessing in the method for rapid detection of cracks in electric poles based on OpenCV of the present invention; Figure 6 For Figure 5 A schematic diagram of a horizontal filtering template for matching a grayscale image; Figure 7 For Figure 5 Schematic diagram of the vertical filtering template for matching the grayscale image. DETAILED DESCRIPTION

[0019] In order to make the technical problems, technical solutions and beneficial effects to be solved by the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0020] The present invention is further described in detail below in conjunction with specific embodiments, which are intended to explain the present invention rather than to limit it.

[0021] Please refer to Figure 1 and Figure 3 , which illustrates a flow chart of a method for rapid detection of cracks in electric poles based on OpenCV, the method for rapid detection of cracks in electric poles based on OpenCV includes: Step S101, controlling the camera to photograph the outer surface of the electric pole, and using the infrared detector to detect the shooting area of ​​the camera.

[0022] The camera can be a CMOS visible light camera or a Tigris-640 infrared camera. The infrared detector is an infrared detector used to detect cracks in the prior art. The host computer sends a control instruction to the slave computer, and the slave computer drives the camera and the infrared detector to collect images of the entire utility pole. The host computer is used to run the utility pole crack image rapid detection method based on opencv of the present invention, and the slave computer can be a robotic arm.

[0023] Step S102, acquiring data from the camera and the infrared detector, and extracting the image taken by the camera when the infrared detector detects a crack signal.

[0024] Step S103, obtain a binary image after preprocessing the image, and create a filter template based on the binary image, adjust the first weight of the median filter and the second weight of the mean filter according to the first average value of all point variances in the filter template, and use the filter template to filter the image according to the first weight and the second weight to obtain a grayscale image, wherein the first average value is , the first weight is , the second weight is 1- , is the first preset weight, is the second preset weight, is the grayscale mean of the filter template, is the grayscale median of the filter template, when hour: when hour: . In the above steps, median filtering, as the name implies, is to sort the pixel values ​​in a certain point or a certain area of ​​a sequence during the digital image processing process, and select the sorted median value to replace other pixel values ​​near this point or the sequence. Mean filtering is to select the mean value in the area to replace other pixel values. On this basis, the present invention proposes a method for automatically adjusting the weights of median filtering and mean filtering templates. In this process, the template is traversed throughout the image to finally obtain a filtered image. The specific implementation steps are: (1) Calculate the gradient of the pole crack image using the Sobel operator (filter template) and remove the part with a smaller gradient as a preprocessing of the image. Usually, the gradient of the edge of the image is larger, while the gradient of the noise part is smaller; (2) Based on the pole crack image, create a suitable 3*3 window as a filter template and calculate the grayscale mean of the template and median; (3) Calculate the variance of the grayscale values ​​of all points in the filter template and the grayscale mean of the filter template, and find the average value of the variance of all points in the filter template , assuming that the median filter weight is , is the threshold that needs to be set in advance, the weight of the mean filter is 1- ,according to To adjust the weight, the calculation formula is as follows: when hour: ; when hour: ; In the above formula and is the pre-set weight. According to the above formula, if the average variance of the filter template is less than the threshold, it proves that there is less noise in the filter template window, and the weight of the mean filter needs to be increased. Otherwise, the weight of the median filter needs to be increased. At this time, the gray value calculation formula of the midpoint of the filter template is as follows: Finally, the filter template traverses the entire image from left to right and from top to bottom to complete the filtering of the telephone pole crack image.

[0025] The filter template is a discrete differential operator used to calculate the gradient of an image. The filter template is obtained by approximating the first-order derivatives of the image in the horizontal and vertical directions.

[0026] For a 3x3 filter template, it is determined as follows: like Figure 6 The horizontal template is shown in Figure 1. The function of this template is to calculate the horizontal gradient of each pixel in the image. The numbers in the template represent the weighted values ​​of the surrounding pixels. For example, for the central pixel, its horizontal gradient value is the sum of the products of the surrounding pixels and the corresponding weighted values.

[0027] like Figure 7 Shown is the vertical template, which is used to calculate the vertical gradient of each pixel in the image.

[0028] By using Figure 6 and Figure 7 The two templates shown perform convolution operations on the image respectively, and the gradient components of the image in the horizontal and vertical directions can be obtained. Then, the gradient size and direction of each pixel can be calculated based on these gradient components.

[0029] In the crack image, areas with larger gradients usually correspond to the edge contours of the cracks, areas with obvious changes in surface texture, etc.

[0030] If the crack image has clear edges, the gradient value at the edge will be higher. For example, at the junction of the crack and the background, a large gradient will be generated due to the sharp change of pixels. In the non-crack area where the color of the crack image is relatively uniform, the gradient value is relatively small.

[0031] Step S104, detecting the edge of the grayscale image to obtain an edge image of the crack on the electric pole.

[0032] Please refer to Figure 2 , the above step S104 specifically includes: Step S1041, calculating the gradient and amplitude of the grayscale image, and dividing the grayscale image pixels after non-maximum suppression into a first pixel set, a second pixel set, and a third pixel set, wherein the first pixel set is a gradient set of non-boundary points of the crack in the grayscale image, the second pixel set is a gradient set of weak boundary points of the crack in the grayscale image, and the third pixel set is a gradient set of strong edges of the crack in the grayscale image; Step S1042, respectively calculating the gradient values ​​of the first pixel set, the second pixel set and the third pixel set to obtain the maximum inter-class variance; Step S1043, using the maximum inter-class variance gradient value of the first pixel set and the maximum inter-class variance gradient value of the third pixel set to replace the high threshold and the low threshold in the double threshold detection; Step S1044, using the replaced high threshold and low threshold to complete the double threshold check of the grayscale image after non-maximum suppression, to obtain the edge image of the crack on the utility pole.

[0033] The calculation of gradient and amplitude is to use the Sobel operator (filter template) to traverse the grayscale image in sequence. Assume that the operator used by the filter template is 3×3, such as Figure 6 and Figure 7 shown.

[0034] Assume that the grayscale image of the pole crack image after filtering is as follows: Figure 5 As shown, the filter template traverses the grayscale image and finally obtains the gradient size of each point. Assume that the gradient of the first point of the image after calculation is ,but: The directional gradient component is: ; The directional gradient component is: ; By analogy, we get the gradient size of all points. Next, we need to calculate the direction of the gradient. The calculation formula is as follows: ; in and is the gradient size of the first point, then the gradient angle of the first point is .

[0035] As the name suggests, non-maximum suppression is to suppress non-maximum gradient values, that is, to traverse all pixels in the grayscale image and determine whether the current pixel is the maximum value of the gradient in the same direction among the surrounding pixels. If it is the maximum value, the pixel is retained, otherwise its gradient is suppressed, that is, it is taken to 0. Through maximum suppression, the details of the edge of the grayscale image can be highlighted, making the edge of the grayscale image clearer.

[0036] After the above non-maximum suppression, the local gradient maximum of the grayscale image is found, but some edges are too fine, which is reflected as a large amount of noise on the grayscale image. When the gradient change in some areas of the grayscale image is not strong, it is necessary to determine the threshold to extract the grayscale image. Compared with the use of a single threshold of either black or white, this method uses a double threshold. If the gradient modulus is higher than the high threshold, it is considered to be an edge, and if it is lower than the low threshold, it is considered to be noise and discarded. When the gradient modulus is between the maximum and minimum values, it is retained if it is connected to the boundary, otherwise it is discarded. The threshold setting of traditional methods is manually set subjectively based on parameters such as the grayscale value of the image. When the threshold is set too large, some edge information may be lost, and when the threshold is set too small, some noise may be retained. Moreover, when the camera exposure is affected by weather changes and the camera position changes, the fixed threshold may not be suitable for the new camera scene. This requires the reasonable selection of high and low thresholds based on the information of the image collected by the camera. This method can solve the above problems by using the maximum inter-class variance method to automatically select the threshold. The improved crack detection operator can automatically select a reasonable threshold, thereby saving the time of manually selecting and modifying the threshold. The basic idea of ​​this method is to first divide the grayscale image pixels after non-maximum suppression into the first pixel set , the second pixel set and the third pixel set , is the gradient set of non-boundary points in the grayscale image , is the gradient set of weak boundary points in the grayscale image , is the gradient set of strong edges in the grayscale image . Let the total number of pixels of the grayscale image be , where the gradient The corresponding number of pixels is , then the gradient value Probability for: right , and The three parts are used to calculate the expectation , and : The inter-class variance is calculated based on the maximum inter-class variance: By continuously iterating the gradient values ​​in the three intervals, the maximum inter-class variance is obtained. and The maximum inter-class variance gradient value obtained in the class is used to replace the high and low thresholds in the dual threshold detection, thereby realizing an adaptive threshold.

[0037] After the final double threshold check, the edge image of the grayscale image can be obtained. The output image format and size are determined, and the edge image is sent to the data cache unit in the form of information flow. The host computer caches the processed pole crack image and finally displays it on the display.

[0038] In the specific implementation, Visual Studio software is installed on the host computer and the Opencv library is added. The software is used to read the crack image of the electric pole and perform a series of processing. The specific processing process is the image preprocessing in step S103, the improved filtering in step S103, the calculation of image gradient and amplitude in steps S1041 to S1044, non-maximum suppression, adaptive dual threshold detection, and finally outputting the result.

[0039] In summary, in the method for rapid detection of cracks in electric poles based on OpenCV provided by the present invention, by taking cracks in electric poles as target detection in image processing and applying the target detection algorithm based on OpenCV to detection of cracks in electric poles, the detection method only needs to input images or video frames, and can quickly and accurately locate and identify cracks in electric poles in images and obtain the width of cracks, with a high accuracy rate. It can better achieve real-time target recognition and low-power operation under complex situations and traditional cumbersome steps, and is applied to the recognition of cracks in daily maintenance and detection of electric poles in power-related industries.

[0040] The present invention also discloses a rapid detection device for crack images of electric poles based on OpenCV, please refer to Figure 4 The utility pole crack image rapid detection device based on OpenCV includes: The command issuing unit is used to control the camera to shoot the outer surface of the electric pole, and use the infrared detector to detect the shooting area of ​​the camera; A data acquisition unit, used to obtain data from the camera and the infrared detector, and extract the image taken by the camera when the infrared detector detects a crack signal; A preprocessing unit, used for preprocessing the image to obtain a binary image, and creating a filtering template according to the binary image; The improved filtering unit is used to adjust the first weight of the median filter and the second weight of the mean filter according to the first average value of all point variances in the filtering template, and filter the image using the filtering template according to the first weight and the second weight to obtain a grayscale image, wherein the first average value is , the first weight is , the second weight is 1- , is the first preset weight, is the second preset weight, is the grayscale mean of the filter template, is the grayscale median of the filter template, when hour: when hour: ; The edge detection unit is used to obtain the edge image of the crack on the utility pole after detecting the edge of the grayscale image.

[0041] The edge detection unit specifically includes: An adaptive edge detection unit, used to calculate the gradient and amplitude of the grayscale image, and divide the grayscale image pixels after non-maximum suppression into a first pixel set, a second pixel set and a third pixel set, wherein the first pixel set is a gradient set of non-boundary points of the crack in the grayscale image, the second pixel set is a gradient set of weak boundary points of the crack in the grayscale image, and the third pixel set is a gradient set of strong edges of the crack in the grayscale image; Calculating the gradient values ​​of the first pixel set, the second pixel set, and the third pixel set respectively to obtain the maximum inter-class variance; Using the maximum inter-class variance gradient value of the first pixel set and the maximum inter-class variance gradient value of the third pixel set to replace the high threshold and the low threshold in the double threshold detection; The double threshold check of the grayscale image after non-maximum suppression is completed using the replaced high threshold and low threshold to obtain the edge image of the cracks on the utility pole.

[0042] In the adaptive edge detection unit, when the double threshold check of the grayscale image after non-maximum suppression is completed using the replaced high threshold and low threshold, when the modulus of the gradient is higher than the high threshold, it is considered to be an edge and retained; when the modulus of the gradient is lower than the low threshold, it is considered to be noise and discarded; when the modulus of the gradient is between the maximum value and the minimum value, if it is connected to the boundary, it is retained, otherwise it is discarded.

[0043] The adaptive edge detection unit calculates the gradient values ​​of the first pixel set, the second pixel set and the third pixel set respectively to obtain the maximum inter-class variance: Let the total number of pixels of the crack image be , where the gradient The corresponding number of pixels is , the first pixel set is , the second pixel set is , the third pixel set is , then the gradient value Probability for: right , and The three parts are used to calculate the expectation , and : The inter-class variance is calculated based on the maximum inter-class variance: After continuously iterating the gradient values ​​in the first pixel set, the second pixel set, and the third pixel set, the maximum inter-class variances of the first pixel set, the second pixel set, and the third pixel set are obtained respectively.

[0044] The display unit is used to determine the output image format and size, and send the edge image to the data cache unit in the form of information flow. The host computer caches the processed pole crack image and finally displays it on the display.

[0045] Compared with the prior art, the beneficial effects of the device for rapid detection of crack images of utility poles based on OpenCV provided by the present invention are the same as the beneficial effects of the method for rapid detection of crack images of utility poles based on OpenCV described in the above technical scheme, which will not be described in detail here.

[0046] The terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, "multiple" means two or more, unless otherwise clearly and specifically defined. "Several" means one or more, unless otherwise clearly and specifically defined.

[0047] The above shows and describes the basic principles and main features of the present invention and the advantages of the present invention. It should be understood by those skilled in the art that the present invention is not limited to the above embodiments. The above embodiments and descriptions are only for explaining the principles of the present invention. Without departing from the spirit and scope of the present invention, the present invention may have various changes and improvements, which fall within the scope of the present invention to be protected. The scope of protection of the present invention is defined by the attached claims and their equivalents.

Claims

1. A method for rapid detection of cracks in electric pole images based on OpenCV, characterized in that: include: Control the camera to shoot the outer surface of the utility pole, and use the infrared detector to detect the shooting area of ​​the camera; Acquire the data of the camera and the infrared detector, and extract the image taken by the camera when the infrared detector detects the crack signal; After preprocessing the image, a binary image is obtained, and a filter template is created based on the binary image. According to the first average value of all point variances in the filter template, the first weight of the median filter and the second weight of the mean filter are adjusted. According to the first weight and the second weight, the filter template is used to filter the image to obtain a grayscale image, wherein the first average value is , the first weight is , the second weight is 1- , is the first preset weight, is the second preset weight, is the grayscale mean of the filter template, is the grayscale median of the filter template, when hour: when hour: ; After edge detection of the grayscale image, the edge image of the cracks on the utility pole is obtained.

2. The method for rapid detection of cracks in electric poles based on opencv according to claim 1 is characterized in that: The step of obtaining an edge image of a crack on a utility pole after edge detection of the grayscale image specifically includes: Calculate the gradient and amplitude of the grayscale image, and divide the grayscale image pixels after non-maximum suppression into a first pixel set, a second pixel set, and a third pixel set, wherein the first pixel set is a gradient set of non-boundary points of the crack in the grayscale image, the second pixel set is a gradient set of weak boundary points of the crack in the grayscale image, and the third pixel set is a gradient set of strong edges of the crack in the grayscale image; Calculating the gradient values ​​of the first pixel set, the second pixel set, and the third pixel set respectively to obtain the maximum inter-class variance; Using the maximum inter-class variance gradient value of the first pixel set and the maximum inter-class variance gradient value of the third pixel set to replace the high threshold and the low threshold in the double threshold detection; The double threshold check of the grayscale image after non-maximum suppression is completed using the replaced high threshold and low threshold to obtain the edge image of the cracks on the utility pole.

3. The method for rapid detection of cracks in electric poles based on OpenCV according to claim 2 is characterized in that: When the double threshold check of the grayscale image after non-maximum suppression is completed using the replaced high threshold and low threshold, when the gradient modulus is higher than the high threshold, it is considered to be an edge and retained; when the gradient modulus is lower than the low threshold, it is considered to be noise and discarded; when the gradient modulus is between the maximum and minimum values, if it is connected to the boundary, it is retained, otherwise it is discarded.

4. The method for rapid detection of cracks in electric poles based on OpenCV according to claim 2 is characterized in that: The gradient values ​​of the first pixel set, the second pixel set, and the third pixel set are calculated respectively to obtain the maximum inter-class variance: Let the total number of pixels of the crack image be , where the gradient The corresponding number of pixels is , the first pixel set is , the second pixel set is , the third pixel set is , then the gradient value Probability for: right , and The three parts are used to calculate the expectation , and : The inter-class variance is calculated based on the maximum inter-class variance: After continuously iterating the gradient values ​​in the first pixel set, the second pixel set, and the third pixel set, the maximum inter-class variances of the first pixel set, the second pixel set, and the third pixel set are obtained respectively.

5. The method for rapid detection of cracks in electric poles based on OpenCV according to claim 1 is characterized in that: The step of creating a filter template according to the binary image specifically comprises: The first-order derivatives of the binary image are approximately calculated in the horizontal and vertical directions to obtain a filtering template.

6. A rapid detection device for crack images of electric poles based on OpenCV, characterized in that: include: The command issuing unit is used to control the camera to shoot the outer surface of the electric pole, and use the infrared detector to detect the shooting area of ​​the camera; A data acquisition unit, used to obtain data from the camera and the infrared detector, and extract the image taken by the camera when the infrared detector detects a crack signal; A preprocessing unit, used for obtaining a binary image after preprocessing the image, and creating a filtering template according to the binary image; The improved filtering unit is used to adjust the first weight of the median filter and the second weight of the mean filter according to the first average value of all point variances in the filtering template, and filter the image using the filtering template according to the first weight and the second weight to obtain a grayscale image, wherein the first average value is , the first weight is , the second weight is 1- , is the first preset weight, is the second preset weight, is the grayscale mean of the filter template, is the grayscale median of the filter template, when hour: when hour: ; The edge detection unit is used to obtain the edge image of the crack on the utility pole after detecting the edge of the grayscale image.

7. The opencv-based rapid detection device for electric pole crack images according to claim 6 is characterized in that: The edge detection unit specifically includes: An adaptive edge detection unit, used to calculate the gradient and amplitude of the grayscale image, and divide the grayscale image pixels after non-maximum suppression into a first pixel set, a second pixel set and a third pixel set, wherein the first pixel set is a gradient set of non-boundary points of the crack in the grayscale image, the second pixel set is a gradient set of weak boundary points of the crack in the grayscale image, and the third pixel set is a gradient set of strong edges of the crack in the grayscale image; Calculating the gradient values ​​of the first pixel set, the second pixel set, and the third pixel set respectively to obtain the maximum inter-class variance; Using the maximum inter-class variance gradient value of the first pixel set and the maximum inter-class variance gradient value of the third pixel set to replace the high threshold and the low threshold in the double threshold detection; The double threshold check of the grayscale image after non-maximum suppression is completed using the replaced high threshold and low threshold to obtain the edge image of the cracks on the utility pole.

8. The method for rapid detection of cracks in electric poles based on OpenCV according to claim 7 is characterized in that: In the adaptive edge detection unit, when the double threshold check of the grayscale image after non-maximum suppression is completed using the replaced high threshold and low threshold, when the modulus of the gradient is higher than the high threshold, it is considered to be an edge and retained; when the modulus of the gradient is lower than the low threshold, it is considered to be noise and discarded; when the modulus of the gradient is between the maximum value and the minimum value, if it is connected to the boundary, it is retained, otherwise it is discarded.

9. The apparatus for rapid detection of cracks in electric poles based on OpenCV according to claim 7, characterized in that: The adaptive edge detection unit calculates the gradient values ​​of the first pixel set, the second pixel set, and the third pixel set respectively to obtain the maximum inter-class variance: Let the total number of pixels of the crack image be , where the gradient The corresponding number of pixels is , the first pixel set is , the second pixel set is , the third pixel set is , then the gradient value Probability for: right , and The three parts are used to calculate the expectation , and : The inter-class variance is calculated based on the maximum inter-class variance: After continuously iterating the gradient values ​​in the first pixel set, the second pixel set, and the third pixel set, the maximum inter-class variances of the first pixel set, the second pixel set, and the third pixel set are obtained respectively.

10. The apparatus for rapid detection of cracks in electric poles based on OpenCV according to claim 6, characterized in that: The step of creating a filter template according to the binary image specifically comprises: The first-order derivatives of the binary image are approximately calculated in the horizontal and vertical directions to obtain a filtering template.

Citation Information

Patent Citations

  • Pavement crack image detection method

    CN105719259A

  • Method for processing and identifying a pavement crack digital image

    CN111145161A

  • Image enhancement and feature extraction method for automatic welding

    CN115147448A

  • Weld seam image edge detection method for complex environment

    CN116977356A

  • Vision-based workpiece edge detection algorithm

    CN117788499A