A method for detecting hot spots of photovoltaic panels based on distortion correction of UAV infrared images
The radial distortion parameter correction method calibrated by the calibration plate solves the problem of infrared image distortion during UAV photovoltaic panel inspection, improves the accuracy and image quality of hot spot detection, and achieves more accurate hot spot positioning.
Patent Information
- Application Number
- CN202111321611.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-09
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2041-11-09
AI Technical Summary
Infrared images are prone to distortion during UAV photovoltaic panel inspections, leading to errors in hot spot location detection and affecting imaging quality and detection accuracy.
Using the radial distortion parameter correction method based on the calibration of the calibration plate, the photovoltaic panel inspection image is obtained in real time through the drone, the detection frame is set, the distorted image is extracted, the pixel point coordinates are calculated, the undistorted image is generated, and the position of the drone is determined The actual location of the hot spot on the photovoltaic panel.
It effectively eliminates image distortion, improves the accuracy of hot spot detection, ensures image visibility and processing, and provides convenience for subsequent route planning and detection.
Smart Images

Figure CN113989259B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a method for detecting hot spots in an image of a photovoltaic panel of an unmanned aerial vehicle in the field of information processing technology, and in particular to a method for correcting infrared image distortion of a photovoltaic panel inspection based on an unmanned aerial vehicle. Background Art
[0002] Image distortion is unavoidable in visible light and infrared images. This is the inherent perspective distortion of optical lenses, that is, the distortion caused by perspective. This distortion is very detrimental to the imaging quality of photos, but because it is an inherent characteristic of the lens, it cannot be eliminated but can only be improved. Since the lens cannot completely eliminate distortion from the hardware, how to do post-processing on the image to eliminate distortion has become an important step in solving this problem. Summary of the invention
[0003] The purpose of the present invention application is to provide a method for hot spot detection of patrol photovoltaic panels based on distortion correction of UAV infrared images, so as to improve the quality of infrared images, give the images visibility and easy processing, and provide convenience for subsequent UAV route planning and hot spot detection of photovoltaic panels.
[0004] To solve the above problems, the present application method comprises:
[0005] 1. A photovoltaic panel hot spot detection method based on UAV infrared image distortion correction is applied to the infrared camera shooting of the UAV, and the method comprises the following steps:
[0006] Hot spot detection requires finding the position of the hot spot on the photovoltaic panel. Image distortion will cause errors in the detected hot spot position information. The present invention corrects the distortion of the infrared image and can more accurately locate the hot spot position.
[0007] S1. Obtain radial distortion parameters of the camera based on the calibration plate calibration method;
[0008] S2, using drones to inspect photovoltaic panel arrays and obtain photovoltaic panel inspection images in real time;
[0009] S3, processing the photovoltaic panel inspection image acquired by the UAV to obtain a preliminary image;
[0010] S4, pre-setting a detection frame in the previous image, implementing the detection frame to read the straight line during the inspection flight of the UAV and then collecting and intercepting the distorted image;
[0011] S5, creating a blank image matrix of the same size as the photovoltaic panel inspection image, calculating the coordinates of each pixel point in the image matrix corresponding to the coordinates of the pixel point in the distorted image according to the radial distortion parameter, assigning the pixel value of each pixel point in the distorted image to the pixel point in the image matrix corresponding to the radial distortion parameter, thereby obtaining an undistorted image, and making the straight line read in step S4 also corrected to obtain a corrected straight line;
[0012] S6. In the undistorted image, an extraction frame with the same size as the detection frame and the same relative position relationship as the straight line is established based on the corrected straight line as the boundary, and hot spot detection is performed on the extraction frame to obtain the hot spot positioning result in the extraction frame. The extraction frame is then combined with the position of the drone when collecting photovoltaic panel inspection images during the drone inspection flight to obtain the position of the hot spot in the actual photovoltaic panel array.
[0013] The step S1 is specifically as follows: multiple chessboard images composed of black and white grids taken at different positions, different angles, and different postures are collected as calibration images; for each calibration image, the grid corner points located on the calibration board and not located on the edge of the calibration board are used as inner corner points, and each inner corner point is sequentially connected on the calibration image, and after the image coordinates of the inner corner points of the calibration image are obtained, the calibration calculation is performed to obtain the radial distortion parameters of the camera. Each inner corner point is sequentially connected on the calibration image, so that the calibration image can be determined based on the arrangement order of all corner points to determine whether the calibration image can be used for calibration, whether the input image is a chessboard pattern and the position of the corner points needs to be determined, and if all corner points are detected and arranged in a certain order, it is determined that the image is a picture that can be used for calibration.
[0014] The step S2 specifically includes: installing an infrared camera on the drone, and when the drone flies above the photovoltaic panel array, flying in a single direction at a constant speed over the photovoltaic panel array and taking an infrared image of the photovoltaic panel array by looking down through the infrared camera.
[0015] The step S3 is specifically as follows:
[0016] First, read the infrared image of the photovoltaic panel inspection image, perform grayscale and binarization on the infrared image in turn, and then perform opening and closing operations respectively; then make the pixels that appear white in the opening operation processing result appear black in the corresponding pixels at the same coordinate position in the closing operation processing result, and obtain the preliminary image.
[0017] The step S4 is specifically as follows:
[0018] S41, setting a detection frame at the center of the previous image, which has the same width as the previous image and a height smaller than the height occupied by a single row of photovoltaic panels in the image, and the height direction of the image is parallel to the flight direction of the UAV;
[0019] S42, detecting in real time within the detection frame whether there is a straight line along the width direction of the image and whether a straight line along the width direction of the image passes, and then determining the time according to the straight line detection and acquiring the distorted image.
[0020] In the step S42, whether there is a straight line along the width direction of the image passing through is specifically: the straight line along the height direction of the image in the detection frame is removed by image processing, and then the straight line along the width direction of the image retained in the detection frame is extracted and extended to be equal to the width of the detection frame;
[0021] In the S42, the time is determined according to the straight line detection and the distorted image is collected, specifically: during the UAV inspection flight, the straight line along the image width direction obtained by real-time detection is translated along the image height direction, and the straight line along the image width direction divides the detection frame into two area parts. The two area parts have undergone changes in area size, satisfying that the area of one area part gradually changes from large to small and the area of the other area part gradually changes from small to large, and the two area parts are equal during their respective area changes. If the area of one of the area parts gradually changes from large to less than the preset area threshold, the straight line along the image width direction will leave the detection frame, and at this time, the photovoltaic panel inspection image of the current frame taken by the UAV inspection is intercepted as the distorted image.
[0022] In S6, after performing image analysis processing on the extraction frame to obtain the hot spot positioning result in the extraction frame, the relative position of the hot spot in the undistorted image is obtained based on the hot spot positioning result in the extraction frame combined with the position of the extraction frame in the undistorted image, and then the position of the hot spot in the actual photovoltaic panel array is obtained based on the relative position of the hot spot in the undistorted image combined with the position of the drone when the photovoltaic panel inspection image corresponding to the undistorted image is collected during the drone inspection flight.
[0023] 2. An electronic device comprising:
[0024] Memory, used to store running programs;
[0025] The processor is used to implement the steps of the infrared image distortion correction method as described above when executing the program.
[0026] 3. A computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the infrared image distortion correction method as described above.
[0027] 4. A drone for hot spot detection, the drone is capable of taking infrared images for hot spot inspection of photovoltaic panel arrays, and the infrared images implement the steps of the above-mentioned infrared image distortion correction method.
[0028] The beneficial effects of the present invention are:
[0029] The present invention can accurately obtain the image corresponding to each single row of photovoltaic panels through the straight line detection method in the detection frame, can accurately locate the row information of the hot spot position on the photovoltaic panel, and by removing image distortion, restore the photovoltaic panel in the captured image to a normal rectangle, so that the column information of the hot plate can be obtained more accurately, effectively preventing the influence of image distortion on hot spot detection and positioning, and improving the accuracy of hot spot detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 A schematic diagram of a preferred embodiment of the present invention;
[0031] Figure 2 This is a schematic diagram of a drone inspection and shooting route according to a preferred embodiment of the present invention;
[0032] Figure 3 A schematic diagram of image processing acquired by a drone according to a preferred embodiment of the present invention;
[0033] Figure 4 A schematic diagram of image processing acquired by a drone according to a preferred embodiment of the present invention;
[0034] Figure 5 This is a schematic diagram of image processing results obtained by a drone in a preferred embodiment of the present invention;
[0035] Figure 6 Schematic diagram of a detection frame according to a preferred embodiment of the present invention. DETAILED DESCRIPTION
[0036] The present application scheme will be described in more detail below. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments, and the present application can be implemented in various forms and should not be limited by the embodiments described here. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0037] Embodiments of the present invention Figure 1 As shown, the specific steps include:
[0038] S1. Obtain radial distortion parameters of the camera based on the calibration plate calibration method;
[0039] Multiple pictures of a chessboard composed of black and white grids taken at different positions, angles, and postures are collected as calibration pictures. For each calibration picture, the grid corner points that are located on the calibration board and not on the edge of the calibration board are used as inner corner points. The inner corner points are connected in sequence on the calibration picture. After obtaining the image coordinates of the inner corner points of the calibration picture, a calibration calculation is performed to obtain the radial distortion parameters of the camera.
[0040] The inner corner points are connected in sequence by first connecting the inner corner points of each row in sequence in the row direction, and then connecting adjacent rows in the order of columns, so that the tail inner corner point of the previous row is connected to the head inner corner point of the next row.
[0041] To perform calibration, you first need to obtain all the inner corner points in the chessboard image.
[0042] Since each inner corner point in the image is a three-dimensional point, we also need to use the two-dimensional coordinates of the inner corner point in the subsequent function processing. For the convenience of processing, we first remove the z coordinate of the three-dimensional point. For example, if point p is (8, 5, 0), it is recorded as (8, 5) after removing the z coordinate. Then, the three-dimensional point coordinates and the two-dimensional coordinates are stored separately.
[0043] In the computer program, the chessboard image is read using the image reading function imread, and then the image is converted into a grayscale image using the color space conversion function cvtColor. The chessboard corner points in the grayscale image are found using the chessboard corner point extraction function findChessboardComers, and the chessboard corner point drawing function drawChessboardComers is used to mark the corner points on the grayscale image.
[0044] The camera calibration function calibrateCamera can be used to obtain the camera distortion coefficients k1, k2, and k3.
[0045] The function Y used to correct the coordinates of the distorted points is:
[0046] x0=x(1+k1r 2 +k2r 4 +k3r 6 )
[0047] y0=y(1+k1r 2 +k2r 4 +k3r 6 )
[0048] where r 2 =x 2 +y 2 , we can see that the radial distortion at the edge of the image is larger; (x0, y0) is the original position of the distortion point; (x, y) is the new position after distortion correction; k1, k2, k3 are the distortion coefficients obtained by the above function; the only unknowns are x and y. As long as the original position of the distortion point is substituted, the new position of the distortion point after distortion correction can be obtained.
[0049] S2, using drones to inspect photovoltaic panel arrays and obtain photovoltaic panel inspection images in real time;
[0050] Specifically, an infrared camera is installed on the UAV. When the UAV flies above the photovoltaic panel array, it flies over the photovoltaic panel array at a constant speed in one direction and takes an infrared image of the photovoltaic panel array by looking down through the infrared camera.
[0051] The photovoltaic panel array is formed by arranging a large number of photovoltaic panels in rows and columns, and the drone flies in a direction parallel to one side of the photovoltaic panel. Figure 2 shown.
[0052] S3, processing the photovoltaic panel inspection image acquired by the UAV to obtain a preliminary image;
[0053] First, read the infrared image of the photovoltaic panel inspection image, perform grayscale and binarization on the infrared image, and then perform opening and closing operations respectively. The results are as follows: Figure 3 and Figure 4 As shown; the flying direction of the drone in the figure is from bottom to top, and the object in the image moves from top to bottom.
[0054] Then make Figure 3 The pixel points that appear white in the opening operation result appear black in the closing operation result. Figure 5 As shown, the early image is obtained.
[0055] In the computer program, the image reading function imread is used to read the infrared image of the inspection image, and then the color space conversion function cvtColor is used to convert the image into a grayscale image, and the image threshold processing function threshold is used to convert the grayscale image into a binary image;
[0056] Then, the binary image is processed by image morphological opening and image morphological closing respectively to obtain two intermediate results M and N, as shown in Figure 3 , Figure 4 Shown
[0057] First, copy N and save the copy result to a blank image P of equal proportion. Then, the white part of M is rendered black in image P to obtain the final effect. Figure 5 shown.
[0058] S4, pre-setting a detection frame in the previous image, implementing the detection frame to read the straight line during the inspection flight of the UAV and then collecting and intercepting the distorted image;
[0059] S41. A detection frame is set at the center of the previous image, which is equal in width to the previous image and smaller in height than the height of a single row of photovoltaic panels in the image. The height direction of the image is parallel to the flight direction of the UAV. Specifically, a horizontal line is drawn at 0.56 times and 0.44 times the height of the previous image, and a detection frame is formed between the two horizontal lines. Figure 6 As shown;
[0060] In the computer program, a straight line drawing function line is used to draw straight lines at positions 0.56 and 0.44 times the height of the original image.
[0061] S42, detecting in real time within the detection frame whether there is a straight line along the width direction of the image and whether a straight line along the width direction of the image passes, and then determining the time according to the straight line detection and acquiring the distorted image.
[0062] In S42, whether there are straight lines along the width direction of the image is specifically: the straight lines along the height direction of the image in the detection frame are removed by image processing, and specifically, the straight lines and the height direction of the image are judged after the straight lines are detected by the Hough line detection method, and the straight lines whose angles are within the preset angle threshold range are removed. Then, the straight lines along the width direction of the image that are retained in the detection frame are extracted and extended to the same width as the detection frame;
[0063] In S42, the moment is determined based on the straight line detection and the distorted image is collected. Specifically, during the inspection flight of the UAV, the straight line along the width direction of the image obtained by real-time detection is translated along the height direction of the image. The straight line along the width direction of the image divides the detection frame into two area parts. The two area parts change in size, satisfying that the area of one area part gradually changes from large to small and the area of the other area part gradually changes from small to large, and the two area parts are equal in their respective area change processes. If the area of one of the area parts gradually changes from large to less than the preset area threshold, the straight line along the width direction of the image will leave the detection frame. At this time, the straight line along the width direction of the image is close to the bottom of the detection frame. As the moment of collecting the image, the photovoltaic panel inspection image of the current frame taken by the UAV inspection is intercepted as the distorted image.
[0064] In the specific implementation, two variables, small area and large area, are set: it can be seen that when there is a horizontal line, the detection frame will be divided into two parts, the part with a small area is set as the small area, and the part with a large area is set as the large area; it can be seen that as the image is played, the horizontal straight line will move downward at a constant speed in the frame. When it just enters the detection frame, the small area is on the top and the large area is on the bottom, and when the straight line reaches one-half of the height of the detection frame, the small area is equal to the large area, and after continuing to move, the large area is on the top and the small area is on the bottom; a threshold is set, and when the small area is greater than the threshold, it means that a straight line has been read through the detection frame.
[0065] In a computer program, first preset two variables, a large area A and a small area B. Use the Hough line detection to obtain all the lines in the detection frame. Since the length of the horizontal lines is greater than that of all the vertical lines, all the lines are judged by length. The set threshold N only needs to be greater than the height of the detection frame. The retained lines are the detected horizontal lines. Extend the length of the horizontal lines to the width of the detection frame. In this way, the lines divide the detection frame into two parts, forming two area quantities. Assign the larger area quantity to A and the smaller area quantity to B. Set a threshold C. As the image is played, the lines will move downward uniformly within the frame. When just entering the detection frame, A is above and continuously increases while B is below and continuously decreases. When A > C, turn on the detection switch. When the line reaches the mid-height of the detection frame, A is equal to B. After continuing to move, B is above and continuously increases while A is below and continuously decreases. When A < C, turn off the detection switch, intercept the current frame, and save it locally to complete the line reading and screenshotting.
[0066] S5. Create a blank image matrix with the same size as the photovoltaic panel inspection image. Calculate the coordinates corresponding to the pixel points in the distorted image for each pixel point coordinate in the image matrix according to the radial distortion parameters. Assign the pixel value of each pixel point in the distorted image to the pixel point corresponding to the radial distortion parameters in the image matrix, and then perform correction to obtain an undistorted image, and also correct the lines read in step S4 to obtain corrected lines.
[0067] In the computer program, traverse all the pixel points in the original distorted image, and apply the function Y described in S1 to the coordinates of all the pixel points. All the pixel point coordinates in the original distorted image are (x0, y0), (x1, y1), …, (x n , y n ), and respectively find the corresponding correct positions (x, y) after distortion correction.
[0068] Assign the pixel values at the coordinates of all the pixel points in all the distorted images to the corresponding correct positions after distortion correction. After traversing, all the distorted pixel points are retained at the correct positions in the created blank image matrix, realizing the distortion correction of the infrared image.
[0069] S6. In the undistorted image, establish an extraction frame with the same size as the detection frame and the same relative position relationship with the lines based on the corrected lines as boundaries. Perform hot spot detection on the extraction frame to obtain the hot spot positioning result in the extraction frame, and then combine the position of the drone during the acquisition of the photovoltaic panel inspection image during the drone inspection flight of the extraction frame to obtain the position of the hot spot in the actual photovoltaic panel array.
[0070] In S6, after performing image analysis processing on the extraction frame to obtain the hot spot positioning result in the extraction frame, the relative position of the hot spot in the undistorted image is obtained based on the hot spot positioning result in the extraction frame combined with the position of the extraction frame in the undistorted image, and then the position of the hot spot in the actual photovoltaic panel array is obtained based on the relative position of the hot spot in the undistorted image combined with the position of the drone when the photovoltaic panel inspection image corresponding to the undistorted image is collected during the drone inspection flight.
[0071] In addition, the various embodiments of the present application are described in a progressive manner, and each embodiment focuses on its differences. The same or similar parts between the various embodiments can be referred to each other. For the device disclosed in the embodiment, since it is compared with the method disclosed in the embodiment, the description is relatively simple. For example, in the claims, any one of all the embodiments can be used in any combination. For relevant parts, please refer to the description of the method part.
[0072] The method for visible light and infrared distortion correction, electronic device and computer-readable storage medium provided by the present application are introduced in detail above. The present invention uses specific examples to illustrate the principle and implementation method of the present application. The description of the above embodiment is only used to help understand the method and core idea of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements can be made to the present application without departing from the principle of the present application, and these improvements should also be within the scope of protection of the claims of the present application.
Claims
1. A photovoltaic panel hot spot detection method based on drone infrared image distortion correction, characterized in that: The method comprises the following steps: S1. Obtain radial distortion parameters of the camera based on the calibration plate calibration method; S2, using drones to inspect photovoltaic panel arrays and obtain photovoltaic panel inspection images in real time; S3, processing the photovoltaic panel inspection image acquired by the UAV to obtain a preliminary image; S4, pre-setting a detection frame in the previous image, implementing the detection frame to read the straight line during the inspection flight of the UAV and then collecting and intercepting the distorted image; S5, creating a blank image matrix of the same size as the photovoltaic panel inspection image, calculating the coordinates of each pixel point in the image matrix corresponding to the coordinates of the pixel point in the distorted image according to the radial distortion parameter, assigning the pixel value of each pixel point in the distorted image to the pixel point in the image matrix corresponding to the radial distortion parameter, thereby obtaining an undistorted image, and making the straight line read in step S4 also corrected to obtain a corrected straight line; S6. In the undistorted image, an extraction frame with the same size as the detection frame and the same relative position relationship as the straight line is established based on the corrected straight line as the boundary, and hot spot detection is performed on the extraction frame to obtain the hot spot positioning result in the extraction frame. The extraction frame is then combined with the position of the drone when collecting photovoltaic panel inspection images during the drone inspection flight to obtain the position of the hot spot in the actual photovoltaic panel array.
2. The photovoltaic panel hot spot detection method based on drone infrared image distortion correction according to claim 1 is characterized by: The step S1 specifically comprises: collecting a plurality of chessboard images consisting of black and white grids taken at different positions, different angles, and different postures as calibration images; for each calibration image, taking the grid corner points located on the calibration board and not located on the edge of the calibration board as the inner corner points, connecting each inner corner point in sequence on the calibration image, and performing calibration calculation to obtain the radial distortion parameters of the camera after obtaining the image coordinates of the inner corner points of the calibration image.
3. The photovoltaic panel hot spot detection method based on drone infrared image distortion correction according to claim 1 is characterized by: The step S2 specifically includes: installing an infrared camera on the drone, and when the drone flies above the photovoltaic panel array, flying in a single direction at a constant speed over the photovoltaic panel array and taking an infrared image of the photovoltaic panel array by looking down through the infrared camera.
4. The photovoltaic panel hot spot detection method based on drone infrared image distortion correction according to claim 1 is characterized by: The step S3 is specifically as follows: First, read the infrared image of the photovoltaic panel inspection image, perform grayscale and binarization on the infrared image in turn, and then perform opening and closing operations respectively; then make the pixels that appear white in the opening operation processing result appear black in the corresponding pixels at the same coordinate position in the closing operation processing result, and obtain the preliminary image.
5. The photovoltaic panel hot spot detection method based on drone infrared image distortion correction according to claim 1 is characterized by: The step S4 is specifically as follows: S41, setting a detection frame at the center of the previous image, which has the same width as the previous image and a height smaller than the height occupied by a single row of photovoltaic panels in the image, and the height direction of the image is parallel to the flight direction of the UAV; S42, detecting in real time within the detection frame whether there is a straight line along the width direction of the image and whether a straight line along the width direction of the image passes, and then determining the time according to the straight line detection and acquiring the distorted image.
6. The photovoltaic panel hot spot detection method based on drone infrared image distortion correction according to claim 5 is characterized by: In the step S42, whether there is a straight line along the width direction of the image passing through is specifically: the straight line along the height direction of the image in the detection frame is removed by image processing, and then the straight line along the width direction of the image retained in the detection frame is extracted and extended to be equal to the width of the detection frame; In the S42, the time is determined according to the straight line detection and the distorted image is collected, specifically: during the UAV inspection flight, the straight line along the image width direction obtained by real-time detection is translated along the image height direction, and the straight line along the image width direction divides the detection frame into two area parts. The two area parts have undergone changes in area size, satisfying that the area of one area part gradually changes from large to small and the area of the other area part gradually changes from small to large, and the two area parts are equal during their respective area changes. If the area of one of the area parts gradually changes from large to less than the preset area threshold, the straight line along the image width direction will leave the detection frame, and at this time, the photovoltaic panel inspection image of the current frame taken by the UAV inspection is intercepted as the distorted image.
7. The photovoltaic panel hot spot detection method based on drone infrared image distortion correction according to claim 1 is characterized by: In S6, after performing image analysis processing on the extraction frame to obtain the hot spot positioning result in the extraction frame, the relative position of the hot spot in the undistorted image is obtained based on the hot spot positioning result in the extraction frame combined with the position of the extraction frame in the undistorted image, and then the position of the hot spot in the actual photovoltaic panel array is obtained based on the relative position of the hot spot in the undistorted image combined with the position of the drone when the photovoltaic panel inspection image corresponding to the undistorted image is collected during the drone inspection flight.
8. An electronic device, characterized in that: include: Memory, used to store running programs; A processor is used to implement the steps of the infrared image distortion correction method as described in any one of claims 1 to 7 when executing the program.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the infrared image distortion correction method according to any one of claims 1 to 7 are implemented.
10. A drone for hot spot detection, characterized in that: The drone is capable of taking infrared images of hot spot inspections of photovoltaic panel arrays, and the infrared images implement the steps of the infrared image distortion correction method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Photovoltaic panel hot spot positioning method and system
CN111860404A
Photovoltaic power station assembly defect inspection system and defect processing method thereof
CN112862777A
