Image processing method, device, computer equipment and storage medium
By judging the image quality and optimizing the power inspection images collected by drones, the problem of low image quality is solved and the accuracy of fault identification and classification is improved.
Patent Information
- Application Number
- CN202110981218.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-25
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2041-08-25
AI Technical Summary
The quality of images collected by drones in power inspection scenarios is low, resulting in inaccurate image recognition and classification results, and the inability to accurately identify power inspection faults.
By obtaining the original image collected by the drone, it is judged whether the image quality meets the preset conditions. If it does not meet the preset conditions, image optimization processing is performed based on the preset image processing algorithm, including grayscale histogram analysis, decision tree algorithm and image enhancement. algorithm to improve image quality.
It improves the image quality, enhances the accuracy of identification and classification of power inspection faults, and ensures the accuracy of power inspection information.
Smart Images

Figure CN113870180B
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to an image processing method, apparatus, computer device and storage medium. Background Art
[0002] In the field of power inspection, there are many scenes with harsh environments, and the application of drone inspection mode is becoming more and more widespread. In the existing technology, drones are controlled to inspect in specified scenes, and the image acquisition equipment on the drones is used to collect images of target equipment and target scenes in the specified scenes, so as to perform image recognition and image classification on the collected images based on artificial intelligence algorithms, and automatically complete the inspection and evaluation of equipment faults and environmental faults in the specified scenes.
[0003] However, since the image acquisition equipment on drones often uses more mainstream image sensors, most of the images collected by the image sensors are low-quality, which leads to inaccurate final image recognition and image classification results. Summary of the invention
[0004] Based on this, it is necessary to provide an image processing method, apparatus, computer device and storage medium that can improve image quality in response to the above technical problems.
[0005] In a first aspect, an image processing method is provided, the method comprising:
[0006] Obtain the original images of the power inspection scene collected by the drone;
[0007] Determine whether the image quality of the original image meets the preset quality determination conditions; the quality determination conditions include determining the illumination state of the light source in the original image;
[0008] When the image quality of the original image does not meet the quality determination conditions, the original image is optimized based on a preset image processing algorithm to obtain a target image that meets the quality determination conditions.
[0009] In one optional embodiment, determining whether the image quality of the original image meets a preset quality determination condition includes:
[0010] Determine the grayscale histogram of the original image;
[0011] According to the grayscale histogram of the original image, it is determined whether the image quality of the original image meets the preset quality judgment condition.
[0012] In one of the optional embodiments, determining whether the image quality of the original image meets a preset quality determination condition according to the grayscale histogram of the original image includes:
[0013] According to the grayscale histogram of the original image, determine the mean of the grayscale histogram;
[0014] Calculate the variance of the grayscale histogram and the mean of the grayscale histogram;
[0015] When the variance is less than a preset threshold, determining that the image quality of the original image meets a preset quality determination condition;
[0016] When the variance is greater than or equal to the preset threshold, it is determined that the image quality of the original image does not meet the preset quality determination condition.
[0017] In one of the optional embodiments, performing image optimization processing on the original image based on a preset image processing algorithm to obtain a target image that meets the quality determination condition includes:
[0018] Based on the original image and a preset decision tree algorithm, determining whether the original image is in a state of being illuminated by a first light source;
[0019] If the original image is in a state of being illuminated by a first light source, performing a first image optimization process on the original image to obtain a first target image;
[0020] If the original image is not in the state of being illuminated by the first light source, determining whether the original image is in the state of being illuminated by the second light source;
[0021] When the original image is under the illumination of the second light source, performing second image optimization processing on the original image to obtain a second target image;
[0022] The first target image or the second target image is determined as the target image.
[0023] In one optional embodiment, determining whether the original image is in the first light source illumination state based on the original image and a preset decision tree algorithm includes:
[0024] Get the Exchangeable Image File EXIF information of the original image;
[0025] Determine the shooting parameters of the original image based on EXIF information; the shooting parameters include shooting aperture, exposure time, and weather conditions;
[0026] If the weather condition is cloudy or sunny, the shooting aperture is less than the preset aperture threshold, and the exposure time is less than the preset exposure threshold, it is determined that the original image is in the first light source illumination state;
[0027] If the weather is cloudy or sunny, the shooting aperture is greater than or equal to the preset aperture threshold, or the exposure time is greater than or equal to the preset exposure threshold, it is determined that the original image is not in the first light source illumination state.
[0028] In one optional embodiment, performing first image optimization processing on the original image to obtain the first target image includes:
[0029] According to a preset image enhancement algorithm, the original image is corrected to obtain a first target image.
[0030] In one optional embodiment, determining whether the original image is in a state of being illuminated by a second light source includes:
[0031] According to a preset segmentation rule, the original image is segmented into a preset number of image blocks;
[0032] Determine the grayscale histogram distribution of each image block;
[0033] If the maximum value of the grayscale histogram of the image block is greater than a preset threshold, it is determined that the original image is in a state of being illuminated by the second light source;
[0034] If the maximum value of the grayscale histogram of the image block is less than or equal to the preset threshold, it is determined that the original image is not in the second light source illumination state.
[0035] In one optional embodiment, performing second image optimization processing on the original image to obtain the second target image includes:
[0036] The intensity calculation model of diffuse reflection is used to estimate the brightness influence scale of each pixel in the original image;
[0037] The grayscale value of each pixel is multiplied by the brightness influence scale of each pixel to obtain a second target image after the global brightness of the original image is uniformly processed.
[0038] In one of the optional embodiments, the method further comprises:
[0039] When the original image is not illuminated by the second light source, the pixel means of the three color channels of the original image are obtained;
[0040] According to the mean value of each pixel, the pixel value of each pixel in the original image is adjusted to obtain a third target image;
[0041] Determining the first target image or the second target image as the target image includes:
[0042] The first target image, the second target image, or the third target image is determined as the target image.
[0043] In one optional embodiment, the method further comprises:
[0044] The target image is input into the preset fault classification model to obtain the fault classification result of the power inspection.
[0045] In a second aspect, an image processing device is provided, the device comprising:
[0046] An acquisition module is used to acquire the original image of the power inspection scene collected by the drone;
[0047] A judgment module, used to judge whether the image quality of the original image meets the preset quality judgment condition; the quality judgment condition includes the judgment of the illumination state of the light source in the original image;
[0048] The processing module is used to perform image optimization processing on the original image based on a preset image processing algorithm to obtain a target image that meets the quality judgment conditions when the image quality of the original image does not meet the quality judgment conditions.
[0049] According to a third aspect, a computer device is provided, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements any of the methods described in the first aspect when executing the computer program.
[0050] According to a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, any method described in the first aspect is implemented.
[0051] The above-mentioned image processing method, device, computer equipment and storage medium, the computer equipment obtains the original image of the power inspection scene collected by the drone, determines whether the image quality of the original image meets the preset quality judgment condition, and when the image quality of the original image does not meet the quality judgment condition, the original image is optimized based on the preset image processing algorithm to obtain a target image that meets the quality judgment condition. Among them, the quality judgment condition includes the judgment of the light source illumination state in the original image. In this embodiment, after the computer equipment obtains the original image of the power inspection scene collected by the drone, it judges the image quality of the original image, that is, the image quality is judged according to the light source illumination state of the original image, and the original image that does not meet the image quality is optimized, thereby improving the image quality of the original image, and avoiding the problem that the power inspection information cannot be accurately identified due to the poor quality of the original image under the strong light illumination or other light source illumination conditions in the original image, resulting in a low accuracy rate of power inspection fault classification. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Figure 1 A diagram showing an application environment of an image processing method in an embodiment;
[0053] Figure 2 is a schematic flow chart of an image processing method in one embodiment;
[0054] Figure 3 is a schematic flow chart of an image processing method in one embodiment;
[0055] Figure 4 is a schematic flow chart of an image processing method in one embodiment;
[0056] Figure 5 is a schematic flow chart of an image processing method in one embodiment;
[0057] Figure 6 is a schematic flow chart of an image processing method in one embodiment;
[0058] Figure 7 is a schematic flow chart of an image processing method in one embodiment;
[0059] Figure 8 is a schematic flow chart of an image processing method in one embodiment;
[0060] Fig. 9 is a schematic flow chart of an image processing method in one embodiment;
[0061] Fig.10 is a schematic flow chart of an image processing method in one embodiment;
[0062] Fig.11 is a structural block diagram of an image processing device in one embodiment;
[0063] Fig.12 FIG. 4 is a structural block diagram of an image processing device in an embodiment. DETAILED DESCRIPTION
[0064] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application 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 application and are not used to limit the present application.
[0065] The image processing method provided in this application can be applied to Figure 1 In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as shown in FIG. Figure 1As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, an image processing method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0066] Those skilled in the art will understand that Figure 1 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0067] The following will explain in detail the technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems through embodiments and in combination with the accompanying drawings. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. It should be noted that the present application Figure 2-Figure 10 The image processing method provided in the embodiment is executed by a computer device or an image processing apparatus, and the image processing apparatus can be part or all of the computer device through software, hardware, or a combination of software and hardware. In the following method embodiments, the execution subject is a computer device as an example for explanation.
[0068] In the power inspection scenario based on drones, since the image acquisition equipment on the drone is easily affected by weather conditions when collecting images, the collected original images will have problems such as insufficient tolerance, unclear dark details, overexposure, underexposure, uneven brightness distribution, etc., and such low-quality images cannot be directly processed by artificial intelligence algorithms. Computer equipment cannot perform fault identification and classification in power inspection scenarios based on low-quality images, resulting in low accuracy in power inspection fault identification. In one embodiment, Figure 2As shown, an image processing method is provided, which involves a process in which a computer device acquires an original image of a power inspection scene collected by a drone, determines whether the image quality of the original image meets a preset quality determination condition, and performs image optimization processing on the original image based on a preset image processing algorithm when the image quality of the original image does not meet the quality determination condition, and obtains a target image that meets the quality determination condition, including the following steps:
[0069] S201. Obtaining original images of the power inspection scene collected by the drone.
[0070] Among them, since the power inspection scene often has a harsh environment, this embodiment adopts drone inspection technology, sets an image acquisition device on the drone, controls the drone to collect image data of the power inspection scene, and then performs image recognition based on the collected image of the power inspection scene to determine whether there is a power fault in the current power inspection scene. The original image here refers to the initial image of the power inspection scene collected by the drone's image acquisition device.
[0071] In this embodiment, the computer device can obtain the original image of the power inspection scene transmitted by the drone according to the agreed transmission protocol, and the original image is at least one. Alternatively, the original image of the power inspection scene collected by the drone can be imported into the computer device by importing, which is not limited in this embodiment.
[0072] S202: Determine whether the image quality of the original image meets a preset quality determination condition.
[0073] Among them, the quality judgment conditions include the judgment of the light source illumination state in the original image, that is, the computer equipment can judge whether there is light source interference in the original image, and in the case of light source interference, judge which light source illumination state the original image is in, wherein the light source illumination state includes direct sunlight state, artificial light source illumination state, etc.
[0074] In this embodiment, different light source illumination states correspond to different quality judgment conditions. When the computer device makes a quality judgment on the original image, it can first determine whether there is light source interference in the original image. If there is light source interference, in the case of light source interference, the original image is in which light source illumination state. Thus, based on the corresponding quality judgment conditions in the current light source illumination state, it is determined whether the original image meets the quality judgment conditions. For example, if the computer device determines that the original image is in an artificial light source illumination state, in this illumination state, the computer device can obtain the gray value information of the original image, and determine whether the original image meets the quality judgment conditions based on the gray value information of the original image. This embodiment does not limit this.
[0075] S203: When the image quality of the original image does not meet the quality determination condition, the original image is optimized based on a preset image processing algorithm to obtain a target image that meets the quality determination condition.
[0076] The preset image processing algorithm refers to a processing algorithm that matches the light source illumination state of the original image. For example, when the original image is illuminated by artificial light, the computer device can use a first image processing algorithm to process the original image; when the original image is directly illuminated by the sun, the computer device can use a second image processing algorithm to process the original image, thereby obtaining a target image after image optimization processing. The image optimization processing algorithms include white balance processing algorithms, Contrast Limited Adaptive Histogram Equalization (CLAHE), homomorphic filtering Retinex and other image enhancement algorithms, diffuse reflection intensity calculation models, etc.
[0077] Optionally, in this embodiment, after the computer device performs image optimization processing on the original image, a target image that meets the quality judgment conditions is obtained, and the target image is input into a preset fault classification model to obtain a fault classification result of the power inspection.
[0078] Among them, the fault classification results of the power inspection include equipment faults, line faults, etc. In this embodiment, after obtaining the target image, the computer device uses the target image as input data of the fault classification model to obtain the fault classification result corresponding to the target image, so that the faults in the current power inspection scene can be located and classified. Furthermore, the computer device can also output fault reminder information to remind the power system maintenance personnel to perform timely maintenance and update of the faulty equipment or faulty lines.
[0079] In the above-mentioned image processing method, the computer device obtains the original image of the power inspection scene collected by the drone, determines whether the image quality of the original image meets the preset quality judgment condition, and when the image quality of the original image does not meet the quality judgment condition, the original image is optimized based on the preset image processing algorithm to obtain a target image that meets the quality judgment condition. Among them, the quality judgment condition includes the judgment of the light source illumination state in the original image. In this embodiment, after the computer device obtains the original image of the power inspection scene collected by the drone, it judges the image quality of the original image, that is, it judges the image quality according to the light source illumination state of the original image, and optimizes the original image that does not meet the image quality, thereby improving the image quality of the original image, and avoiding the problem that the power inspection information cannot be accurately identified due to the poor quality of the original image under the strong light illumination or other light source illumination state in the original image, resulting in a low accuracy rate of power inspection fault classification.
[0080] The computer device determines whether the original image meets the preset quality judgment condition based on the light source illumination state of the original image, wherein the light source illumination state can be reflected by the grayscale histogram of the original image. Specifically, in one optional embodiment, Figure 3 As shown, in the above step 202, judging whether the image quality of the original image meets the preset quality judgment condition includes:
[0081] S301: Determine the grayscale histogram of the original image.
[0082] In this embodiment, the computer device determines a grayscale histogram corresponding to the original image according to the grayscale value of each pixel of the original image.
[0083] S302: Determine whether the image quality of the original image meets a preset quality determination condition according to the grayscale histogram of the original image.
[0084] Among them, the quality judgment condition also includes a grayscale threshold.
[0085] In this embodiment, the computer device compares the grayscale histogram of the original image with the grayscale threshold in the quality determination condition to determine whether the original image meets the quality determination condition.
[0086] Optionally, the computer device may determine whether the image quality of the original image meets a preset quality determination condition according to the following embodiments, such as Figure 4 As shown, in the above step 302, the computer device determines whether the image quality of the original image meets the preset quality judgment condition according to the grayscale histogram of the original image, including:
[0087] S401, determining a mean value of a grayscale histogram according to a grayscale histogram of an original image;
[0088] S402, calculating the variance of the grayscale histogram and the mean of the grayscale histogram;
[0089] S403: When the variance is less than a preset threshold, determining that the image quality of the original image meets a preset quality determination condition;
[0090] S404: When the variance is greater than or equal to a preset threshold, determine that the image quality of the original image does not meet a preset quality determination condition.
[0091] In this embodiment, the computer device calculates the grayscale mean of the grayscale histogram according to the grayscale histogram of the original image, and calculates the variance of each grayscale value in the grayscale histogram and the grayscale mean according to the calculated grayscale mean, so as to determine whether the image quality of the original image meets the preset quality determination condition according to the variance and the grayscale threshold in the quality determination condition. For example, when the variance is less than the preset threshold, it means that the histogram of the original image is smooth and the image quality is good. At this time, it is determined that the image quality of the original image meets the preset quality determination condition; when the variance is greater than or equal to the preset threshold, it means that the grayscale histogram of the original image may present a concave shape, a convex shape, a left high and a right low shape, a left low and a right high shape, etc., which respectively correspond to the high image imaging contrast or high contrast of the image in the original image, the low image imaging contrast or the overall graying, the image underexposure, the image overexposure, etc. At this time, it means that the image quality of the original image is poor and does not meet the preset quality determination condition, and this embodiment does not limit this.
[0092] In this embodiment, the computer device obtains the grayscale histogram of the original image, and determines whether the image quality of the original image meets the preset quality judgment conditions based on the grayscale histogram and the preset threshold. This method is simple and effective in making a preliminary judgment on the image quality of the original image, laying the foundation for subsequent image optimization processing of images that do not meet the quality judgment conditions.
[0093] When the computer device determines that the original image does not meet the preset quality judgment condition, the computer device needs to perform image optimization processing on the original image. In one optional embodiment, Figure 5 As shown, in the above step 203, the original image is optimized based on a preset image processing algorithm to obtain a target image that meets the quality determination conditions, including:
[0094] S501: Based on the original image and a preset decision tree algorithm, determine whether the original image is in a first light source illumination state.
[0095] The first light source irradiation state is a direct sunlight state. In this embodiment, the computer device determines whether the original image is in a direct sunlight state by using a decision tree algorithm.
[0096] Alternatively, if Figure 6 As shown, determining whether the original image is in the state of being illuminated by the first light source includes:
[0097] S601, obtaining the exchangeable image file EXIF information of the original image;
[0098] S602, determining the shooting parameters of the original image according to the EXIF information; the shooting parameters include shooting aperture, exposure time, and weather conditions;
[0099] S603: If the weather condition is cloudy or sunny, the shooting aperture is smaller than the preset aperture threshold, and the exposure time is smaller than the preset exposure threshold, it is determined that the original image is in a state of being illuminated by the first light source;
[0100] S604: If the weather is cloudy or sunny, and the shooting aperture is greater than or equal to the preset aperture threshold, or the exposure time is greater than or equal to the preset exposure threshold, it is determined that the original image is not illuminated by the first light source.
[0101] In this embodiment, the computer device obtains the EXIF information of the original image, which includes the attribute information and shooting parameters of the original image. The computer device determines the shooting parameters of the current original image based on the EXIF information, that is, determines the shooting aperture, exposure time, weather conditions and other information corresponding to the current original image. After determining the shooting parameters of the current original image, the computer device compares the shooting parameters with the corresponding thresholds to determine whether the current original image is shot under direct sunlight. For example, if the computer device determines that the weather condition of the current original image is cloudy or sunny, and the shooting aperture of the current original image is less than the preset aperture threshold and the exposure time is less than the preset exposure threshold, then it is determined that the current original image is shot under direct sunlight. If the computer device determines that the weather condition of the current original image is cloudy or sunny, and the shooting aperture of the current original image is greater than or equal to the preset aperture threshold, and the exposure time is greater than or equal to the preset exposure threshold, then it is determined that the current original image is not taken under direct sunlight; or, if the computer device determines that the weather condition of the current original image is raining, at this time, the computer device can directly determine that the current original image is not taken under direct sunlight, and this embodiment does not limit this.
[0102] S502: If the original image is in a state of being illuminated by a first light source, a first image optimization process is performed on the original image to obtain a first target image.
[0103] In this embodiment, if the computer device determines that the current original image is taken under direct sunlight, it determines a first image processing algorithm corresponding to the current illumination state, performs a first image optimization process on the original image, and obtains a first target image that meets the quality judgment conditions.
[0104] Optionally, the computer device performs first image optimization processing on the original image to obtain a first target image, including:
[0105] According to a preset image enhancement algorithm, the original image is corrected to obtain a first target image.
[0106] The image enhancement algorithm includes image enhancement algorithms such as Contrast Limited Adaptive Histogram Equalization (CLAHE) and homomorphic filtering Retinex. Based on these image enhancement algorithms, the brightness of the dark area in the original image is increased to obtain the first target image. Alternatively, the computer device can also perform equalization correction on the grayscale histogram of the original image to obtain the first target image.
[0107] In this embodiment, for example, after the computer device performs the first image optimization processing on the original image, it can also perform a secondary judgment on the image quality of the optimized candidate image. Optionally, the computer device can calculate the sum of the squares of the grayscale values of each pixel in the candidate image and the grayscale values of the surrounding four neighboring pixels, and then divide the sum of the squares by the number of square terms to obtain a ratio. If the ratio reaches a preset threshold, it is considered that the optimization processing of the original image is successful and the image quality is good. At this time, the candidate image is used as the first target image. Further, the first target image can be input into the fault classification model to perform power inspection fault identification and classification. If the ratio does not reach the preset threshold, it means that the image quality of the candidate image is poor. At this time, the computer device can control the drone to adjust the exposure strategy of the image acquisition device and adopt three different exposure strategies, for example, using three different exposure times of short, medium and long to re-shoot at the same location. For the original images collected under different exposure strategies, each original image is divided into multiple blocks, and the grayscale histogram is calculated for the divided blocks to obtain the grayscale histogram distribution, and the areas with moderate exposure are spliced to obtain an original image with global uniform exposure, and the original image with global uniform exposure is used as the input of the fault classification model, which is not limited in this embodiment.
[0108] S503: If the original image is not in the state of being illuminated by the first light source, determine whether the original image is in the state of being illuminated by the second light source.
[0109] The second light source illumination state may be an artificial light source illumination state. For example, the artificial light source illumination includes illumination by different types of lights.
[0110] In this embodiment, if the computer device determines that the original image was not taken under direct sunlight, the computer device can determine whether the original image was taken under artificial light based on the aperture parameters of the drone's image acquisition device and the histogram of the original image.
[0111] Alternatively, if Figure 7 As shown, the computer device determines whether the original image is in the state of being illuminated by the second light source, including:
[0112] S701, dividing the original image into a preset number of image blocks according to a preset segmentation rule;
[0113] S702, determining the grayscale histogram distribution of each image block;
[0114] S703: If the maximum value of the grayscale histogram of the image block is greater than a preset threshold, it is determined that the original image is in a state of being illuminated by the second light source;
[0115] S704: If the maximum value of the grayscale histogram of the image block is less than or equal to the preset threshold, it is determined that the original image is not in the second light source illumination state.
[0116] In this embodiment, the computer device determines that the original image is not taken under direct sunlight. In this case, the computer device can divide the original image into a preset number of image blocks according to the preset horizontal and vertical segmentation ratios and segmentation steps. For example, the original image is divided into 15 image blocks, and based on each image block, the distribution of the corresponding grayscale histogram is determined, and the size relationship between the grayscale histogram of each image block and the preset threshold is judged to determine whether the original image is taken under the illumination of an artificial light source. For example, if the computer device determines that the maximum value distance of the grayscale histogram of the image block exceeds the preset threshold, it is determined that the original image is taken under the illumination of an artificial light source; if it is determined that the maximum value distance of the grayscale histogram of the image block does not exceed the preset threshold, it is determined that the original image is not taken under the illumination of an artificial light source. This embodiment does not limit this.
[0117] S504: When the original image is illuminated by the second light source, perform second image optimization processing on the original image to obtain a second target image.
[0118] In this embodiment, the computer device determines that the original image is taken under the illumination of artificial light, and then performs second image optimization processing on the original image according to the image processing method corresponding to the current illumination state to obtain a second target image.
[0119] Alternatively, if Figure 8 As shown, the computer device performs second image optimization processing on the original image to obtain a second target image, including:
[0120] S801, estimating the brightness influence scale of each pixel in the original image through a diffuse reflection intensity calculation model.
[0121] In this embodiment, the computer device makes an estimation based on a diffuse reflection intensity calculation model (Lambertian Shading Model). For example, the computer device uses the original image as the input of the model. The model can be used to estimate the brightness unevenness caused by external light sources on the original image, and the output is a light source intensity distribution map corresponding to the original image, wherein the light source intensity distribution map includes the scale of the light source's impact on the brightness of different pixel points in the original image.
[0122] S802: Multiply the grayscale value of each pixel by the brightness influence scale of each pixel to obtain a second target image after global brightness uniform processing of the original image.
[0123] In this embodiment, after obtaining the brightness influence scale of the light source on different pixels in the original image, the computer device multiplies the grayscale value of each pixel by the brightness influence scale of each pixel to unify the global brightness of the original image and obtain a second target image after the global brightness is unified.
[0124] Optionally, after obtaining the second target image, the computer device can also re-judge the image quality of the second target image. The judgment process can refer to the embodiment provided in step 502. When the image quality is good, the second target image is used as the input of the fault classification model to obtain the fault classification result of the power inspection.
[0125] S505: Determine the first target image or the second target image as the target image.
[0126] In this embodiment, the first target image and the second target image are both images that meet the quality judgment conditions. The computer device uses the first target image obtained by optimizing the first image, or the second target image obtained by optimizing the second image as the target image, that is, as the input of the fault classification model, to perform fault identification and classification in the power inspection scenario to obtain a fault classification result.
[0127] In this embodiment, the computer device uses different image optimization processing methods to optimize the original image according to the light source illumination state of the original image, and obtains a target image that meets the quality judgment conditions, thereby performing fault identification and classification based on the target image, and the obtained fault identification result is accurate.
[0128] In addition, in addition to the scenarios given in steps 502, 503, and 504 above, there is another scenario. In one optional embodiment, as Fig. 9 As shown, the method also includes:
[0129] S901, when the original image is not illuminated by the second light source, obtaining pixel means of three color channels of the original image;
[0130] S902: Adjust the pixel value of each pixel in the original image according to the mean value of each pixel to obtain a third target image.
[0131] In this embodiment, if the computer device determines that the original image is not taken under the illumination of artificial light, in this case, the computer device needs to perform white balance processing on the original image. For example, the computer device obtains the pixel mean of the RGB color channel corresponding to each pixel in the original image. When the image quality is good, the pixel mean of the RGB color channel should be the same grayscale value. Based on this principle, the computer device adjusts the pixel value of each pixel of the original image so that the average value of the RGB three channels of each pixel tends to the same grayscale value, and obtains the third target image. For example, the computer device performs statistics on the RGB three channels of each pixel of the original image, and calculates the average value of each channel, which are r_avg, g_avg, and b_avg respectively. In the same image, the average values of the three channels should be roughly close, that is, r_avg is approximately equal to g_avg and approximately equal to b_avg. If not, the three-channel average above_avg is calculated as (r_avg+g_avg+b_avg) / 3, and then each pixel point of each channel is processed, and the adjusted R channel each pixel value is adjusted as (above_avg / r_avg)*R, the adjusted G channel each pixel value is adjusted as (above_avg / g_avg)*G, and the adjusted B channel each pixel value is adjusted as (above_avg / b_avg)*B. This embodiment does not limit this. Further, the computer device can also perform a secondary determination of the image quality of the third target image, and the determination process can refer to the embodiment provided in step 502.
[0132] S903: Determine the first target image, the second target image, or the third target image as the target image.
[0133] Among them, the first target image, the second target image, and the third target image are all images that meet the quality judgment conditions. The computer device uses the first target image obtained by optimizing the first image, or the second target image obtained by optimizing the second image as the target image, or the third target image obtained by optimizing the third image as the target image, that is, as the input of the fault classification model, to perform fault identification and classification in the power inspection scenario to obtain a fault classification result.
[0134] In this embodiment, when the computer device determines that the original image is not in a light source irradiation state or an artificial light source irradiation state, it uses a third image optimization processing method to perform image optimization processing on the original image to obtain a third target image that meets the quality judgment conditions, thereby performing fault identification and classification based on the third target image, and the obtained fault identification result is accurate.
[0135] In order to better illustrate the above method, Fig.10 As shown, this embodiment provides an image processing method, which specifically includes:
[0136] S101, obtaining an original image of a power inspection scene collected by a drone;
[0137] S102, determining a grayscale histogram of the original image;
[0138] S103, determining a mean value of a grayscale histogram according to a grayscale histogram of the original image;
[0139] S104, calculating the variance of the grayscale histogram and the mean of the grayscale histogram;
[0140] S105, determining the relationship between the variance and a preset threshold value. If the variance is less than the preset threshold value, it is determined that the image quality of the original image meets the preset quality determination condition, and step 106 is executed; if the variance is greater than or equal to the preset threshold value, it is determined that the image quality of the original image does not meet the preset quality determination condition, and step 107 is executed;
[0141] S106, inputting the target image into a preset fault classification model to obtain a fault classification result of the power inspection;
[0142] S107, based on the original image and the preset decision tree algorithm, determine whether the original image is in the state of being illuminated by the first light source; if the original image is in the state of being illuminated by the first light source, execute step S108; if the original image is not in the state of being illuminated by the first light source, execute step S109;
[0143] S108, performing a first image optimization process on the original image to obtain a first target image;
[0144] S109, determine whether the original image is in the state of being illuminated by the second light source; if the original image is in the state of being illuminated by the second light source, execute step S110; if the original image is not in the state of being illuminated by the second light source, execute step S111,
[0145] S110, performing second image optimization processing on the original image to obtain a second target image;
[0146] S111, obtaining pixel means of three color channels of the original image;
[0147] S112, adjusting the pixel value of each pixel in the original image according to the mean value of each pixel to obtain a third target image;
[0148] S113: Determine the first target image, the second target image, or the third target image as the target image, and execute step 106.
[0149] In this embodiment, the computer device judges the image quality according to the light source illumination state of the original image, and uses the corresponding image optimization processing method to perform image processing for the original image under different light source illumination states, thereby improving the image quality of the original image in multiple dimensions, and avoiding the problem of low accuracy in power inspection fault classification due to the inability to accurately identify power inspection information due to the presence of strong light illumination or other light source illumination states in the original image, resulting in poor quality of the original image.
[0150] The image processing method provided in the above embodiment has similar implementation principles and technical effects to those of the above method embodiment, and will not be described in detail here.
[0151] It should be understood that although Figure 2-10 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2-10 At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.
[0152] In one embodiment, Fig.11 As shown, an image processing device is provided, comprising:
[0153] Acquisition module 01 is used to acquire the original image of the power inspection scene collected by the drone;
[0154] The judgment module 02 is used to judge whether the image quality of the original image meets the preset quality judgment condition; the quality judgment condition includes the judgment of the illumination state of the light source in the original image;
[0155] The processing module 03 is used to perform image optimization processing on the original image based on a preset image processing algorithm to obtain a target image that meets the quality determination condition when the image quality of the original image does not meet the quality determination condition.
[0156] In one of the optional embodiments, the judgment module 02 is used to determine the grayscale histogram of the original image; and determine whether the image quality of the original image meets a preset quality judgment condition based on the grayscale histogram of the original image.
[0157] In one of the optional embodiments, the judgment module 02 is used to determine the mean of the grayscale histogram based on the grayscale histogram of the original image; calculate the variance between the grayscale histogram and the mean of the grayscale histogram; when the variance is less than a preset threshold, determine that the image quality of the original image meets the preset quality judgment condition; when the variance is greater than or equal to the preset threshold, determine that the image quality of the original image does not meet the preset quality judgment condition.
[0158] In one of the optional embodiments, the processing module 03 is used to determine whether the original image is in a first light source illumination state based on the original image and a preset decision tree algorithm; if the original image is in a first light source illumination state, performing a first image optimization process on the original image to obtain a first target image; if the original image is not in a first light source illumination state, determining whether the original image is in a second light source illumination state; when the original image is in a second light source illumination state, performing a second image optimization process on the original image to obtain a second target image; and determining the first target image or the second target image as the target image.
[0159] In one of the optional embodiments, the processing module 03 is used to obtain the exchangeable image file EXIF information of the original image; determine the shooting parameters of the original image according to the EXIF information; the shooting parameters include shooting aperture, exposure time, and weather conditions; if the weather condition is cloudy or sunny, the shooting aperture is less than a preset aperture threshold, and the exposure time is less than a preset exposure threshold, then it is determined that the original image is in a first light source illumination state; if the weather condition is cloudy or sunny, the shooting aperture is greater than or equal to the preset aperture threshold, or the exposure time is greater than or equal to the preset exposure threshold, then it is determined that the original image is not in a first light source illumination state.
[0160] In one optional embodiment, the processing module 03 is used to correct the original image according to a preset image enhancement algorithm to obtain a first target image.
[0161] In one of the optional embodiments, the processing module 03 is used to divide the original image into a preset number of image blocks according to a preset segmentation rule; determine the grayscale histogram distribution of each image block; if the maximum value of the grayscale histogram of the image block is greater than a preset threshold, determine that the original image is in the second light source illumination state; if the maximum value of the grayscale histogram of the image block is less than or equal to the preset threshold, determine that the original image is not in the second light source illumination state.
[0162] In one of the optional embodiments, the processing module 03 is used to estimate the brightness influence scale of each pixel in the original image through a diffuse reflection intensity calculation model; multiply the grayscale value of each pixel by the brightness influence scale of each pixel to obtain a second target image after the global brightness of the original image is uniformly processed.
[0163] In one of the optional embodiments, the processing module 03 is also used to obtain the pixel means of the three color channels of the original image when the original image is not under the illumination of the second light source; adjust the pixel value of each pixel point in the original image according to each pixel mean to obtain a third target image; and determine the first target image, the second target image, or the third target image as the target image.
[0164] In one of the optional embodiments, Fig.12 As shown, the image processing device further includes a fault classification module 04 for inputting the target image into a preset fault classification model to obtain a fault classification result of the power inspection.
[0165] For the specific definition of the image processing device, please refer to the definition of the image processing method above, which will not be repeated here. Each module in the above image processing device can be implemented in whole or in part by software, hardware and a combination thereof. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0166] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0167] Obtain the original images of the power inspection scene collected by the drone;
[0168] Determine whether the image quality of the original image meets the preset quality determination condition;
[0169] When the image quality of the original image does not meet the quality determination conditions, the original image is optimized based on a preset image processing algorithm to obtain a target image that meets the quality determination conditions.
[0170] The implementation principle and technical effect of the computer device provided in the above embodiment are similar to those of the above method embodiment, and will not be repeated here.
[0171] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0172] Obtain the original images of the power inspection scene collected by the drone;
[0173] Determine whether the image quality of the original image meets the preset quality determination condition;
[0174] When the image quality of the original image does not meet the quality determination conditions, the original image is optimized based on a preset image processing algorithm to obtain a target image that meets the quality determination conditions.
[0175] The computer-readable storage medium provided in the above embodiment has similar implementation principles and technical effects as those of the above method embodiment, and will not be described in detail here.
[0176] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0177] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0178] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. An image processing method, characterized in that: The method comprises: Obtain the original images of the power inspection scene collected by the drone; Determining whether the image quality of the original image meets a preset quality determination condition; the quality determination condition includes determining the illumination state of the light source in the original image; In the case where the image quality of the original image does not meet the quality determination condition, obtaining the exchangeable image file EXIF information of the original image; determining the shooting parameters of the original image according to the EXIF information; the shooting parameters include shooting aperture, exposure time, and weather conditions; if the weather condition is cloudy or sunny, the shooting aperture is less than a preset aperture threshold, and the exposure time is less than a preset exposure threshold, then determining that the original image is in a state of being illuminated by a first light source; if the weather condition is cloudy or sunny, the shooting aperture is greater than or equal to the preset aperture threshold, or the exposure time is greater than or equal to the preset exposure threshold, then determining that the original image is not in a state of being illuminated by the first light source; If the original image is in the state of being illuminated by the first light source, the first image optimization processing is performed on the original image to obtain a first target image; if the original image is not in the state of being illuminated by the first light source, it is determined whether the original image is in the state of being illuminated by the second light source; when the original image is in the state of being illuminated by the second light source, the second image optimization processing is performed on the original image to obtain a second target image; the first target image or the second target image is determined as the target image.
2. The method according to claim 1, characterized in that The determining whether the image quality of the original image meets a preset quality determination condition includes: Determining a grayscale histogram of the original image; According to the grayscale histogram of the original image, it is determined whether the image quality of the original image meets a preset quality determination condition.
3. The method according to claim 2, characterized in that The determining, based on the grayscale histogram of the original image, whether the image quality of the original image meets a preset quality determination condition comprises: Determine the mean of the grayscale histogram according to the grayscale histogram of the original image; Calculating the variance of the grayscale histogram and the mean of the grayscale histogram; When the variance is less than a preset threshold, determining that the image quality of the original image meets the preset quality determination condition; When the variance is greater than or equal to the preset threshold, it is determined that the image quality of the original image does not meet the preset quality determination condition.
4. The method according to claim 1, characterized in that: The performing first image optimization processing on the original image to obtain a first target image includes: According to a preset image enhancement algorithm, the original image is subjected to equalization correction processing to obtain the first target image.
5. The method according to claim 1, characterized in that The determining whether the original image is in a state of being illuminated by a second light source comprises: According to a preset segmentation rule, the original image is segmented into a preset number of image blocks; Determining the grayscale histogram distribution of each of the image blocks; If the maximum value of the grayscale histogram of the image block is greater than a preset threshold, it is determined that the original image is in a state of being illuminated by the second light source; If the maximum value of the grayscale histogram of the image block is less than or equal to the preset threshold, it is determined that the original image is not in the second light source illumination state.
6. The method according to claim 5, characterized in that The performing second image optimization processing on the original image to obtain a second target image includes: Estimate the brightness impact scale of each pixel in the original image through a diffuse reflection intensity calculation model; The grayscale value of each pixel point is multiplied by the brightness influence scale of each pixel point to obtain a second target image after the global brightness of the original image is uniformly processed.
7. The method according to claim 1, characterized in that The method further comprises: When the original image is not illuminated by the second light source, obtaining pixel means of three color channels of the original image; According to the pixel means, the pixel value of each pixel point in the original image is adjusted to obtain a third target image; The determining the first target image or the second target image as the target image comprises: The first target image, the second target image, or the third target image is determined as the target image.
8. An image processing device, characterized in that: The device comprises: An acquisition module is used to acquire the original image of the power inspection scene collected by the drone; A judgment module, used to judge whether the image quality of the original image meets a preset quality judgment condition; the quality judgment condition includes a judgment on the illumination state of the light source in the original image; A processing module, configured to obtain, when the image quality of the original image does not meet the quality determination condition, the exchangeable image file EXIF information of the original image; determine the shooting parameters of the original image according to the EXIF information; the shooting parameters include shooting aperture, exposure time, and weather conditions; if, when the weather condition is cloudy or sunny, the shooting aperture is less than a preset aperture threshold, and the exposure time is less than a preset exposure threshold, determine that the original image is in a state of being illuminated by a first light source; if, when the weather condition is cloudy or sunny, the shooting aperture is greater than or equal to the preset aperture threshold, or the exposure time is greater than or equal to the preset exposure threshold, determine that the original image is not in a state of being illuminated by the first light source; If the original image is in the state of being illuminated by the first light source, the first image optimization processing is performed on the original image to obtain a first target image; if the original image is not in the state of being illuminated by the first light source, it is determined whether the original image is in the state of being illuminated by the second light source; when the original image is in the state of being illuminated by the second light source, the second image optimization processing is performed on the original image to obtain a second target image; the first target image or the second target image is determined as the target image.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
