The specific implementation mode is as follows: the invention will be further explained with reference to the drawings: as shown in fig. 1, the present invention provides a low quality image enhancement system under extreme weather conditions, which comprises a multi-way switch, a microprocessor, a video processing unit, an HDMI output end block, and 8 DVI end blocks, 8 HDMI end blocks, and 8 BNC end blocks;
the multi-way change-over switch, the microprocessor, the video processing unit, the HDMI output end block, the 8-path DVI end block, the 8-path HDMI end block and the 8-path BNC end block are all in plug-in connection in the form of plug-in blocks;
the 8-path DVI end block and the 8-path HDMI end block are plugged on the multi-path conversion switch, the multi-path conversion switch is plugged on the microprocessor, the video processing unit is plugged on the microprocessor, the HDMI output end block is plugged on the video processing unit, the 8-path BNC end block is plugged on the coding blocks, and the coding blocks are plugged on the multi-path conversion switch.
Each splicing block is provided with a splicing groove and a splicing column, the splicing groove comprises a groove body 1 and a groove head 2 communicated with the groove body 1, the groove head 2 is circular, the diameter of the groove head 2 is larger than the width of the groove body 1, and an arched pressure spring 3 is arranged in the groove body 1;
the inserting column is of a structure that the groove head 2 can be inserted into the groove body 1 in an inserting mode, the inserting column comprises a column body 4 and a clamping groove 5 arranged on the column body 4, and the clamping groove 5 is an arc-shaped groove with radian matched with that of an arched pressure spring.
The bottom of the groove body 1 is provided with a wide opening 6 with the width equivalent to the diameter of the groove head, and the wide opening 6 and the groove body 1 form a T-shaped structure.
The front end of the column 4 is provided with a wide card 7 which can be accommodated in the wide opening 6 together with the wide opening 6.
The system also comprises a serial port plugging block, a network port plugging block and a channel selection block, wherein the serial port plugging block, the network port plugging block and the channel selection block are plugged on the microprocessor.
The utility model discloses a peg graft the piece that needs when using together, concrete grafting method is for stretching into cylinder 4 in groove head 2, then to 1 direction removal of groove body, make wide card 7 get into in wide mouthful 6, make wide card 7 block in wide mouthful 6 and prevent cylinder 4 outwards to move, draw-in groove 5 on cylinder 4 is pushed down by arch pressure spring 3 till, still be provided with data line and net twine socket on every grafting piece, after being connected between piece and piece, it can with each socket connection to utilize data line or net twine.
The use principle of the system is as follows:
the dark channel prior algorithm realizes image enhancement:
in computer vision, the following model is widely used to describe the process of forming haze images:
I(x)=J(x)t(x)+A(1-t(x)) (1)
wherein i (x) represents the intensity of the light that reaches the imaging device after being attenuated, i.e. the observed image with haze, t (x) represents the transmittance of the medium, which reflects the ability of the light to penetrate through haze, and the larger the value, the more the light that reaches the observation point is, j (x) represents the clear image to be restored, and a is atmospheric light and is usually set as a global constant. The purpose of haze removal is to recover J from I.
From equation (1) we can derive:
i (x) is a known foggy image, and J (x), t (x), A are unknown, so it is difficult to solve J directly by equation (1).
The dark channel prior is statistically derived from the observation of a large number of outdoor fog-free images by He, i.e. in most non-sky local areas, some pixels will always have at least one color channel with a very low value close to 0. For an image J, it is formulated as:
Jca certain color channel of J, c is a certain channel of R, G and B channels, omega (x) is a local area with x as the center, JdarkThe dark primary of J. Substituting equation (3) into equation (1), and assuming that the transmittance in a certain local area is constant, assuming that the atmospheric light a is given, the transmittance is simply estimated:
because of the existence of the spatial perspective phenomenon, if the fog is completely removed, the image looks unreal, and the depth sense is lost, so a fog retention factor w is introduced to be 0.95, and a part of fog covering a distant scene is retained.
And finally obtaining a defogged recovery image J:
in the formula, the method for estimating the atmospheric light a is as follows: and selecting the pixel with the maximum brightness of 0.1% in the dark primary color, and selecting the value of the pixel point with the maximum intensity from the pixels as the value of A. When t (x) is close to 0, J (x) t (x) is also close to 0, which causes the resulting image to contain noise, and therefore a lower limit is set, t 0=0.1。
The specific improvement method comprises the following steps:
for an input single image, firstly converting the image into a CIE-Lab color space, setting a color cast factor D, and according to experience, if D is less than 1.4, the image is a clear image and does not need to be processed, if D is more than 1.4, the image is a degraded image, and the image is distinguished to be a sand-dust image or a haze, rain and snow image according to the chromaticity component value. If the image is a haze image or a rain and snow image, processing the image by adopting an improved dark primary color prior algorithm; if the image is a dust image, a gamma correction limited contrast self-adaptive histogram equalization algorithm is adopted. The algorithm flow herein is shown in fig. 1.
Design of image classifier
The difference between two colors expressed by the RGB color space cannot reflect human visual perception, and the color difference calculated by the CIE-Lab color space is basically consistent with the difference of human actual perception, so that whether the image is color cast or not is detected in the CIE-Lab color space.
Research finds that in a histogram of an ab chromaticity coordinate plane of an image, color cast generally exists if chromaticity distribution is a concentrated single peak value or distribution is concentrated and chromaticity mean value is large; when the distribution exhibited a distinct, dispersed, multi-peak, no color shift was considered. The color cast factor D is introduced herein to calculate the degree of color cast of an image. Under Lab space, introducing the concept of equivalent circle, and adopting the ratio D of the average chroma K of the image and the chroma center distance Z as a color cast factor.
D=K/Z (10)
Where M, N denotes the length and width of the image, and the coordinates of the center of the equivalent circle on the ab chromaticity plane are (ka, kb), and the radius is Z. The distance from the center of the circle to the origin of the central axis of the ab chromaticity plane (a is 0 and b is 0) is K. And judging whether the image is wholly color cast or not according to the specific position of the equivalent circle on the ab chromaticity plane. When the empirical value D is less than or equal to 1.4, the result is considered to beThe image has no color cast, is a clear image and does not need processing. Otherwise, it is a color cast image. In the Lab model, a positive number represents red and a negative end represents green; a positive number for b indicates yellow and a negative end indicates blue. k is a radical ofbAnd b components on an ab chromaticity plane are represented, and are used for judging whether the image is yellow or blue. When k isbWhen the image is more than 0, the image is yellow and is regarded as a dust image, and a gamma correction limited contrast self-adaptive histogram equalization algorithm is adopted; k is a radical ofbAnd when the image is less than 0, the input image is a haze image, a rain and snow image, and an improved dark primary color prior algorithm is adopted.
Haze image enhancement algorithm:
he's dark-primaries prior haze removal algorithm is built on the dark-primaries assumption, and the dark-primaries theory is ineffective when the scene is essentially close to the air layer and no shadow is covered on the scene. In contrast, this section corrects the algorithm by improving the transmittance and the acquisition mode of the atmospheric light a for the area where the dark channel prior fails.
For haze images, in bright areas such as sky and the like which do not meet dark channel priors, the actual transmittance is much higher than the transmittance estimated by the He method, and due to the fact that the transmittance is too small, the color of the bright areas such as sky and the like is recovered wrongly, so that the recovered J (x) is small, and the black spot effect appears at the edge of an object. In the estimation of the atmospheric light a, the He algorithm selects the maximum value of the pixels with the maximum brightness of 0.1% as the intensity of the atmospheric light a, however, if one point is taken, the a values of all channels are likely to be close to 255, which may cause color cast of the processed image and a large amount of color spots. In combination with the above considerations, the algorithm for transmittance and atmospheric light a is improved herein.
Estimation of the bright area transmittance:
since the statistical prior law of dark primaries is not established when a large-area bright area such as sky, water surface, white object, rain, snow, etc. exists, the transmittance estimated by equation (5) is inaccurate, which may cause obvious color distortion in parts such as sky, etc. A threshold value S is first set here and,and judging a bright area in the image, and judging the bright area when the difference value between the atmospheric light value and the dark channel is less than S, otherwise, calculating by using a He method. Through experimental verification, S is 45. For | A c-I (x) S-less areas, judged as bright areas, recalculated transmittance.
The image in the bright area no longer satisfies the dark channel prior law, and the transmittance expression is as follows:
this document estimates the transmittance of the bright regions in a pixel-by-pixel manner. The expression of the transmittance is firstly calculated as formula (11), and then the minimum channel value of the image is obtained, wherein the minimum channel value contains abundant detail and boundary information. In summary, we obtain the transmittance expression:
wherein,
in bright areas such as sky, the RGB channel values of the local window are larger than those of other areas, and the fluctuation of the pixel brightness is smooth. Thus, the β value goes to 1. for regions that satisfy the dark channel prior, the dark channel value goes to 0, calculated as equation (5).
From the above description, we find the expression for the transmittance as:
because in the centre of the local windowTransmittance of lightIs in block-continuous, passing directly throughThe restored image is prone to have mosaic effects such as blocking effect. To remove this blocking effect, guided filtering is employed herein to further refine the transmittance.
Modified atmospheric light a acquisition method:
the value of the atmospheric light a is generally estimated in the region where haze is the thickest, i.e., the region with the largest pixel value is selected. But the maximum pixel value may be taken from the sky, white objects, rain and snow, etc., and thus the resulting a value is close to 255, which may cause color shift of the restored image.
For an image, the areas with the highest concentration of fog are usually located above the image, so the area located 1/4 above the image is taken here as the average of the 10% of the pixels with the highest brightness in the dark primary color as the atmospheric light a. If the sky area in an image is almost completely absent, the haze-densest area is considered to be the area with the farthest field depth, namely the top of the image, so that the value of the atmospheric light A can be obtained by the method.
And (3) image restoration:
and recovering the haze-free image through the corrected atmospheric light constant and the refined transmittance diagram. By substituting expression (14) for expression (6), a restored sharp image j (x) can be obtained:
rain and snow image enhancement algorithm:
degraded images obtained on rainy and snowy days are generally covered with a large amount of rain or snow spots. In the rain and snow image, the pixels affected by rain and snow can be regarded as rain drops or a linear superposition effect of combined action of snow flakes and the background. The physical model is described as follows:
H=(1-)Hb+Hr(16)
where H is the input degraded image, HbDenotes the background part, HrWhich represents the ideal brightness of rain and snow, i.e. the brightness of the pixel at that point when the rain and snow are stationary in the air. Is a ratio parameter, wherein 0 < 1. Observing the imaging model of rain, snow and haze, comparing formula (1) and formula (16) to obtain that I corresponds to H, H bCorresponding to J (x), HrCorresponding to the atmospheric light A, (1-) corresponds to t (x). Then, similarly to the haze removal process, the rain and snow removal process is to restore the background image H from the known degraded image HbWhere (1-) is an unknown quantity, i.e. by determining HrThe value of (2) can be used for removing rain and snow by a haze removing method.
1) Ideal brightness of rain and snow HrIs obtained by
HrWhich represents the brightness value of the rain and snow when they are stationary in the air. Since rain and snow are white, the method for finding the maximum value of brightness in the image is usually applied to HrAnd (6) solving. According to the similarity of the image and the atmospheric light in the haze image, H is obtained by using the method for obtaining the atmospheric light ArThe value of (c).
2) Rain and snow removal process
According to the analysis, the rain and snow removing process can be realized by a haze removing process. Therefore, the rain and snow image is not separately processed, and the rain and snow image is enhanced by adopting a haze removal method.
A sand image enhancement algorithm:
the image obtained under the dust and sand condition is generally earthy yellow, because the reflection of particles such as dust and sand to light has bias, the effect distribution of atmospheric light to RGB three channels is uneven, and the atmospheric light uniformly acts on each color channel under the haze condition, so the haze removing method is not suitable for removing the dust and sand from the image.
Adaptive histogram equalization[10-12]The (AHE) algorithm changes the contrast of an image by computing a local histogram of the image and redistributing the brightness. However, AHE is prone to the problem of over-amplifying the same area noise in the image. The gamma correction is to map the existing gray value by the gray value as the base and the gamma power to obtain the new gray value[13-14]. The main effect is to make some brighter images, the contrast ratio appropriate by selecting different gamma coefficients. Based on the above two considerations, on the basis of the AHE algorithm, the limited-contrast adaptive histogram equalization algorithm of gamma correction is proposed herein to perform enhancement processing on the dust image.
Normalized gamma correction:
gamma correction is essentially a transformation function for adjusting the brightness of an image, mathematically defined as follows:
S=Rγ(17)
where S is an image after gamma correction, R is an input image, and γ is a gamma coefficient. The advantage of gamma correction is that the transformation function can be changed by changing the value of gamma. However, since increasing the γ value excessively compensates the image, the image is blackened while enhancing the contrast. While low quality images generally have a narrow dynamic range, and therefore require an extended dynamic range, the adjustment of the dynamic range is also called normalization. Therefore, the gamma correction function is further normalized to make up for the deficiency of gamma correction, and the contrast is enhanced and the brightness is reduced while the dynamic range is expanded. The normalization function is defined as follows:
And N is the normalized image. Combining (17) and (18) to obtain the normalized gamma correction function N'.
The image after normalization gamma correction processing is equalized by using a contrast-limiting self-adaptive histogram[15](CLAHE) can further improve the image contrast while enhancing the brightness of the image. Thus, not only is the over-enhancement of the brightness avoided, but also the disadvantage of the unbalanced contrast adjustment in the whole image is reduced.
The method comprises the following steps:
firstly, using a normalized gamma correction function to adjust the image contrast;
secondly, the image is divided into a plurality of rectangular blocks with the size of X multiplied by Y, and the size of the rectangular blocks is selected to be 8 multiplied by 8. This divides the image into three distinct regions: a corner region including four corners; a boundary region including all boundaries except for corner regions; including the interior region of the remaining region of the image.
And thirdly, obtaining a histogram of each block by using a Cumulative Distribution Function (CDF). The corresponding CDF is represented by the formula:
in the formula, hi,j(k) Is the histogram of block (i, j) pixel k.
Fourthly, calculating a clipping threshold value, and clipping the histogram to limit the amplification amplitude. The threshold α is calculated as follows:
phi is a clipping factor, lmaxThe maximum slope allowed. This limits not only the slope of the CDF but also the slope of the transform function. Clipping the histogram that exceeds the threshold evenly distributes the clipped portion of the histogram to the other portions of the histogram as shown in fig. 2. During redistribution, some clipped parts may exceed the threshold, and thus the process of clipping and redistribution on the histogram needs to be repeated until the threshold is no longer exceeded.
Calculating the redistributed histogram pixel value with the conversion function. The three different regions of the above segmentation correspond to different transformation functions. For non-central areas of the block, bilinear interpolation is used for calculation. For the inner region, as shown in fig. 3. For a block region with (i, j) as the central pixel in quadrant 1, the value of a certain point P in the region can be determined by the horizontal and vertical distances between the point and the regions with (i, j), (i-1, j), (i, j-1) and (i-1, j-1) as the central regions. The pixel value of P can be calculated as:
h, v, b, c are the established distances in fig. 4. f. ofi,j(. cndot.) is a cumulative distribution function. The other three quadrant algorithms are one term with quadrant 1. The neighborhood of quadrants 1, 3 of the bounding region is similar to the inner region. For quadrants 2, 4, the new pixel value is calculated as follows:
for the corner regions, the different quadrant algorithms are different, so there are:
p′=fi,j(p) (24)
after the sand-dust image is processed by the method, the sand-dust image has a good restoration effect, the contrast is enhanced, and meanwhile, the brightness is not excessively enhanced.