Image defogging method, device and image sensing device
By using the blocking technology of Gaussian downsampling map and dark channel map in the image dehazing method, calculating the fine transmission map and substituting it into the atmospheric scattering model, combined with the weighted fusion method, the problem of loss of detail and low contrast of images in foggy weather is solved. It achieves powerful dehazing and detail retention, avoids halo phenomena, and improves image quality and practicality.
Patent Information
- Application Number
- CN202410129334.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-30
- Publication Date
- 2024-10-25
- Estimated Expiration
- 2044-01-30
AI Technical Summary
Due to the influence of haze, images taken on foggy days suffer from loss of details and low contrast, which affects subsequent image analysis and recognition work. Existing defogging methods have insufficient dehazing intensity and are prone to halo phenomena.
By obtaining the Gaussian downsampling map and dark channel map of the target image, obtain the coordinates of the point with the largest gray value in each dark channel map in blocks, calculate the feature distance, obtain the fine transmission map, and substitute it into the atmospheric scattering model to calculate Dehaze the image, combined with the weighted fusion method to retain details and optimize the dehazing effect.
It achieves stronger dehazing effect and visual effect, avoids the loss of details, and avoids the halo phenomenon, improving the universality and practical value of the image.
Smart Images

Figure CN117911280B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field, and in particular to an image defogging method, an image defogging device and an image sensing device. Background Art
[0002] Affected by haze, images taken on foggy days will have details lost and low contrast, which will affect subsequent image analysis and recognition. For example, in bad weather such as fog, haze, dust, or wind and sand, a large number of particles will be suspended in the atmosphere. These particles will absorb, scatter, refract, and other physical effects on light, causing image quality to deteriorate. Image defogging is to eliminate the impact of these particles on image quality. By analyzing and preprocessing foggy images, the original image state can be restored. Summary of the invention
[0003] The present application provides an image defogging method, an apparatus and an image sensing device, which can effectively defog a target image while reducing image loss in details, so that the final defogging image has both excellent defogging effect and visual effect, and has strong universality and practical value.
[0004] In a first aspect, an image defogging method is provided, the method comprising: obtaining a Gaussian down-sampling image of a target image, and then obtaining a dark channel image of the Gaussian down-sampling image; dividing the dark channel image into blocks, and respectively obtaining the coordinates of the point with the largest grayscale value in each dark channel image; dividing the Gaussian down-sampling image into blocks in the same manner, and then obtaining the characteristic distance of each Gaussian down-sampling image according to the coordinates of the point with the largest grayscale value in each dark channel image, wherein the characteristic distance is the shortest distance from a pixel cluster in each Gaussian down-sampling image to a plane formed by an RGB space axis; calculating a fine transmission image of the Gaussian down-sampling image according to the characteristic distance of each Gaussian down-sampling image; substituting the fine transmission image into an atmospheric scattering model, calculating a defogging image of the Gaussian down-sampling image, and then obtaining the defogging image of the target image.
[0005] The dark channel image is used to obtain the precise location where the fog is thickest in the local block. After finding the minimum value of the equally spaced pixel cluster at this location, a fine transmission image is obtained. The fine transmission image is substituted into the atmospheric scattering model to calculate the defogging image of the Gaussian downsampling image, and then the defogging image of the target image is obtained, making the unclear details more obvious. Compared with other methods in the prior art, the image defogging method provided by the present application has a greater defogging strength and no halo.
[0006] In one implementation, a Gaussian down-sampled image of a target image is obtained, and then a dark channel image of the Gaussian down-sampled image is obtained, including: down-sampling the target image after Gaussian filtering to obtain the Gaussian down-sampled image of the target image; selecting the minimum value of each pixel in the RGB channel of the Gaussian down-sampled image to form a minimum grayscale image; performing minimum value filtering on the minimum grayscale image to obtain a dark channel image of the Gaussian down-sampled image.
[0007] Since the block operation needs to be performed in the dark channel image and the Gaussian downsampling image, it is necessary to obtain the Gaussian downsampling image of the target image and the dark channel image of the Gaussian downsampling image in advance. Since the origins of both are the target image to be defogged, the Gaussian downsampling image of the target image and the dark channel image of the Gaussian downsampling image can be obtained by progressively following the target image.
[0008] In one implementation, the characteristic distance of each Gaussian down-sampled image is obtained according to the coordinates of the point with the largest grayscale value in each dark channel image, including: obtaining the characteristic distance of the corresponding coordinates in each Gaussian down-sampled image according to the coordinates of the point with the largest grayscale value in each dark channel image; filling the value of the characteristic distance into the block where the corresponding coordinate is located to obtain the characteristic distance of each Gaussian down-sampled image.
[0009] The characteristic distance mentioned in this implementation is the core of this application. The characteristic distance represents the shortest distance from the RGB coordinate axis to the pixel cluster formed by the small value model of equally spaced pixel clusters with large foggy pixel blocks. After obtaining this characteristic distance, the transmittance in the atmospheric scattering model can be obtained, which is an indispensable step in completing the defogging of the target image.
[0010] In one implementation, a fine transmission map of the Gaussian down-sampled image is calculated based on the feature distance of each Gaussian down-sampled image, including: obtaining a grayscale image of the Gaussian down-sampled image based on the Gaussian down-sampled image; obtaining a rough transmission map of the Gaussian down-sampled image based on the feature distance of each Gaussian down-sampled image; and using the grayscale image to perform guided filtering on the rough transmission map to calculate a fine transmission map of the Gaussian down-sampled image.
[0011] In this implementation, the guided filtering method is used to further refine the rough transmission map directly obtained from the small value model of equally spaced pixel clusters, so that the transmission map finally substituted into the atmospheric scattering model is more refined and accurate.
[0012] In one implementation, the fine transmission map is substituted into the atmospheric scattering model to calculate the defogging map of the Gaussian down-sampling map, including: obtaining the positions of pixels whose grayscale values in the dark channel map are within a preset range; determining the atmospheric light intensity in the Gaussian down-sampling map according to the positions; substituting the atmospheric light intensity and the fine transmission map into the atmospheric scattering model to calculate the defogging map of the Gaussian down-sampling map; wherein the calculation formula of the atmospheric scattering model is: I(x)=J(x)t(x)+A(1-t(x)), wherein I(x) represents the target image, J(x) represents the defogging map of the Gaussian down-sampling map, t(x) represents the atmospheric transmittance, which is directly obtained from the fine transmission map, A represents the atmospheric light intensity, and x represents a pixel in the image.
[0013] According to the atmospheric scattering model and the refined transmission map and atmospheric illumination intensity obtained in the previous step, the dehazed image of the Gaussian downsampled image can be calculated; since the Gaussian downsampled image is homologous to the original target image, the dehazed image of the target image can be further obtained to complete the dehazing operation on the target image.
[0014] In one implementation, the image optimization method also includes: upsampling the Gaussian downsampled image to obtain a Gaussian blurred image; obtaining a detail image based on the target image and the Gaussian blurred image; upsampling the defogging image of the Gaussian downsampled image to obtain a defogging image of the target image; weighted fusion of the defogging image and the detail image of the target image to optimize the defogging image of the target image.
[0015] In order to optimize the dark area details of the object map of the target image and avoid the loss of details caused by pixel value truncation, the weighted fusion method is used to retain some details in the original target image.
[0016] Furthermore, a detail image is obtained according to the target image and the Gaussian blurred image, including: performing a difference operation between the target image and the Gaussian blurred image to construct a Laplacian pyramid, and obtaining the detail image according to the Laplacian pyramid.
[0017] The specific means of weighted fusion is to use the Laplacian pyramid to retain the details of the original image, obtain a detail map, and then use the detail map to optimize the dehazed image of the target image.
[0018] In a second aspect, an image defogging device is provided, the device comprising a memory, a processor and a computer program stored in the memory; the image defogging device performs defogging on a target image, and the processor executes the computer program to implement the image defogging method provided in any implementation method of the first aspect.
[0019] In a third aspect, an image sensing device is provided, comprising: a photosensitive element for sensing light signals and converting the light signals into electrical signals, wherein the electrical signals include image data of an image to be processed; and an image processing device for executing the image defogging method provided in any implementation method of the first aspect to perform defogging on the target image.
[0020] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program / instruction is stored, and when the computer program / instruction is executed by a processor, the steps of the image defogging method provided in any implementation of the first aspect are implemented.
[0021] In summary, it can be seen that the image defogging method, device and image sensing device provided by the present application have at least the following beneficial effects:
[0022] (1) The dark channel map is used to obtain the precise location where the fog is the thickest in the local block. The minimum value of the equally spaced pixel cluster is calculated for this location, and then a fine transmission map is obtained. This optimizes the process of obtaining the transmittance in the atmospheric scattering model, making the final defogging effect stronger.
[0023] (2) The weighted fusion method is used to preserve the details of the target image, so that the entire dehazing process can achieve strong dehazing while avoiding detail loss. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The following is a brief introduction to the drawings used in describing the embodiments of the present application:
[0025] Figure 1 is a flow chart of an image defogging method provided in some embodiments of the present application;
[0026] Figure 2 is a flowchart of another image defogging method provided in some embodiments of the present application;
[0027] Figure 3 is a flowchart of another image defogging method provided in some embodiments of the present application;
[0028] Figure 4 is a flowchart of another image defogging method provided in some embodiments of the present application;
[0029] Figure 5 is a flowchart of another image defogging method provided in some embodiments of the present application;
[0030] Figure 6 is a flowchart of another image defogging method provided in some embodiments of the present application;
[0031] Figure 7 is a flowchart of another image defogging method provided in some embodiments of the present application;
[0032] Figure 8 It is a structural schematic diagram of an image sensing device provided in some embodiments of the present application.
[0033] In the figure: 10 - image sensing device, 11 - lens, 12 - photosensitive element, 13 - image processing device. DETAILED DESCRIPTION
[0034] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the specific implementation methods of the present application will be described below with reference to the accompanying drawings. The accompanying drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other accompanying drawings and other implementation methods can be obtained based on these drawings without creative work. Adjustments and improvements made without departing from the concept of the present application are all within the scope of protection of the present application.
[0035] In order to simplify the drawings, only the parts related to the corresponding embodiments are schematically shown in each figure, and they do not represent the actual structure of the product. In addition, in order to simplify the drawings and facilitate understanding, only part of the components with the same structure or function in some figures are schematically drawn, and there may be more or fewer components with the same structure or function in reality.
[0036] In this application, unless otherwise clearly specified and limited, ordinal numbers, such as "first", "second", etc., are only used to distinguish and describe associated objects, and cannot be understood as indicating or implying the relative importance or order between associated objects; in addition, they do not represent the number of associated objects. "Multiple" includes two or more, and other quantifiers are similar. " / " is used to describe the relationship between associated objects, which indicates the "or" relationship between associated objects. "And / or" is used to describe the relationship between associated objects, which includes any combination relationship between associated objects, such as "a and / or b" includes: "alone a", "alone b", or "a and b". "One or more" or "at least one" in multiple objects refers to any object or any combination of multiple objects, such as "one or more of a1, a2, a3" or "at least one of a1, a2, a3" includes: "alone a1", "alone a2", "alone a3", "a1 and a2", "a1 and a3", "a2 and a3", or "a1, a2 and a3".
[0037] In the prior art, image defogging methods are mainly divided into defogging methods based on image enhancement, defogging methods based on image restoration, and defogging methods based on fusion. These three methods show different characteristics in experiments. However, the defogging effects of most of the above three methods are limited. For scenes with dense fog or poor lighting conditions, the defogging intensity is not strong enough, and the defogging image is not detailed enough, and halo phenomenon occurs.
[0038] The atmospheric scattering model used for defogging is I(x)=J(x)t(x)+A(1-t(x)). In the above formula, x represents a pixel in the image, J represents the image of the real scene, I represents the degraded image after atmospheric scattering, t represents the transmittance of the reflected light in the atmosphere, and A represents the atmospheric light brightness of the scene, providing additional color information of the environment. The quality of the defogging image is mainly based on a more accurate transmission map obtained by the prior model, that is, t(x) in the atmospheric scattering model. Therefore, in order to achieve excellent defogging effect, how to obtain a fine transmission map, that is, to find t(x) is very important.
[0039] According to the existing dark channel prior defogging algorithm: the dark channel map of a normal image without fog is approximately completely black; on the contrary, the dark channel map of an image containing fog is more inclined to grayish white, and the thicker the fog, the larger the grayscale value of the dark channel map. The concept of this application is to find the point with the largest grayscale value (that is, the thickest fog) in each dark channel map after blocking according to the small value model of equally spaced pixel clusters, that is, by dividing the Gaussian downsampling map of the target image to be defogged and the dark channel map of the Gaussian downsampling map, and taking this point as the center, all pixels in the neighborhood of this point are considered to belong to the same pixel cluster. In this neighborhood, except for individual outliers, most of the pixel values are within the same small range and belong to the same pixel cluster. At the same time, since the middle point of this neighborhood can be considered as the point with the thickest fog in the block, the pixel cluster in this neighborhood can also be considered as a block with larger fog. After the pixel cluster is determined, the shortest distance between the pixel points in the pixel cluster and the plane formed by the RGB space axis is calculated; the obtained shortest distance is extended to each point in the block where the densest fog point is located, and then the transmission map is obtained, that is, t(x) in the atmospheric scattering model is obtained. The specific implementation method is detailed in the following embodiment of the image defogging method.
[0040] In one embodiment, Figure 1 As shown, an image defogging method includes:
[0041] S100, obtaining a Gaussian down-sampling image of the target image, and then obtaining a dark channel image of the Gaussian down-sampling image;
[0042] The application scenario of the small value model of equally spaced pixel clusters is in the Gaussian downsampling map and the dark channel map. Therefore, it is necessary to obtain its Gaussian downsampling map and the dark channel map of the Gaussian downsampling map in advance according to the target image to be dehazed.
[0043] S200, dividing the dark channel image into blocks, and obtaining the coordinates of the point with the largest grayscale value in each dark channel image;
[0044] In some implementations, the dark channel image is divided into a plurality of blocks of size M*N according to the aspect ratio of the dark channel image, which also satisfies the concept of equal interval in the small value model of equally spaced pixel clusters.
[0045] S300, dividing the Gaussian down-sampled image into blocks in the same manner, and then obtaining the characteristic distance of each Gaussian down-sampled image according to the coordinates of the point with the largest grayscale value in each dark channel image, where the characteristic distance is the shortest distance from the pixel cluster in each Gaussian down-sampled image to the plane formed by the RGB space axis;
[0046] After the dark channel image is divided into several M*N blocks, the Gaussian downsampled image is divided into several M*N blocks in the same way. In each dark channel image, find the point with the largest grayscale value and get the coordinates of the point with the largest grayscale value. Repeat the above operation for each block to get the coordinates of several points with the largest grayscale value. In the Gaussian downsampled image, according to the coordinates of these points with the largest grayscale value, the characteristic distance of each Gaussian downsampled image in the Gaussian downsampled image is obtained.
[0047] S400, calculating a fine transmission map of the Gaussian down-sampling image according to the feature distance of each Gaussian down-sampling image;
[0048] After obtaining the feature distance of each Gaussian down-sampled image, the transmission map of the entire Gaussian down-sampled image is constructed according to the corresponding relationship between the feature distance and the transmittance.
[0049] S500, substituting the refined transmission image into the atmospheric scattering model, calculating and obtaining a defogging image of the Gaussian down-sampling image, and then obtaining a defogging image of the target image.
[0050] The dark channel image is used to obtain the precise location where the fog is thickest in the local block. After finding the minimum value of the equally spaced pixel cluster at this location, a fine transmission image is obtained. The fine transmission image is substituted into the atmospheric scattering model to calculate the defogging image of the Gaussian downsampling image, and then the defogging image of the target image is obtained, making the unclear details more obvious. Compared with other methods in the prior art, the image defogging method provided by the present application has a greater defogging strength and no halo.
[0051] In one embodiment, Figure 2 As shown, S100 obtains a Gaussian down-sampling image of the target image, and then obtains a dark channel image of the Gaussian down-sampling image, including:
[0052] S110, performing Gaussian filtering and down-sampling on the target image to obtain a Gaussian down-sampled image of the target image;
[0053] The target image is Gaussian filtered and downsampled, and the length and width of the Gaussian downsampled image are 1 / 2 of the target image respectively, so the area of the Gaussian downsampled image is 1 / 4 of the target image.
[0054] S120, selecting the minimum value of each pixel in the RGB channel of the Gaussian down-sampling image to form a minimum grayscale image;
[0055] The dark channel image is actually obtained by taking the minimum value of the three RGB channels to form a minimum grayscale image, and then performing a minimum value filter on the minimum grayscale image.
[0056] S130, performing minimum value filtering on the minimum grayscale image to obtain a dark channel image of the Gaussian down-sampling image.
[0057] The above Gaussian downsampled image, minimum grayscale image, and dark channel image have the same size, which is 1 / 4 of the target image. Since the block operation needs to be performed on the dark channel image and the Gaussian downsampled image, it is necessary to obtain the Gaussian downsampled image of the target image and the dark channel image of the Gaussian downsampled image in advance. Since the origin of both is the target image to be defogged, the Gaussian downsampled image of the target image and the dark channel image of the Gaussian downsampled image can be obtained by progressively following the target image.
[0058] In one embodiment, Figure 3 As shown, S300 divides the Gaussian downsampled image into blocks in the same way, and then obtains the characteristic distance of each Gaussian downsampled image according to the coordinates of the point with the largest grayscale value in each dark channel image. The characteristic distance is the shortest distance from the pixel cluster in each Gaussian downsampled image to the plane formed by the RGB space axis, including:
[0059] S310, obtaining a feature distance of a corresponding coordinate in each Gaussian down-sampling image according to the coordinates of the point with the largest gray value in each dark channel image;
[0060] In order to facilitate the understanding of the present embodiment, the operation method in the steps of the present embodiment is now illustrated. Since the size of each dark channel image is the same (equally spaced) after the dark channel image is divided into blocks, one of the blocks is taken as an example, and the remaining blocks can be derived by analogy. Assume that after the block division, the size of each dark channel image is M*N, and the point with the largest grayscale value in the dark channel image is A, and the coordinates of A are (a, b); find the point A' with coordinates (a, b) in the Gaussian downsampling image, and define a range around the point A' with a certain neighborhood window size. The points within the range belong to the same pixel cluster, and then calculate the shortest distance from the pixel points in the same pixel cluster to the plane formed by the RGB space axis. The plane formed by the RGB space axis refers to the three planes of ROG, ROB, and GOB.
[0061] S320, filling the value of the feature distance into the block where the corresponding coordinate is located, and obtaining the feature distance of each block of the Gaussian down-sampling image;
[0062] Based on the above embodiment, the obtained characteristic distance is filled into the Gaussian downsampled image where point A' is located, so that each point on this Gaussian downsampled image has the same characteristic distance value. By extending this method to each block in the Gaussian downsampled image, the characteristic distance of each Gaussian downsampled image can be obtained.
[0063] The characteristic distance mentioned in this implementation is the core of this application. The characteristic distance represents the shortest distance from the RGB coordinate axis to the pixel cluster formed by the small value model of equally spaced pixel clusters with large foggy pixel blocks. After obtaining this characteristic distance, the transmittance in the atmospheric scattering model can be obtained, which is an indispensable step in completing the defogging of the target image.
[0064] In one embodiment, Figure 4 As shown, S400 calculates the fine transmission map of the Gaussian down-sampling image according to the feature distance of each Gaussian down-sampling image, including:
[0065] S410, obtaining a grayscale image of the Gaussian down-sampling image according to the Gaussian down-sampling image;
[0066] The grayscale image in this embodiment is different from the minimum grayscale image in the above embodiment, that is, the grayscale image of the Gaussian down-sampling image is obtained by conventional means.
[0067] S420, obtaining a rough transmission map of the Gaussian down-sampling image according to the feature distance of each Gaussian down-sampling image;
[0068] According to the transmittance expression: t i =1-wθ i , where t i represents the transmittance of a certain Gaussian downsampled image, w represents the window size of the block, θ i Represents the characteristic distance of a Gaussian downsampled image. According to the characteristic distance of each Gaussian downsampled image, the transmittance of this Gaussian downsampled image is obtained, and then the rough transmission map of the entire Gaussian downsampled image is obtained.
[0069] S430, using the grayscale image to perform guided filtering on the rough transmission image, and calculating a fine transmission image of the Gaussian down-sampling image.
[0070] Although the rough transmission map can be substituted into the atmospheric scattering model to complete the defogging operation of the target image, in order to further improve the quality of defogging, a more refined transmission map (that is, a fine transmission map) is required. The grayscale image of the Gaussian downsampling image is used to perform guided filtering on the rough transmission map to further refine the image details in the transmission map, improve the overall image quality, and thus make the subsequent defogging effect better.
[0071] In this embodiment, a guided filtering method is used to further refine the rough transmission map directly obtained from the small value model of equally spaced pixel clusters, so that the transmission map finally substituted into the atmospheric scattering model is more refined and accurate.
[0072] In one embodiment, Figure 5 As shown, S500 substitutes the fine transmission map into the atmospheric scattering model, calculates and obtains the defogging map of the Gaussian down-sampling map, and then obtains the defogging map of the target image, including:
[0073] S510, obtaining positions of pixels in a dark channel image whose grayscale values are within a preset range;
[0074] S520, determining the atmospheric illumination intensity in the Gaussian downsampled map according to the position;
[0075] In some embodiments, the first 0.1% of pixels are taken from the dark channel image according to the brightness, and the corresponding value of the point with the highest brightness is found in the target image at these positions as the A value, that is, the atmospheric light brightness value.
[0076] S530, substituting the atmospheric illumination intensity and the fine transmission map into the atmospheric scattering model, and calculating a defogging map of the Gaussian down-sampling map.
[0077] The calculation formula of the atmospheric scattering model is: I(x)=J(x)t(x)+A(1-t(x)), where I(x) represents the target image, J(x) represents the dehazed image of the Gaussian downsampling image, t(x) represents the atmospheric transmittance, which is directly obtained from the fine transmission map, A represents the atmospheric light intensity, and x represents a pixel in the image.
[0078] According to the atmospheric scattering model and the refined transmission map and atmospheric illumination intensity obtained in the previous step, the dehazed image of the Gaussian downsampled image can be calculated; since the Gaussian downsampled image is homologous to the original target image, the dehazed image of the target image can be further obtained to complete the dehazing operation on the target image.
[0079] In one embodiment, Figure 6 As shown, based on any of the above embodiments, the image defogging method disclosed in the present application also includes:
[0080] S600, upsampling the Gaussian downsampled image to obtain a Gaussian blurred image;
[0081] S700, obtaining a detail image according to the target image and the Gaussian blur image;
[0082] Since the defogging intensity of the image defogging method in the above embodiment is very high, some details of the image may be lost after defogging. In order to further optimize the image defogging method provided in this application, it is necessary to calculate the detail map of the target image to supplement the defogging map of the target image.
[0083] S800, upsampling the defogging image of the Gaussian downsampled image to obtain a defogging image of the target image;
[0084] The dehazed image of the Gaussian downsampled image is equal to 1 / 4 of the target image in area, so an upsampling operation is required to double the length and width of the dehazed image of the Gaussian downsampled image to obtain the dehazed image of the target image.
[0085] S900, weighted fusion of the defogging image and the detail image of the target image to optimize the defogging image of the target image.
[0086] The specific proportion of weighted fusion in S900 is determined according to the actual product requirements and will not be described in detail here. In order to optimize the dark area details of the object map of the target image and avoid detail loss caused by pixel value truncation, a weighted fusion method is used to retain some details in the original target image. Since the image defogging method disclosed in this application has a high defogging intensity, it can reduce the interference of local outlier pixels; at the same time, it is also easy to cause the local pixel values of the defogged image to cross the boundary, which is visually manifested as the loss of dark area details. Therefore, a weighted fusion step is required to further optimize the image quality after defogging.
[0087] In summary, the dark channel map is used to obtain the precise position where the fog is the thickest in the local block, and the minimum value of the equally spaced pixel cluster is obtained for this position, thereby obtaining a rough transmission map. The rough transmission map is subjected to guided filtering to obtain a fine transmission map, which has a greater defogging intensity than other methods and no halo. Due to the high defogging intensity, details will be lost to a certain extent. The original image is processed by Laplace pyramid to obtain a detail map, and the details of the defogging image are retained to the greatest extent on the basis of defogging. In terms of results, the image defogging method disclosed in the present application is not only effective in defogging, but also retains certain details. The method as a whole has strong universality and practical value.
[0088] In some embodiments, Figure 7 As shown, S700 obtains a detail image according to the target image and the Gaussian blur image, including:
[0089] S710, performing a difference operation between the target image and the Gaussian blurred image, constructing a Laplacian pyramid, and obtaining a detail image according to the Laplacian pyramid.
[0090] The specific means of weighted fusion is to use the Laplacian pyramid to preserve the details of the original image, obtain the detail map, and then use the detail map to optimize the defogging map of the target image. The original image is actually constructing a Gaussian pyramid in the process of upsampling and downsampling. The Laplacian pyramid can well preserve the details of the image. It is generated on the basis of the Gaussian pyramid. The Laplacian pyramid is the difference image between the Gaussian pyramid and the previous layer after upsampling. The upsampling here is generally performed by Gaussian filtering. The Laplacian image of a certain layer is actually the difference between the Gaussian image of the same layer and the Gaussian image of the previous layer after upsampling. Since the Gaussian filter is a low-pass filter, we can say that the Laplacian pyramid of a certain level can reflect the high-frequency components of the Gaussian pyramid of the same level. The high-frequency components of the image are generally edges or details.
[0091] Based on the same technical concept, the present application provides an image defogging device, which includes a memory, a processor and a computer program stored in the memory; the image defogging device performs defogging on the target image, and the processor executes the computer program to implement the above image defogging method.
[0092] The relevant description of the image defogging device can be understood by referring to the relevant description and effects corresponding to the method embodiment, which will not be repeated here.
[0093] Based on the same technical concept, such as Figure 8 As shown, the present application provides an image sensing device 10, including: a photosensitive element 12, used to sense light signals and convert the light signals into electrical signals, the electrical signals including image data of the image to be processed; an image processing device 13, used to execute the above image defogging method to perform defogging on the target image.
[0094] In some embodiments, Figure 8 The image sensing device 10 is a camera, the lens 11 receives external light and transmits the light signal to the photosensitive element 12, the photosensitive element 12 can be a COMS / CCD photosensitive sensor, the light signal is converted into an analog electrical signal by the photosensitive element 12, and then the analog electrical signal is converted into a digital electrical signal by an analog-to-digital converter, and the digital electrical signal includes image data of the image to be processed; the image processing device 13 receives the digital electrical signal, and uses any one of the image defogging methods disclosed in the above embodiments to perform a defogging operation on the target image to be processed.
[0095] Based on the same technical concept, the present application provides a computer-readable storage medium on which a computer program / instruction is stored. When the computer program / instruction is executed by a processor, the steps of the above image defogging method are implemented.
[0096] Among them, the computer-readable storage medium may be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
[0097] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments. In addition, the above embodiments can be freely combined as needed.
Claims
1. An image defogging method, characterized in that: include: Obtain a Gaussian down-sampling image of the target image, and then obtain a dark channel image of the Gaussian down-sampling image; Divide the dark channel image into blocks, and obtain the coordinates of the point with the largest grayscale value in each dark channel image; The Gaussian down-sampled image is divided into blocks in the same manner, and then the characteristic distance of the corresponding coordinates in each Gaussian down-sampled image is obtained according to the coordinates of the point with the largest grayscale value in each dark channel image, and the value of the characteristic distance is filled into the block where the corresponding coordinates are located to obtain the characteristic distance of each Gaussian down-sampled image, wherein the characteristic distance is the shortest distance from the pixel cluster in each Gaussian down-sampled image to the plane formed by the RGB space axis, and the pixel cluster in each Gaussian down-sampled image is a set of pixel points within a preset range determined with the corresponding coordinates as the midpoint; According to the Gaussian down-sampling image, a grayscale image of the Gaussian down-sampling image is obtained; according to the feature distance of each block of the Gaussian down-sampling image, a rough transmission image of the Gaussian down-sampling image is obtained; the rough transmission image is guided filtered using the grayscale image, and a fine transmission image of the Gaussian down-sampling image is calculated; The refined transmission image is substituted into the atmospheric scattering model to calculate and obtain a defogging image of the Gaussian down-sampling image, thereby obtaining a defogging image of the target image.
2. The image defogging method according to claim 1, characterized in that: The step of obtaining a Gaussian down-sampling image of a target image and then obtaining a dark channel image of the Gaussian down-sampling image includes: Performing Gaussian filtering on the target image and then downsampling it to obtain a Gaussian downsampled image of the target image; Select the minimum value of each pixel in the RGB channel of the Gaussian downsampling image to form a minimum grayscale image; Perform minimum value filtering on the minimum grayscale image to obtain a dark channel image of the Gaussian down-sampling image.
3. The image defogging method according to claim 1, characterized in that: Substituting the refined transmission image into the atmospheric scattering model to calculate and obtain the defogging image of the Gaussian down-sampling image includes: Obtaining positions of pixels in the dark channel image whose grayscale values are within a preset range; Determining the atmospheric light intensity in the Gaussian downsampled map according to the position; Substituting the atmospheric illumination intensity and the refined transmission map into the atmospheric scattering model, and calculating and obtaining a defogging map of the Gaussian down-sampling map; The calculation formula of the atmospheric scattering model is: I(x)=J(x)t(x)+A(1-t(x)), Among them, I(x) represents the target image, J(x) represents the dehazed image of the Gaussian downsampling image, t(x) represents the atmospheric transmittance, which is directly obtained from the fine transmission map, A represents the atmospheric illumination intensity, and x represents a pixel in the image.
4. The image defogging method according to claim 1, characterized in that: The image defogging method further comprises: Upsampling the Gaussian downsampled image to obtain a Gaussian blurred image; Obtaining a detail image according to the target image and the Gaussian blur image; Upsampling the defogging image of the Gaussian downsampled image to obtain a defogging image of the target image; The defogging image of the target image and the detail image are weightedly fused to optimize the defogging image of the target image.
5. The image defogging method according to claim 4, characterized in that: The step of obtaining a detail image according to the target image and the Gaussian blur image includes: A difference operation is performed between the target image and the Gaussian blurred image to construct a Laplacian pyramid, and the detail image is obtained according to the Laplacian pyramid.
6. An image defogging device, comprising a memory, a processor, and a computer program stored in the memory, characterized in that: Defogging is performed on the target image, and the processor executes the computer program to implement the image defogging method according to any one of claims 1 to 5.
7. An image sensing device, characterized in that: include: A photosensitive element, used to sense a light signal and convert the light signal into an electrical signal, wherein the electrical signal includes image data of a target image; An image processing device, used to execute an image defogging method as described in any one of claims 1 to 5, and perform defogging on the target image.
8. A computer-readable storage medium having a computer program / instruction stored thereon, characterized in that: When the computer program / instruction is executed by a processor, the steps of an image defogging method as described in any one of claims 1 to 5 are implemented.
