Image correction method and device, computer equipment and readable storage medium
By initializing and reconstructing the transmission line images captured by the ultraviolet camera, and pixel correction is performed in combination with the pixel values of the front and rear frames, the problem of low UV image quality is solved and higher quality image correction and detection is achieved.
Patent Information
- Application Number
- CN202411742197.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-04-11
AI Technical Summary
In the existing ultraviolet imaging technology, the transmission line images captured by ultraviolet cameras are not of high quality and are greatly affected by light, weather and equipment noise, resulting in uneven image brightness, color distortion and noise interference, affecting detection accuracy.
By acquiring at least N frames of continuous original images of the target scene, the image is initialized and reconstructed to form an initial image, and then pixel correction is performed on the current frame image based on the pixel values of the initial images of the previous x-frame and the subsequent y-frame initial images, abnormal pixel blocks are detected and repaired to achieve pixel-level correction.
It significantly improves the clarity and quality of ultraviolet images, reduces the impact of light, weather and equipment noise, enhances the accuracy and stability of image correction, and provides more reliable image data for subsequent applications.
Smart Images

Figure CN119809983A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of ultraviolet imaging technology, and in particular to an image correction method, device, computer equipment and readable storage medium. Background Art
[0002] my country is not only a large electricity consumer, but also a large electricity producer, with abundant resources such as coal, hydropower, solar energy and wind energy. my country has achieved long-distance, large-capacity and low-loss power transmission by widely building high-voltage and ultra-high-voltage lines to balance energy demand and supply across the country. Due to the complex topography and diverse climate in my country, the transmission lines and various power facilities must not only climb mountains, skim plateaus, cross basins, cross rivers and grasslands, but also suffer from the erosion of various weather conditions such as scorching sun, rain, snow, wind and frost; various insulation facilities on the transmission lines are increasingly polluted, and the insulation level is greatly reduced, resulting in partial discharge under abnormal working conditions. In addition, due to long-term stress work, power facilities such as transmission lines will inevitably suffer from loose strands, broken strands, aging and other damage phenomena. When such defects occur, they are often accompanied by partial discharge. During the discharge process, the air will be electrolyzed to produce some corrosive gases. If the transmission facilities are in a discharge state for a long time, the degradation of the insulation devices will be accelerated. Eventually, the insulation equipment will be broken down and the transmission lines will be interrupted, leading to large-scale power outages, which will not only cause huge economic losses but also affect social operations.
[0003] Therefore, the detection of transmission line discharge is an indispensable part of power grid operation. Transmission lines have long transmission spans and are located in a variety of terrains. These factors bring many inconveniences to the discharge detection of transmission lines. At present, the commonly used discharge detection methods in my country include manual inspection, helicopter inspection, and drone inspection. Manual inspection uses various discharge detection instruments and conducts discharge detection on transmission lines based on their own experience. However, it often takes a long time and effort to evaluate the safety status of an entire line. In addition, the conditions during the inspection are difficult, and the life safety of the inspectors cannot be guaranteed. Helicopter inspection uses helicopters to inspect transmission lines erected on special terrains, but helicopter inspections are relatively expensive on the one hand and require special airspace approval on the other. The rapidly developing drone inspection has also been gradually put into use, but drone inspections still have problems such as being unable to monitor in real time and being unable to be used under severe weather conditions. Therefore, there is an urgent need to develop online transmission line detection equipment that is not affected by weather conditions and can be online all the time.
[0004] Ultraviolet imaging technology obtains image information by capturing the reflection or emission characteristics of an object in the ultraviolet light range. Compared with visible light imaging, it can obtain richer image information. The use of ultraviolet imaging analysis can reveal the spectral characteristics, chemical composition and physical state of substances. It has important applications in environmental monitoring, aerospace, material analysis and medical diagnosis. Therefore, in the related art, ultraviolet cameras are usually used to shoot images of transmission lines to monitor the transmission lines. However, the quality of the images taken by ultraviolet cameras in the related art is not high. Summary of the invention
[0005] Based on this, it is necessary to provide an image correction method, device, computer equipment and readable storage medium that can improve the image quality of images taken by an ultraviolet camera in order to solve the above technical problems.
[0006] In a first aspect, the present application provides an image correction method, the method comprising:
[0007] Acquire at least N frames of continuous original images of the target scene, where N ≥ 3;
[0008] Initializing and reconstructing the original image to form an initial image;
[0009] According to the pixel values of each pixel block in the x-frame initial image before the i-frame initial image and the pixel values of each pixel block in the y-frame initial image after the i-frame initial image, the i-frame initial image is pixel-corrected to form a target repaired image, wherein x≥1, y≥1, 1≤ix≤i≤i+y≤N;
[0010] The target repaired image is inversely reconstructed to obtain the target corrected image.
[0011] In one embodiment, the initializing and reconstructing the original image to form an initial image includes:
[0012] Performing grayscale conversion processing on the original image to form an initialized original image;
[0013] The initialized original image is reconstructed to form an initial image.
[0014] In one embodiment, reconstructing the initialized original image to form an initial image includes:
[0015] Segmenting the initialized original image according to a preset grid size to obtain m original sub-images, wherein the preset grid size is n*n, m=n*n, n>1;
[0016] Obtaining pixel values of pixel blocks at the same position in each of the original sub-images to form m pixel value sets;
[0017] For each pixel value set, fill the pixel values in the pixel value set into preset blank sub-images respectively to form initial sub-images, wherein the number of the initial sub-images is the same as the number of the original sub-images;
[0018] The initial sub-images are spliced to form an initial image.
[0019] In one embodiment,
[0020] The method of performing pixel correction on the i-th frame of the initial image according to the pixel values of each pixel block in the x-frame initial image before the i-th frame of the initial image and the pixel values of each pixel block in the y-frame initial image after the i-th frame of the initial image to form a target repaired image includes:
[0021] According to the pixel values of each pixel block in the x-frame initial image before the i-frame initial image and the pixel values of each pixel block in the y-frame initial image after the i-frame initial image, it is determined whether there is an abnormal pixel block in the i-frame initial image;
[0022] In the case where there is an abnormal pixel block in the i-th frame initial image, the pixel value of the abnormal pixel block in the i-th frame initial image is updated according to the pixel value of the pixel block at the position where the abnormal pixel block is located in the previous x frames initial image and the pixel value of the pixel block at the position where the abnormal pixel block is located in the next y frames initial image;
[0023] When there is no abnormal pixel block in the i-th frame initial image, the i-th frame initial image is directly determined as the target repair image.
[0024] In one embodiment,
[0025] The method of judging whether there is an abnormal pixel block in the i-th frame of the initial image according to the pixel values of each pixel block in the x-frame initial image before the i-th frame of the initial image and the pixel values of each pixel block in the y-frame initial image after the i-th frame of the initial image comprises:
[0026] If the difference between the pixel value of the pixel block at the target position in the i-th frame of the initial image and the pixel value of the pixel block at the target position in the i-1-th frame of the initial image is greater than a preset pixel threshold, and the differences between the pixel values of the pixel block at the target position in each of the previous x frames of the initial image and the pixel values of the pixel block at the target position in the adjacent previous frame of the initial image are not greater than the preset pixel threshold, the pixel block at the target position in the i-th frame of the initial image is marked as a suspected abnormal pixel block;
[0027] If there is at least one pixel block at the target position of the initial image in the subsequent y frames of initial image, and the difference between the pixel value of the pixel block and the pixel value of the suspected abnormal pixel block in the i-th frame of initial image is greater than the preset pixel threshold, the suspected abnormal pixel block is marked as an abnormal pixel block.
[0028] In one embodiment,
[0029] The updating of the pixel value of the abnormal pixel block in the i-th frame initial image according to the pixel value of the pixel block at the position where the abnormal pixel block is located in the previous x frames initial image and the pixel value of the pixel block at the position where the abnormal pixel block is located in the next y frames initial image comprises:
[0030] Performing weighted summation on the pixel values of the pixel block at the position where the abnormal pixel block is located in the previous x frames of the initial image and the pixel values of the pixel block at the position where the abnormal pixel block is located in the next y frames of the initial image to obtain a target pixel value;
[0031] According to the target pixel value, pixel values of abnormal pixel blocks in the i-th frame initial image are updated.
[0032] In one embodiment, for each initial image among the first x frames of initial images and the last y frames of initial images, in the process of weighted summation, the weight used for the initial image is negatively correlated with the corresponding spacing of the initial image; the corresponding spacing of the initial image refers to the spacing between the initial image and the i-th frame of initial image.
[0033] In a second aspect, the present application provides an image correction device, the device comprising:
[0034] A first acquisition module is used to acquire at least N frames of continuous original images of the target scene, where N ≥ 3;
[0035] A first reconstruction module, used for initializing and reconstructing the original image to form an initial image;
[0036] The first correction module is used to perform pixel correction on the i-th frame of the initial image according to the pixel values of each pixel block in the x-frame initial image before the i-th frame of the initial image and the pixel values of each pixel block in the y-frame initial image after the i-th frame of the initial image, so as to form a target repaired image, wherein x≥1, y≥1, 1≤ix≤i≤i+y≤N pixel blocks;
[0037] The first inverse reconstruction module is used to perform inverse reconstruction processing on the target repaired image to obtain a target corrected image.
[0038] In a third aspect, the present application provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the image correction method described in any one of the above embodiments when executing the computer program.
[0039] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the steps of the image correction method described in any one of the above embodiments are implemented.
[0040] The above-mentioned image correction method, device, computer equipment and readable storage medium obtain at least N frames of continuous original images of the target scene, initialize and reconstruct the original images to form an initial image, and then detect whether the pixel value of each pixel block in the i-th frame initial image is within a normal range based on the pixel value of each pixel block in the x-frame initial image before the i-th frame initial image and the pixel value of each pixel block in the y-frame initial image after the i-th frame initial image, so as to find out the abnormal pixel block in the i-th frame initial image, and repair the pixel value of the abnormal pixel block in the i-th frame initial image based on the pixel value of the corresponding pixel block in the x-frame initial image before the i-th frame initial image and the pixel value of the corresponding pixel block in the y-frame initial image after the i-th frame initial image, so as to realize pixel-level correction of the ultraviolet image and obtain a high-quality target repaired image. Finally, by performing inverse reconstruction processing on the repaired target repaired image, a high-quality target corrected image can be obtained. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments of the present application or the related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0042] Figure 1 is a schematic flow chart of an image correction method in one embodiment;
[0043] Figure 2 is a flow chart of step S102 in one embodiment;
[0044] Figure 3 is a flow chart of step S202 in one embodiment;
[0045] Figure 4 is a flow chart of step S103 in one embodiment;
[0046] Figure 5 is a flow chart of step S401 in one embodiment;
[0047] Figure 6 is a flow chart of step S402 in one embodiment;
[0048] Figure 7 is a structural block diagram of an image correction device in one embodiment;
[0049] Figure 8 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0050] 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.
[0051] As mentioned in the background technology section, UV imaging technology obtains image information by capturing the reflection or emission characteristics of objects in the UV range. Compared with visible light imaging, it can obtain richer image information. The use of UV imaging analysis can reveal the spectral characteristics, chemical composition and physical state of substances, and has important applications in environmental monitoring, aerospace, material analysis and medical diagnosis.
[0052] However, due to the sensitivity of the imaging device, changes in lighting conditions and environmental factors (weather changes such as foggy days), UV images are prone to uneven brightness and color. These unevenness can cause some areas in the image to be too bright or too dark, resulting in uneven brightness and color distortion. The details of the local area become unclear or blurred due to uneven lighting, affecting the clarity and uniformity of the image details, and the difficulty and accuracy of subsequent analysis and recognition of image details. UV imaging cameras are also susceptible to background noise when working, such as electromagnetic waves, thermal noise and noise from the equipment itself. These noises will form dry, messy and random pixels in the image, introduce background noise and useless information, and reduce the quality of the image.
[0053] For example, in the discharge detection of high-voltage insulators, the ultraviolet image often has uneven brightness and color due to the sensitivity of the imaging equipment and changes in ambient lighting conditions. When actually conducting long-distance ultraviolet detection imaging at high altitudes, strong sunlight or dark weather conditions will cause inconsistent brightness and color deviation in the ultraviolet image. This unevenness will cause local areas to be too bright or too dark and color unevenness, affecting the accurate identification of the discharge phenomenon and increasing the difficulty of identification. At the same time, due to environmental distribution (temperature thermal noise), electromagnetic noise and the inherent response characteristics of the sensor (equipment electronic noise), it will also cause abnormal noise in the image, forming messy interfering pixels, which not only reduces the clarity of the image, but may also cover up the discharge phenomenon, increase the difficulty of detection, and make it difficult to accurately identify and locate.
[0054] Based on the above technical problems, in an exemplary embodiment, please refer to Figure 1 , the present application provides an image correction method, which includes steps S101 to S104.
[0055] S101: Acquire at least N frames of continuous original images of a target scene, where N≥3.
[0056] It can be understood that the ultraviolet camera is usually fixed at a certain location to continuously monitor the target scene, and then at least N frames of continuous original images of the target scene taken by the ultraviolet camera can be obtained.
[0057] S102: Initialize and reconstruct the original image to form an initial image.
[0058] After obtaining N frames of continuous original images, the N frames of original images need to be preprocessed, such as grayscale conversion, grid segmentation, etc., to finally form an initial image.
[0059] S103: Perform pixel correction on the i-th frame initial image according to the pixel values of each pixel block in the x-frame initial image before the i-th frame initial image and the pixel values of each pixel block in the y-frame initial image after the i-th frame initial image to form a target repaired image, wherein x≥1, y≥1, 1≤ix≤i≤i+y≤N.
[0060] In this embodiment, the pixel block may include at least one pixel block, the pixel value of the pixel block is the sum of the pixel values of all the pixel blocks in the pixel block, and the sizes of the pixel blocks are the same. After acquiring the initial image, it can be determined whether the pixel value of the pixel block at the target position in the i-th frame initial image is abnormal according to the pixel value of the pixel block at the target position in the x-frame initial image before the i-th frame initial image and the pixel value of the pixel block at the target position in the y-frame initial image after the i-th frame initial image, and when the pixel value of the pixel block at the target position in the i-th frame initial image is abnormal, the pixel value of the pixel block at the target position in the i-th frame initial image is corrected. By performing pixel value abnormality judgment and correction on each pixel block of the i-th frame initial image according to this method, the i-th frame initial image can be repaired at the pixel level to obtain the target repaired image of the i-th frame initial image.
[0061] S104: Perform inverse reconstruction processing on the target repaired image to obtain a target corrected image.
[0062] Finally, according to the reconstruction method of reconstructing the original image into the initial image, the target repaired image is inversely reconstructed to obtain the target corrected image of the original image. The image correction method of the present application can eliminate the interference of the sensitivity of the imaging device and environmental factors on the ultraviolet image, realize the correction of the ultraviolet image pixel level, improve the clarity of the ultraviolet image, and improve the image quality.
[0063] The above-mentioned image correction method includes acquiring at least N frames of continuous original images of the target scene, initializing and reconstructing the original images to form an initial image, and then detecting whether the pixel values of each pixel block in the i-th frame initial image are within a normal range based on the pixel values of each pixel block in the x-frame initial images before the i-th frame initial image and the pixel values of each pixel block in the y-frame initial images after the i-th frame initial image, thereby finding out the abnormal pixel blocks in the i-th frame initial image, and repairing the pixel values of the abnormal pixel blocks in the i-th frame initial image based on the pixel values of the corresponding pixel blocks in the x-frame initial images before the i-th frame initial image and the pixel values of the corresponding pixel blocks in the y-frame initial images after the i-th frame initial image, thereby realizing pixel-level correction of the ultraviolet image and obtaining a high-quality target repaired image, and finally obtaining a high-quality target corrected image by performing an inverse reconstruction process on the repaired target repaired image.
[0064] The image correction method proposed by the present invention has the following significant advantages:
[0065] First, in the pixel correction link, the pixel values of multiple consecutive frames of original images are used for analysis and processing to realize the logic of dynamic fusion of multiple frames of information. By analyzing the correlation of multiple frames of images in time series, it is no longer limited to the static feature processing of a single frame of image. The pixel value is dynamically judged and adjusted according to the changes in the image sequence. Based on the logic of multiple consecutive frames of original images and multi-frame information fusion, the accuracy and stability of image correction are significantly improved. The current frame is corrected by dynamically analyzing the pixel values of multiple frames of images, so that the correction result can better fit the actual situation of the actual scene, reduce the influence of lighting, weather, and equipment noise, and provide more reliable image data for subsequent applications (such as image analysis, recognition, etc.); compared with the traditional method that may use fixed thresholds or templates to process abnormal pixels, the method of the present invention can deal with the problem of abnormal pixels more flexibly and accurately according to the dynamic information of multiple frames of images, thereby enhancing the ability of the entire image correction method to handle abnormal situations;
[0066] Second, the data structure adjustment of the original image (through segmentation, forming a set of pixel values, generating initial sub-images and splicing and other reconstruction processes) is coordinated with the subsequent pixel correction logic. The reconstruction process provides a regularized and easier to analyze and process data structure basis for pixel correction, so that pixel correction can operate on each pixel block more accurately based on the information of the previous and next frames. Through image segmentation and reconstruction, the area occupied by non-uniform features in the image is reduced, the number of interfering pixel blocks and non-uniform noise pixels in the local area is reduced, the amount of calculation is reduced, and the calculation speed is improved.
[0067] In an exemplary embodiment, see Figure 2 , step S102, initializing and reconstructing the original image to form an initial image, including step S201 and step S202.
[0068] S201: Perform grayscale conversion processing on the original image to form an initialized original image.
[0069] In the application, the original image may first be subjected to grayscale conversion processing so that the pixel value range of the pixel points in the initialized original image is [0, 255].
[0070] S202: reconstructing the initialized original image to form an initial image.
[0071] Afterwards, according to the size of the original image and processing requirements, the original image after grayscale conversion can be quickly processed according to the convolution kernel of the preset grid size, and the entire image can be divided into several sub-images of the same size according to the grid size, and then these several sub-images are reconstructed to form the initial image.
[0072] In an exemplary embodiment, see Figure 3, step S202, reconstructing the initialized original image to form an initial image, including steps S301 to S304.
[0073] S301: Segment the initialized original image according to a preset grid size to obtain m original sub-images, wherein the preset grid size is n*n, m=n*n, n>1.
[0074] Specifically, first, according to the size of the original image and the processing requirements, a suitable grid size is selected, and the initialized original image is divided into m original sub-images. For example, n=3, and the preset grid size can be 3*3. The initialized original image is divided into 9 original sub-images, each of which has at least 9 pixel blocks, wherein the original sub-image has 9 target pixel blocks, and the original sub-image can be obtained by splicing all the target pixel blocks in the original sub-image, and there is no overlap of pixels between the target pixel blocks. In other examples, the preset grid size can also be 4*4, 8*8, 16*16, 32*32, etc.
[0075] S302: Obtain pixel values of pixel blocks at the same position in each original sub-image to form m pixel value sets.
[0076] After the initialized original image is divided into m original sub-images, the pixel values of the target pixel blocks at the same position in each original sub-image can be extracted. For example, the pixel value A of the target pixel block at the position (h, j) in each original sub-image can be extracted. s (h, j), and combine them to form a pixel value set, where A s (h, j) represents the pixel value of the target pixel block in the hth row and jth column of the sth original sub-image. The target pixel block at the position (h, j) refers to the target pixel block centered on the pixel point at the position (h, j). Since there are m target pixel blocks in an original sub-image, a total of m pixel value sets can be formed.
[0077] In an example, assuming that the initialized original image is divided into 9 original sub-images, and the size of each original sub-image is 3*3, the pixel value of the target pixel block at position (2, 2) in each original sub-image is extracted to form a pixel value set {A1 (2, 2), A2 (2, 2), A3 (2, 2), ..., A9 (2, 2)}, (2, 2) is the position of the central pixel point of the first target pixel block; the pixel value of the pixel block at position (2, 5) in each original sub-image is extracted to form a pixel value set {A1 (2, 5), A2 (2, 5), A3 (2, 5), ..., A9 (2, 5)}, (2, 5) is the position of the central pixel point of the second target pixel block. The position of the central pixel point of the pixel block; extract the pixel values of the pixel block at the position (2, 8) in each original sub-image to form a pixel value set {A1 (2, 8), A2 (2, 8), A3 (2, 8), ..., A9 (2, 8)}, (2, 8) is the position of the central pixel point of the third target pixel block; extract the pixel values of the target pixel block at the position (5, 2) in each original sub-image to form a pixel value set {A1 (5, 2), A2 (5, 2), A3 (5, 2), ..., A9 (5, 2)}, (5, 2) is the position of the central pixel point of the fourth target pixel block; extract the pixel value of the pixel block at the position (5, 5) in each original sub-image , 5, 5), A2 (5, 5), A3 (5, 5), ..., A9 (5, 5)}, (5, 5) is the position of the central pixel of the fifth target pixel block; extract the pixel value of the pixel block at position (5, 8) in each original sub-image, and form a pixel value set {A1 (5, 8), A2 (5, 8), A3 (5, 8), ..., A9 (5, 8)}, (5, 8) is the position of the central pixel of the sixth target pixel block; extract the pixel value of the target pixel block at position (8, 2) in each original sub-image, and form a pixel value set {A1 (8, 2), A2 (8, 2), A3 (8, 2) , ..., A9 (8, 2)}, (8, 2) is the position of the center pixel of the seventh target pixel block; extract the pixel values of the pixel block at position (8, 5) in each original sub-image to form a pixel value set {A1 (8, 5), A2 (8, 5), A3 (8, 5), ..., A9 (8, 5)}, (8, 5) is the position of the center pixel of the eighth target pixel block; extract the pixel values of the pixel block at position (8, 8) in each original sub-image to form a pixel value set {A1 (8, 8), A2 (8, 8), A3 (8, 8), ..., A9 (8, 8)}, (8, 8) is the position of the center pixel of the ninth target pixel block. 9 pixel value sets are obtained.
[0078] S303: For each pixel value set, fill the pixel values in the pixel value set into preset blank sub-images respectively to form initial sub-images, wherein the number of the initial sub-images is the same as the number of the original sub-images.
[0079] In this embodiment, the size of the preset blank sub-image is the same as the size of the original sub-image, and the number of the preset blank sub-images is also the same as the number of the original sub-images. Therefore, for each pixel value set, the pixel values therein can be filled into the preset blank sub-image in sequence to form m initial sub-images.
[0080] S304: performing splicing processing on the initial sub-images to form an initial image.
[0081] Finally, the m initial sub-images are spliced together, thus completing the reconstruction of the initialized original image and forming the initial image.
[0082] In an exemplary embodiment, see Figure 4 , step S103, performing pixel correction on the i-th frame initial image according to the pixel values of each pixel block in the x-frame initial image before the i-th frame initial image and the pixel values of each pixel block in the y-frame initial image after the i-th frame initial image to form a target repaired image, including steps S401 to S403.
[0083] S401: judging whether there is an abnormal pixel block in the i-th frame of initial image according to the pixel values of each pixel block in the x-frame initial image before the i-th frame of initial image and the pixel values of each pixel block in the y-frame initial image after the i-th frame of initial image.
[0084] Before determining whether there is an abnormal pixel block, the image correction method of the present application also includes filtering the pixel values of multiple consecutive frames, and the filtering parameters are selected according to the image type. For visible light images, a smoothing filter method can be used, and for ultraviolet images, a mixed filtering mode can be used, for example, a combination of a possible discharge type + a smoothing filter according to the device.
[0085] In one example, a preset pixel threshold can be selected, and the pixel value of the pixel block at the target position in the i-th frame initial image is subtracted from the pixel value of the pixel block at the target position in the x-frame initial image before the i-th frame initial image, and the pixel value of the pixel block at the target position in the i-th frame initial image is subtracted from the pixel value of the pixel block at the target position in the y-frame initial image after the i-th frame initial image. The obtained differences are compared with the preset pixel threshold to determine whether there is an abnormality in the pixel block at the target position in the i-th frame initial image.
[0086] In the application, after obtaining the initial image and before forming the target repaired image, a convolution operation can be performed on the initial image generated by using the convolution kernel to correspond to the grid to smooth the image.
[0087] S402: When there is an abnormal pixel block in the i-th frame initial image, update the pixel value of the abnormal pixel block in the i-th frame initial image according to the pixel value of the pixel block at the position where the abnormal pixel block is located in the previous x frames initial image and the pixel value of the pixel block at the position where the abnormal pixel block is located in the next y frames initial image.
[0088] If there is an abnormal pixel block in the i-th frame initial image, the abnormal pixel block in the i-th frame initial image can be pixel-filled according to the pixel value of the pixel block at the position of the abnormal pixel block in the previous x frames initial image and the pixel value of the pixel block at the position of the abnormal pixel block in the next y frames initial image, so as to maintain the continuity and uniformity of the overall image and eliminate noise and local non-uniformity.
[0089] S403: When there is no abnormal pixel block in the i-th frame initial image, directly determine the i-th frame initial image as the target repair image.
[0090] If there is no abnormal pixel block in the i-th frame initial image, there is no need to correct the i-th frame initial image, and the original pixel values of each pixel block in the i-th frame initial image are maintained, and the i-th frame initial image is directly determined as the target repair image.
[0091] In an exemplary embodiment, see Figure 5 , step S401, judging whether there is an abnormal pixel block in the i-th frame initial image according to the pixel values of each pixel block in the x-frame initial image before the i-th frame initial image and the pixel values of each pixel block in the y-frame initial image after the i-th frame initial image, including steps S501 and S502.
[0092] S501: When the difference between the pixel value of the pixel block at the target position in the i-th frame initial image and the pixel value of the pixel block at the target position in the i-1-th frame initial image is greater than a preset pixel threshold, and the differences between the pixel values of the pixel block at the target position in each of the previous x frames of initial images and the pixel values of the pixel block at the target position in the adjacent previous frame initial image are not greater than the preset pixel threshold, the pixel block at the target position in the i-th frame initial image is marked as a suspected abnormal pixel block.
[0093] Specifically, assuming that the target position is (p, q), when judging whether the pixel block at the position (p, q) in the i-th frame initial image is an abnormal pixel block, p represents the p-th row of the i-th frame initial image, q represents the q-th column of the i-th frame initial image, and the pixel block at the position (p, q) refers to the pixel block centered on the pixel point at the position (p, q). First, extract the pixel value d of the pixel block at the position (p, q) of the i-th frame initial image. i , the pixel value d of the pixel block at position (p, q) in the initial image of the i-1th framei-1 , ..., the pixel value d of the pixel block at position (p, q) in the initial image of the ix-1th frame i-x-1 , calculate the pixel value d i With pixel value d i-1 The absolute value of the difference |d i -d i-1 |, and the absolute value of the difference between the pixel value of the pixel block at the position (p, q) of the previous x frame image and the pixel value of the pixel block at the position (p, q) of the previous frame image.
[0094] Assumption |d i -d i-1 | is greater than the preset pixel threshold, and the absolute values of the differences between the pixel values of the pixel block at the position (p, q) of the previous x frames and the pixel values of the pixel block at the position (p, q) of the previous frame image are not greater than the preset pixel threshold, then it indicates that the pixel block at the position (p, q) in the i-th frame initial image may be an abnormal pixel block, and it is first marked as a suspected abnormal pixel block.
[0095] S502: When there is at least one pixel block at the target position of the initial image in the subsequent y frames of initial image and the pixel value of the suspected abnormal pixel block in the i-th frame of initial image has a difference greater than a preset pixel threshold, mark the suspected abnormal pixel block as an abnormal pixel block.
[0096] Furthermore, in order to determine whether a suspected abnormal pixel block is an abnormal pixel block, the pixel value of the pixel block at the position (p, q) in the initial image of the subsequent y frames of the i-th frame of the initial image can be combined for judgment. If the pixel value d of the pixel block at the position (p, q) in the initial image of the i+1th frame is i+1 , if the pixel value d of the pixel block at position (p, q) in the initial image of the i+2th frame i+2 , ..., if the pixel value d of the pixel block at position (p, q) in the initial image of the i+yth frame i+y , any pixel value in the pixel block at position (p, q) in the initial image of the i+1th frame to the i+yth frame is equal to the pixel value d i If the absolute value of the difference is greater than the preset pixel threshold, it indicates that the suspected abnormal pixel block is an abnormal pixel block.
[0097] In an exemplary embodiment, see Figure 6 , step S402, updating the pixel value of the abnormal pixel block in the i-th frame initial image according to the pixel value of the pixel block at the position of the abnormal pixel block in the previous x frames initial image and the pixel value of the pixel block at the position of the abnormal pixel block in the next y frames initial image, including step S601 and step S602.
[0098] S601: performing weighted summation on the pixel values of the pixel block at the position of the abnormal pixel block in the previous x frames of initial image and the pixel values of the pixel block at the position of the abnormal pixel block in the next y frames of initial image to obtain a target pixel value.
[0099] In the application, if there is an abnormal pixel block in the i-th frame initial image, the pixel values of the pixel blocks at positions corresponding to the abnormal pixel block in multiple frames of initial images surrounding the i-th frame initial image can be weighted summed to obtain the target pixel value.
[0100] Among them, for each initial image in the first x frames of initial images and the last y frames of initial images, in the process of weighted summation, the weight used by the initial image is negatively correlated with the corresponding spacing of the initial image, and the corresponding spacing of the initial image refers to the spacing between the initial image and the i-th frame of initial image. That is, the smaller the spacing between the initial image and the i-th frame of initial image, the greater the weight proportion of the pixel value of the pixel block corresponding to the abnormal pixel block.
[0101] Exemplarily, a weighted summation process may be performed on the pixel values of the pixel blocks at positions corresponding to the abnormal pixel blocks in the two initial images before and after the i-th frame of the initial image, that is, the abnormal pixel blocks in the i-th frame of the initial image are repaired according to the pixel values of the pixel blocks at positions corresponding to the abnormal pixel blocks in the i-2th frame, the i-1th frame, the i+1th frame, and the i+2th frame, and the weights of the pixel values of the pixel blocks at positions corresponding to the abnormal pixel blocks in the i-2th frame and the i+2th frame are 0.2 respectively, and the weights of the pixel values of the pixel blocks at positions corresponding to the abnormal pixel blocks in the i-1th frame and the i+1th frame are 0.3 respectively, and the target pixel value 0.2d may be obtained. i-2 +0.3d i-1 +0.3d i+1 +0.2d i+2 .
[0102] S602: Update the pixel value of the abnormal pixel block in the i-th frame initial image according to the target pixel value.
[0103] It can be understood that the result of the weighted summation is filled into the abnormal pixel block to repair the abnormal pixel block in the i-th frame of the initial image. i-2 +0.3d i-1 +0.3d i+1 +0.2d i+2 , according to the target pixel value, the pixel value of the abnormal pixel block in the i-th frame initial image is updated, so that the pixel value of the abnormal pixel block in the i-th frame initial image is changed from d i- Changed to 0.2d i-2 +0.3d i-1 +0.3d i+1 +0.2di+2 , that is, the repair of the abnormal pixel block in the i-th frame initial image is completed.
[0104] In one example, the number of multiple initial images before and after the i-th initial image used to determine whether there is an abnormal pixel block in the i-th initial image may be different from the number of multiple initial images before and after the i-th initial image used to repair the abnormal pixel block in the i-th initial image.
[0105] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0106] Based on the same inventive concept, the embodiment of the present application also provides an image correction device for implementing the above-mentioned image correction method. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above-mentioned method, so the specific limitations in one or more image correction device embodiments provided below can refer to the limitations of the image correction method above, and will not be repeated here.
[0107] In an exemplary embodiment, Figure 7 As shown, the present application provides an image correction device, which includes a first acquisition module 701, a first reconstruction module 702, a first correction module 703 and a first inverse reconstruction module 704.
[0108] The first acquisition module 701 is used to acquire at least N frames of continuous original images of the target scene, where N≥3.
[0109] The first reconstruction module 702 is used to initialize and reconstruct the original image to form an initial image.
[0110] The first correction module 703 is used to perform pixel correction on the i-th frame initial image according to the pixel values of each pixel block in the x-frame initial image before the i-th frame initial image and the pixel values of each pixel block in the y-frame initial image after the i-th frame initial image to form a target repaired image, wherein x≥1, y≥1, 1≤ix≤i≤i+y≤N.
[0111] The first inverse reconstruction module 704 is used to perform inverse reconstruction processing on the target repaired image to obtain a target corrected image.
[0112] In an exemplary embodiment, the first reconstruction module includes: a first conversion submodule and a first reconstruction submodule.
[0113] The first conversion submodule is used to perform grayscale conversion processing on the original image to form an initialized original image.
[0114] The first reconstruction submodule is used to reconstruct the initialized original image to form an initial image.
[0115] In an exemplary embodiment, the first reconstruction submodule includes a first segmentation unit, a first acquisition unit, a first filling unit and a first splicing unit.
[0116] The first segmentation unit is used to segment the initialized original image according to a preset grid size to obtain m original sub-images, wherein the preset grid size is n*n, m=n*n, and n>1.
[0117] The first acquisition unit is used to acquire pixel values of pixel blocks at the same position in each original sub-image to form m pixel value sets.
[0118] The first filling unit is used for filling the pixel values in the pixel value set into preset blank sub-images for each pixel value set to form initial sub-images, wherein the number of initial sub-images is the same as the number of original sub-images.
[0119] The first splicing unit is used to splice the initial sub-images to form an initial image.
[0120] In an exemplary embodiment, the first correction module includes a first judgment submodule, a first update submodule and a first determination submodule.
[0121] The first judgment submodule is used to judge whether there is an abnormal pixel block in the i-th frame initial image according to the pixel values of each pixel block in the x-frame initial image before the i-th frame initial image and the pixel values of each pixel block in the y-frame initial image after the i-th frame initial image.
[0122] The first updating submodule is used to update the pixel value of the abnormal pixel block in the i-th frame initial image according to the pixel value of the pixel block at the position where the abnormal pixel block is located in the previous x frames of initial image and the pixel value of the pixel block at the position where the abnormal pixel block is located in the next y frames of initial image when there is an abnormal pixel block in the i-th frame initial image.
[0123] The first determination submodule is used to directly determine the i-th frame initial image as the target restoration image when there is no abnormal pixel block in the i-th frame initial image.
[0124] In an exemplary embodiment, the first determination submodule includes a first execution unit and a second execution unit.
[0125] The first execution unit is used to mark the pixel block at the target position in the i-th frame initial image as a suspected abnormal pixel block when the difference between the pixel value of the pixel block at the target position in the i-th frame initial image and the pixel value of the pixel block at the target position in the i-1-th frame initial image is greater than a preset pixel threshold, and the differences between the pixel values of the pixel block at the target position in each of the previous x frames of initial images and the pixel values of the pixel block at the target position in the adjacent previous frame of initial image are not greater than the preset pixel threshold.
[0126] The second execution unit is used to mark the suspected abnormal pixel block as an abnormal pixel block when there is a difference between the pixel value of the pixel block at the target position of at least one frame of the initial image in the subsequent y frames of the initial image and the pixel value of the suspected abnormal pixel block in the i-th frame of the initial image is greater than a preset pixel threshold.
[0127] In an exemplary embodiment, the first updating submodule includes a first calculating unit and a first updating unit.
[0128] The first calculation unit is used to perform weighted summation on the pixel values of the pixel block at the position where the abnormal pixel block is located in the previous x frames of the initial image and the pixel values of the pixel block at the position where the abnormal pixel block is located in the next y frames of the initial image to obtain a target pixel value.
[0129] The first updating unit is used to update the pixel value of the abnormal pixel block in the i-th frame initial image according to the target pixel value.
[0130] Each module in the above-mentioned image correction device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module above.
[0131] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the image correction method described in any one of the above embodiments when executing the computer program.
[0132] The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 8As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. 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 input / output interface of the computer device is used to exchange information between the processor and an external device. 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 implemented through WIFI, a mobile cellular network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, an image correction method is implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen 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 covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0133] Those skilled in the art will understand that Figure 8 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.
[0134] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the image correction method described in any of the above embodiments are implemented.
[0135] In one embodiment, a computer program product is provided, including a computer program, which implements the steps of the image correction method described in any one of the above embodiments when executed by a processor.
[0136] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0137] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method 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 the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. 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). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0138] 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 application.
[0139] The above-described 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 present application. 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 present application shall be subject to the attached claims.
Claims
1. An image correction method, characterized in that: The method comprises: Acquire at least N frames of continuous original images of the target scene, where N ≥ 3; Initializing and reconstructing the original image to form an initial image; According to the pixel values of each pixel block in the x-frame initial image before the i-frame initial image and the pixel values of each pixel block in the y-frame initial image after the i-frame initial image, the i-frame initial image is pixel-corrected to form a target repaired image, wherein x≥1, y≥1, 1≤ix≤i≤i+y≤N; The target repaired image is inversely reconstructed to obtain the target corrected image.
2. The image correction method according to claim 1, characterized in that: The initializing and reconstructing the original image to form an initial image includes: Performing grayscale conversion processing on the original image to form an initialized original image; The initialized original image is reconstructed to form an initial image.
3. The image correction method according to claim 2, characterized in that: The reconstructing the initialized original image to form an initial image includes: Segmenting the initialized original image according to a preset grid size to obtain m original sub-images, wherein the preset grid size is n*n, m=n*n, n>1; Obtaining pixel values of pixel blocks at the same position in each of the original sub-images to form m pixel value sets; For each pixel value set, fill the pixel values in the pixel value set into preset blank sub-images respectively to form initial sub-images, wherein the number of the initial sub-images is the same as the number of the original sub-images; The initial sub-images are spliced to form an initial image.
4. The image correction method according to claim 1, characterized in that: The method of performing pixel correction on the i-th frame of the initial image according to the pixel values of each pixel block in the x-frame initial image before the i-th frame of the initial image and the pixel values of each pixel block in the y-frame initial image after the i-th frame of the initial image to form a target repaired image includes: According to the pixel values of each pixel block in the x-frame initial image before the i-frame initial image and the pixel values of each pixel block in the y-frame initial image after the i-frame initial image, it is determined whether there is an abnormal pixel block in the i-frame initial image; In the case where there is an abnormal pixel block in the i-th frame initial image, the pixel value of the abnormal pixel block in the i-th frame initial image is updated according to the pixel value of the pixel block at the position where the abnormal pixel block is located in the previous x frames initial image and the pixel value of the pixel block at the position where the abnormal pixel block is located in the next y frames initial image; When there is no abnormal pixel block in the i-th frame initial image, the i-th frame initial image is directly determined as the target repair image.
5. The image correction method according to claim 4, characterized in that: The method of judging whether there is an abnormal pixel block in the i-th frame of the initial image according to the pixel values of each pixel block in the x-frame initial image before the i-th frame of the initial image and the pixel values of each pixel block in the y-frame initial image after the i-th frame of the initial image comprises: If the difference between the pixel value of the pixel block at the target position in the i-th frame of the initial image and the pixel value of the pixel block at the target position in the i-1-th frame of the initial image is greater than a preset pixel threshold, and the differences between the pixel values of the pixel block at the target position in each of the previous x frames of the initial image and the pixel values of the pixel block at the target position in the adjacent previous frame of the initial image are not greater than the preset pixel threshold, the pixel block at the target position in the i-th frame of the initial image is marked as a suspected abnormal pixel block; When there is at least one initial image in the subsequent y initial images whose pixel value at the target position differs from the pixel value of the suspected abnormal pixel block in the i-th initial image and the difference is greater than the preset pixel threshold, the suspected abnormal pixel block is marked as an abnormal pixel block.
6. The image correction method according to claim 4, characterized in that: The updating of the pixel value of the abnormal pixel block in the i-th frame initial image according to the pixel value of the pixel block at the position where the abnormal pixel block is located in the previous x frames initial image and the pixel value of the pixel block at the position where the abnormal pixel block is located in the next y frames initial image comprises: Performing weighted summation on the pixel values of the pixel block at the position where the abnormal pixel block is located in the previous x frames of the initial image and the pixel values of the pixel block at the position where the abnormal pixel block is located in the next y frames of the initial image to obtain a target pixel value; According to the target pixel value, the pixel value of the abnormal pixel block in the i-th frame initial image is updated.
7. The image correction method according to claim 6, characterized in that: For each of the initial images of the first x frames and the initial images of the last y frames, in the process of weighted summation, the weight used by the initial image is negatively correlated with the corresponding spacing of the initial image; the corresponding spacing of the initial image refers to the spacing between the initial image and the i-th frame initial image.
8. An image correction device, characterized in that: The device comprises: A first acquisition module is used to acquire at least N frames of continuous original images of the target scene, where N ≥ 3; A first reconstruction module, used for initializing and reconstructing the original image to form an initial image; The first correction module is used to perform pixel correction on the i-th frame of the initial image according to the pixel values of each pixel block in the x-frame initial image before the i-th frame of the initial image and the pixel values of each pixel block in the y-frame initial image after the i-th frame of the initial image, so as to form a target repaired image, wherein x≥1, y≥1, 1≤ix≤i≤i+y≤N; The first inverse reconstruction module is used to perform inverse reconstruction processing on the target repaired image to obtain a target corrected 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.