








技术领域technical field
本发明涉及图像处理技术领域,特别涉及是指一种海上图像去雾方法及装置。The present invention relates to the technical field of image processing, and in particular, to a method and device for defogging an image at sea.
背景技术Background technique
海上视频监控是海域监测的重要手段。图像质量对海域情况的判断有重大的影响。但是,海上图像易受海上雾气影响导致图像清晰度下降,因此,需要对获取的海上图像进行去雾处理,现有的去雾方法,例如,暗通道先验算法是在“每一幅图像的每一个像素的RGB三个颜色通道中,总有一个通道的灰度值很低”这一条规律的基础上提出来的,但是由于海上图像具有天空区域占比大、整体环境偏亮的特点,并不符合这一规律,所以应用暗通道先验算法在处理海上图像时会出现天空区域失真的问题。Marine video surveillance is an important means of marine monitoring. Image quality has a significant impact on the judgment of sea conditions. However, marine images are easily affected by marine fog, which leads to a decrease in image clarity. Therefore, it is necessary to dehaze the acquired marine images. Existing dehazing methods, such as the dark channel prior algorithm, are based on "each image. Among the three RGB color channels of each pixel, there is always one channel whose gray value is very low. It is proposed on the basis of the rule. However, because the sea image has the characteristics of a large proportion of the sky area and a brighter overall environment, It does not conform to this rule, so when applying the dark channel prior algorithm, the problem of sky area distortion will occur when processing maritime images.
发明内容SUMMARY OF THE INVENTION
本发明实施例提供了海上图像去雾方法及装置,能够提高去雾后的海上图像的质量。所述技术方案如下:The embodiments of the present invention provide a method and a device for defogging a sea image, which can improve the quality of a sea image after defogging. The technical solution is as follows:
一方面,提供了一种海上图像去雾方法,该方法应用于电子设备,该方法包括:In one aspect, a method for dehazing an image at sea is provided, the method is applied to an electronic device, and the method includes:
获取有雾海上图像,将其分割为天空区域和其他区域;Take an image of the foggy sea and segment it into sky areas and other areas;
利用天空区域求取整幅海上图像的大气光值;Use the sky area to obtain the atmospheric light value of the entire sea image;
对天空区域和其他区域分别求取透射率,根据得到的天空区域和其他区域的透射率确定整幅海上图像的透射率;Calculate the transmittance of the sky area and other areas respectively, and determine the transmittance of the entire sea image according to the obtained transmittances of the sky area and other areas;
根据得到的整幅海上图像的大气光值和透射率,对获取的有雾海上图像进行去雾处理,得到去雾后的海上图像。According to the obtained atmospheric light value and transmittance of the whole marine image, the foggy marine image is dehazed to obtain the defogged marine image.
进一步地,所述获取有雾海上图像,将其分割为天空区域和其他区域包括:Further, obtaining the foggy sea image and dividing it into the sky area and other areas includes:
获取有雾海上图像;Get foggy sea images;
利用超像素分割对获取的有雾海上图像进行预分割,得到多个图像子区域,每个图像子区域为一个超像素;Use superpixel segmentation to pre-segment the acquired foggy sea image to obtain multiple image sub-regions, each image sub-region is a super pixel;
将预分割得到的超像素聚类为两类;Cluster the pre-segmented superpixels into two categories;
对聚类后的图像进行自适应阈值分割,得到天空区域和其他区域。Adaptive threshold segmentation is performed on the clustered images to obtain the sky area and other areas.
进一步地,所述将预分割得到的超像素聚类为两类包括:Further, the superpixels obtained by pre-segmentation are clustered into two categories including:
利用K-均值聚类算法将预分割得到的超像素聚类为两类;The superpixels obtained by pre-segmentation are clustered into two categories by K-means clustering algorithm;
其中,聚类时,超像素聚类中心与超像素之间的距离d表示为:Among them, when clustering, the distance d between the superpixel cluster center and the superpixel is expressed as:
d=ω1drgb+ω2dxyd=ω1 drgb +ω2 dxy
其中,drgb表示颜色空间距离,dxy表示距离空间距离,[ri,gi,bi]为第i个超像素聚类中心像素的R、G、B值,[xi,yi]为第i个超像素聚类中心像素的坐标值,[rj,gj,bj]为第j个超像素中心像素的R、G、B值,[xj,yj]为第j个超像素中心像素的坐标值,ω1和ω2分别为颜色空间距离drgb和距离空间距离dxy的权重。Among them, drgb represents the color space distance, dxy represents the distance space distance, [ri , gi , bi ] is the R, G, B value of the i-th superpixel cluster center pixel, [xi , yi ] is the coordinate value of the center pixel of the i-th superpixel cluster, [rj , gj , bj ] is the R, G, B value of the j-th superpixel center pixel, [xj , yj ] is the The coordinate values of the center pixels of the j superpixels, ω1 and ω2 are the weights of the color space distance drgb and the distance space distance dxy , respectively.
进一步地,所述对聚类后的图像进行自适应阈值分割,得到天空区域和其他区域包括:Further, the adaptive threshold segmentation is performed on the clustered images to obtain the sky area and other areas including:
将聚类得到的两类超像素聚类中心像素的灰度值的平均值作为自适应阈值;The average value of the gray value of the center pixels of the two types of superpixel clusters obtained by clustering is used as the adaptive threshold;
将大于等于自适应阈值的像素划分到天空区域,将小于自适应阈值的像素划分到其他区域。Pixels greater than or equal to the adaptive threshold are divided into the sky area, and pixels smaller than the adaptive threshold are divided into other areas.
进一步地,所述利用天空区域求取整幅海上图像的大气光值包括:Further, the use of the sky area to obtain the atmospheric light value of the entire maritime image includes:
对天空区域灰度图各像素点的灰度值按照从大到小进行排序,取前k%的像素点对应的原有雾海上图像像素点的每个通道的灰度值的平均值作为获取的有雾海上图像对应通道的大气光值,即大气光值是一个三元素向量,每一个元素对应于每一个颜色通道。Sort the gray value of each pixel point in the grayscale image of the sky area in descending order, and take the average value of the gray value of each channel of the pixel points of the original foggy sea image corresponding to the first k% of the pixel points as the acquisition. The foggy sea image corresponds to the atmospheric light value of the channel, that is, the atmospheric light value is a three-element vector, each element corresponding to each color channel.
进一步地,所述对天空区域和其他区域分别求取透射率,根据得到的天空区域和其他区域的透射率确定整幅海上图像的透射率包括:Further, calculating the transmittance for the sky area and other areas respectively, and determining the transmittance of the entire marine image according to the obtained transmittance of the sky area and other areas includes:
对天空区域和其他区域分别求取透射率,对求取的透射率进行导向滤波;Calculate the transmittance for the sky area and other areas respectively, and perform guided filtering on the obtained transmittance;
将导向滤波后的天空区域和其他区域的透射率进行拼接融合;Splicing and merging the transmittances of the guided filtered sky area and other areas;
对拼接融合后的透射率进行导向滤波,得到整幅海上图像的透射率。Guided filtering is performed on the spliced and fused transmittance to obtain the transmittance of the entire marine image.
进一步地,在根据得到的整幅海上图像的大气光值和透射率,对获取的有雾海上图像进行去雾处理,得到去雾后的海上图像之后,所述方法还包括:Further, after performing dehazing processing on the obtained foggy marine image according to the obtained atmospheric light value and transmittance of the entire marine image to obtain a dehazed marine image, the method further includes:
检测去雾后的海上图像的平均亮度是否大于或等于预设的亮度阈值,若不是,则去雾后的海上图像偏暗,调整去雾后的海上图像的平均亮度为预设的亮度阈值。Detect whether the average brightness of the sea image after defogging is greater than or equal to the preset brightness threshold, if not, the sea image after defogging is darker, and adjust the average brightness of the sea image after defogging to the preset brightness threshold.
一方面,提供了一种海上图像去雾装置,该装置应用于电子设备,该装置包括:In one aspect, a marine image defogging device is provided, the device is applied to electronic equipment, and the device includes:
分割模块,用于获取有雾海上图像,将其分割为天空区域和其他区域;Segmentation module for taking foggy sea images and segmenting them into sky areas and other areas;
第一确定模块,用于利用天空区域求取整幅海上图像的大气光值;The first determination module is used to obtain the atmospheric light value of the entire maritime image by using the sky area;
第二确定模块,用于对天空区域和其他区域分别求取透射率,根据得到的天空区域和其他区域的透射率确定整幅海上图像的透射率;The second determination module is used to obtain the transmittance of the sky area and other areas respectively, and determine the transmittance of the entire marine image according to the obtained transmittances of the sky area and other areas;
去雾模块,用于根据得到的整幅海上图像的大气光值和透射率,对获取的有雾海上图像进行去雾处理,得到去雾后的海上图像。The defogging module is used to perform defogging processing on the acquired foggy marine image according to the obtained atmospheric light value and transmittance of the entire marine image, so as to obtain a defogged marine image.
一方面,提供了一种电子设备,所述电子设备包括处理器和存储器,所述存储器中存储有至少一条指令,所述至少一条指令由所述处理器加载并执行以实现上述海上图像去雾方法。In one aspect, an electronic device is provided, the electronic device includes a processor and a memory, the memory stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the above-mentioned dehazing of marine images method.
一方面,提供了一种计算机可读存储介质,所述存储介质中存储有至少一条指令,所述至少一条指令由处理器加载并执行以实现上述海上图像去雾方法。In one aspect, a computer-readable storage medium is provided, wherein at least one instruction is stored in the storage medium, and the at least one instruction is loaded and executed by a processor to implement the above method for dehazing an image at sea.
本发明实施例提供的技术方案带来的有益效果至少包括:The beneficial effects brought by the technical solutions provided by the embodiments of the present invention include at least:
本发明实施例中,获取有雾海上图像,将其分割为天空区域和其他区域;利用天空区域求取整幅海上图像的大气光值;对天空区域和其他区域分别求取透射率,根据得到的天空区域和其他区域的透射率确定整幅海上图像的透射率;根据得到的整幅海上图像的大气光值和透射率,对获取的有雾海上图像进行去雾处理,得到去雾后的海上图像,这样,将有雾海上图像分割为天空区域和其他区域分别计算透射率后再确定整幅海上图像的透射率,能够避免去雾后天空区域失真的问题,从而提高去雾后的海上图像的质量。In the embodiment of the present invention, a foggy sea image is obtained and divided into a sky area and other areas; the sky area is used to obtain the atmospheric light value of the entire sea image; the transmittance is obtained for the sky area and other areas respectively, according to the obtained The transmittance of the entire sea image is determined by the transmittance of the sky area and other areas; according to the obtained atmospheric light value and transmittance of the entire sea image, the foggy sea image obtained is subjected to defogging processing, and the defogged sea image is obtained. Sea image, in this way, the foggy sea image is divided into sky area and other areas, and the transmittance is calculated separately, and then the transmittance of the whole sea image can be determined, which can avoid the problem of distortion of the sky area after defogging, and improve the sea after defogging. image quality.
附图说明Description of drawings
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to illustrate the technical solutions in the embodiments of the present invention more clearly, the following briefly introduces the accompanying drawings used in the description of the embodiments. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can also be obtained from these drawings without creative effort.
图1为本发明实施例提供的海上图像去雾方法的流程示意图;1 is a schematic flowchart of a method for dehazing an image at sea according to an embodiment of the present invention;
图2为本发明实施例提供的海上图像去雾方法的详细流程示意图;FIG. 2 is a detailed schematic flowchart of a method for dehazing an image at sea according to an embodiment of the present invention;
图3为本发明实施例提供的待处理的有雾海上图像的示意图;3 is a schematic diagram of a foggy marine image to be processed provided by an embodiment of the present invention;
图4为本发明实施例提供的拼接融合后得到的透射率图;4 is a transmittance diagram obtained after splicing and fusion provided by an embodiment of the present invention;
图5为本发明实施例提供的导向滤波后得到的最终的透射率图;FIG. 5 is a final transmittance diagram obtained after guided filtering provided by an embodiment of the present invention;
图6为本发明实施例提供的去雾后的海上图像示意图;6 is a schematic diagram of a sea image after defogging provided by an embodiment of the present invention;
图7为本发明实施例提供的调整亮度后,得到最终的去雾后的海上图像示意图;FIG. 7 is a schematic diagram of obtaining a final dehazing image of the sea after adjusting the brightness according to an embodiment of the present invention;
图8为本发明实施例提供的海上图像去雾装置的结构示意图;8 is a schematic structural diagram of a device for defogging an image at sea according to an embodiment of the present invention;
图9是本发明实施例提供的一种电子设备的结构示意图。FIG. 9 is a schematic structural diagram of an electronic device provided by an embodiment of the present invention.
具体实施方式Detailed ways
为使本发明的目的、技术方案和优点更加清楚,下面将结合附图对本发明实施方式作进一步地详细描述。In order to make the objectives, technical solutions and advantages of the present invention clearer, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.
如图1所示,本发明实施例提供了一种海上图像去雾方法,该方法可以由电子设备实现,该电子设备可以是终端或服务器,该方法包括:As shown in FIG. 1 , an embodiment of the present invention provides a method for dehazing an image at sea. The method can be implemented by an electronic device, and the electronic device can be a terminal or a server. The method includes:
S1,获取有雾海上图像,将其分割为天空区域和其他区域;S1, get the foggy sea image and segment it into sky area and other areas;
S2,利用天空区域求取整幅海上图像的大气光值;S2, use the sky area to obtain the atmospheric light value of the entire sea image;
S3,对天空区域和其他区域分别求取透射率,根据得到的天空区域和其他区域的透射率确定整幅海上图像的透射率;S3, calculate the transmittance of the sky area and other areas respectively, and determine the transmittance of the entire marine image according to the obtained transmittances of the sky area and other areas;
S4,根据得到的整幅海上图像的大气光值和透射率,对获取的有雾海上图像进行去雾处理,得到去雾后的海上图像。S4, according to the obtained atmospheric light value and transmittance of the entire marine image, perform dehazing processing on the obtained foggy marine image to obtain a defogged marine image.
本发明实施例所述的海上图像去雾方法,获取有雾海上图像,将其分割为天空区域和其他区域;利用天空区域求取整幅海上图像的大气光值;对天空区域和其他区域分别求取透射率,根据得到的天空区域和其他区域的透射率确定整幅海上图像的透射率;根据得到的整幅海上图像的大气光值和透射率,对获取的有雾海上图像进行去雾处理,得到去雾后的海上图像,这样,将有雾海上图像分割为天空区域和其他区域分别计算透射率后再确定整幅海上图像的透射率,能够避免去雾后天空区域失真的问题,从而提高去雾后的海上图像的质量。The method for dehazing a sea image according to the embodiment of the present invention obtains a foggy sea image and divides it into a sky area and other areas; uses the sky area to obtain the atmospheric light value of the entire sea image; separates the sky area and other areas Calculate the transmittance, and determine the transmittance of the entire marine image according to the obtained transmittances of the sky area and other areas; according to the obtained atmospheric light value and transmittance of the entire marine image, defog the obtained foggy marine image process to obtain the sea image after defogging. In this way, the foggy sea image is divided into the sky area and other areas, and the transmittance is calculated separately, and then the transmittance of the whole sea image is determined, which can avoid the problem of sky area distortion after defogging. Thereby, the quality of the sea image after dehazing is improved.
在前述海上图像去雾方法的具体实施方式中,进一步地,如图2所示,所述获取有雾海上图像,将其分割为天空区域和其他区域包括:In the specific implementation of the aforementioned method for dehazing images at sea, further, as shown in FIG. 2 , obtaining a foggy sea image and dividing it into a sky area and other areas includes:
A1,获取有雾海上图像;A1, get foggy sea image;
A2,利用超像素分割对获取的有雾海上图像进行预分割,得到多个图像子区域,每个图像子区域为一个超像素;A2, use superpixel segmentation to pre-segment the acquired foggy sea image to obtain multiple image sub-regions, each of which is a super-pixel;
A3,将预分割得到的超像素聚类为两类,得到初步的天空区域和其他区域;A3, cluster the superpixels obtained by pre-segmentation into two categories to obtain the preliminary sky area and other areas;
A4,对聚类后的图像进行自适应阈值分割,得到天空区域和其他区域。A4, perform adaptive threshold segmentation on the clustered image to obtain the sky area and other areas.
本实施例中,对聚类后的图像进行自适应阈值分割,得到获取的有雾海上图像最终的天空区域和其他区域。In this embodiment, adaptive threshold segmentation is performed on the clustered images to obtain the final sky area and other areas of the acquired foggy sea image.
在前述海上图像去雾方法的具体实施方式中,进一步地,所述将预分割得到的超像素聚类为两类包括:In the specific implementation of the aforementioned method for dehazing images at sea, further, the superpixels obtained by pre-segmentation are clustered into two categories including:
利用K-均值(K-means)聚类算法将预分割得到的超像素聚类为两类;The superpixels obtained by pre-segmentation are clustered into two categories by K-means clustering algorithm;
其中,聚类时,表示为:Among them, when clustering, it is expressed as:
d=ω1drgb+ω2dxyd=ω1 drgb +ω2 dxy
其中,drgb表示颜色空间距离,dxy表示距离空间距离,[ri,gi,bi]为第i个超像素聚类中心像素的R、G、B值,[xi,yi]为第i个超像素聚类中心像素的坐标值,[rj,gj,bj]为第j个超像素中心像素的R、G、B值,[xj,yj]为第j个超像素中心像素的坐标值,ω1和ω2分别为颜色空间距离drgb和距离空间距离dxy的权重,ω1和ω2的取值范围为0~1,且0<(ω1+ω2)<1。Among them, drgb represents the color space distance, dxy represents the distance space distance, [ri , gi , bi ] is the R, G, B value of the i-th superpixel cluster center pixel, [xi , yi ] is the coordinate value of the center pixel of the i-th superpixel cluster, [rj , gj , bj ] is the R, G, B value of the j-th superpixel center pixel, [xj , yj ] is the The coordinate value of the center pixel of j superpixels, ω1 and ω2 are the weights of the color space distance drgb and the distance space distance dxy respectively, the value range of ω1 and ω2 is 0~1, and 0<(ω1 +ω2 )<1.
本实施例中,在五维空间(具体指:五维特征向量F=[r,g,b,x,y])上计算超像素聚类中心与超像素之间的距离d,并根据计算得到的距离d进行聚类,能够提高分类的准确性。In this embodiment, the distance d between the superpixel cluster center and the superpixel is calculated on the five-dimensional space (specifically: the five-dimensional feature vector F=[r, g, b, x, y]), and according to the calculation The obtained distance d is clustered, which can improve the classification accuracy.
在前述海上图像去雾方法的具体实施方式中,进一步地,所述对聚类后的图像进行自适应阈值分割,得到天空区域和其他区域包括:In the specific implementation of the aforementioned method for dehazing images at sea, further, the adaptive threshold segmentation is performed on the clustered images to obtain the sky area and other areas including:
将聚类得到的两类超像素聚类中心像素的灰度值的平均值作为自适应阈值;The average value of the gray value of the center pixels of the two types of superpixel clusters obtained by clustering is used as the adaptive threshold;
将大于等于自适应阈值的像素划分到天空区域,将小于自适应阈值的像素划分到其他区域。Pixels greater than or equal to the adaptive threshold are divided into the sky area, and pixels smaller than the adaptive threshold are divided into other areas.
现有的去雾方法中应用整幅图像的灰度图中亮度为前0.1%的像素点对应的原有雾海上图像像素点处像素值的均值作为大气光值,但是,由于海上图像中存在船舶等白色物体,按现有的去雾方法所求的大气光值可能会偏大,所以,本实施例中,选取天空区域的部分像素计算大气光值,具体的:对天空区域灰度图各像素点的灰度值按照从大到小进行排序,取前k%(例如,1%)的像素点对应的原有雾海上图像像素点的每个通道的灰度值的平均值作为获取的有雾海上图像对应通道的大气光值,即大气光值是一个三元素向量,每一个元素对应于每一个颜色通道;这样,在进行海上图像去雾时,避免了海上其他白色物体等偏亮物体对大气光值的计算产生影响。In the existing dehazing method, the average value of the pixel values at the pixels of the original foggy sea image corresponding to the pixels whose brightness is the first 0.1% in the grayscale image of the whole image is used as the atmospheric light value. For white objects such as ships, the atmospheric light value obtained by the existing dehazing method may be too large. Therefore, in this embodiment, some pixels in the sky area are selected to calculate the atmospheric light value. Specifically: for the grayscale image of the sky area The gray value of each pixel is sorted in descending order, and the average value of the gray value of each channel of the pixel points of the original fog sea image corresponding to the first k% (for example, 1%) pixels is taken as the acquisition. The atmospheric light value of the corresponding channel of the foggy sea image, that is, the atmospheric light value is a three-element vector, and each element corresponds to each color channel; in this way, when the sea image is defogged, other white objects on the sea are avoided. Bright objects affect the calculation of atmospheric light values.
在前述海上图像去雾方法的具体实施方式中,进一步地,所述对天空区域和其他区域分别求取透射率,根据得到的天空区域和其他区域的透射率确定整幅海上图像的透射率包括:In the specific embodiment of the above-mentioned method for dehazing the marine image, further, the transmittance of the sky area and other areas are obtained respectively, and the transmittance of the entire marine image is determined according to the obtained transmittances of the sky area and other areas, including: :
对天空区域和其他区域分别求取透射率,对求取的透射率进行导向滤波;Calculate the transmittance for the sky area and other areas respectively, and perform guided filtering on the obtained transmittance;
将导向滤波后的天空区域和其他区域的透射率进行拼接融合;Splicing and merging the transmittances of the guided filtered sky area and other areas;
对拼接融合后的透射率进行导向滤波,得到整幅海上图像的透射率。Guided filtering is performed on the spliced and fused transmittance to obtain the transmittance of the entire marine image.
本实施例中,计算图像透射率时,可以应用暗通道先验算法中的计算方法,具体的:假设在图像中一定大小的矩形窗口Ω(x)内,传输函数t(x)的值为定值估计的传输函数的定值为:In this embodiment, when calculating the image transmittance, the calculation method in the dark channel prior algorithm can be applied. Specifically, it is assumed that in a rectangular window Ω(x) of a certain size in the image, the value of the transfer function t(x) is Value The estimated transfer function is given as:
其中,t(x)表示像素点x的透射率;I(x)表示像素点x的像素值;c表示R、G、B三通道中的某一通道;A表示大气光值;ω是为了防止去雾太过彻底,恢复出的景物不自然,引入的参数。Among them, t(x) represents the transmittance of the pixel point x; I(x) represents the pixel value of the pixel point x; c represents a channel in the three channels of R, G, and B; A represents the atmospheric light value; ω is for To prevent the fog removal from being too thorough, the restored scene is unnatural, and the parameters introduced.
本实施例中,天空区域和其他区域选取不同的参数ω计算透射率,求得透射率后对其进行导向滤波,细化透射率图,然后将导向滤波后的两部分透射率融合到一起后进行导向滤波,得到整幅海上图像的透射率。In this embodiment, different parameters ω are selected for the sky area and other areas to calculate the transmittance, and after the transmittance is obtained, guide filtering is performed on it, the transmittance map is refined, and the two parts of the transmittance after the guide filtering are fused together. Guided filtering is performed to obtain the transmittance of the entire marine image.
本实施例中,根据得到的整幅海上图像的大气光值和透射率,利用去雾模型对获取的有雾海上图像进行去雾处理,得到去雾后的海上图像,其中,所述去雾模型表示为:In this embodiment, according to the obtained atmospheric light value and transmittance of the entire marine image, a dehazing model is used to dehaze the obtained foggy marine image, so as to obtain a dehazed marine image, wherein the dehazed marine image is obtained. The model is represented as:
其中,J表示去雾后的海上图像的像素值,当t(x)很小时,会使J(x)偏大,从而导致图像整体向白场过渡,所以一般设置一个阈值t0,当t<t0时,令t=t0,t0一般取0.1,因此,优化后的去雾模型可以表示为:Among them, J represents the pixel value of the sea image after dehazing. When t(x) is small, J(x) will be too large, resulting in the overall transition of the image to white point. Therefore, a threshold t0 is generally set, and when t When <t0 , let t=t0 , and t0 is generally taken as 0.1. Therefore, the optimized dehazing model can be expressed as:
在前述海上图像去雾方法的具体实施方式中,进一步地,在根据得到的整幅海上图像的大气光值和透射率,对获取的有雾海上图像进行去雾处理,得到去雾后的海上图像之后,所述方法还包括:In the specific implementation of the above-mentioned method for dehazing images at sea, further, according to the obtained atmospheric light value and transmittance of the whole sea image, dehazing processing is performed on the obtained image of the sea with fog, so as to obtain the sea image after dehazing. After the image, the method further includes:
检测去雾后的海上图像的平均亮度是否大于或等于预设的亮度阈值,若不是,则去雾后的海上图像偏暗,调整去雾后的海上图像的平均亮度为预设的亮度阈值。Detect whether the average brightness of the sea image after defogging is greater than or equal to the preset brightness threshold, if not, the sea image after defogging is darker, and adjust the average brightness of the sea image after defogging to the preset brightness threshold.
现有的去雾方法(例如,暗通道先验算法)处理的图像整体偏暗,因此,本实施例中,得到去雾图像后,检测图像亮度,对去雾后偏暗的海上图像亮度做了调整,提亮偏暗图像,得到最终去雾后的海上图像,使其更符合人眼观察的习惯。The image processed by the existing dehazing method (for example, the dark channel prior algorithm) is dark as a whole. Therefore, in this embodiment, after the dehazing image is obtained, the image brightness is detected, and the brightness of the dark sea image after dehazing is determined. After adjustment, the dark image is brightened, and the final sea image after dehazing is obtained, which is more in line with the habit of human eye observation.
本实施例所述的海上图像去雾方法是一种在海天环境下对图像进行去雾的方法,不仅能够去除海天环境下图像上的雾,还能去除海天环境下图像上的霾,能够避免去雾后天空区域失真和去雾后海上图像变暗的问题,从而提高去雾后的海上图像的质量。The method for dehazing an image at sea described in this embodiment is a method for dehazing an image in a sea-sky environment, which can not only remove the fog on the image in the sea-sky environment, but also remove the haze on the image in the sea-sky environment. Distortion of sky area after defogging and darkening of sea image after defogging, thus improving the quality of sea image after defogging.
结合具体的待处理图像对本发明实施例提供的海上图像去雾方法的有效性进行验证,图3为待处理的有雾海上图像,将待处理的有雾海上图像分为两个区域,即天空区域和其他区域,在进行海上图像去雾时,应用天空区域求取大气光值,在计算透射率时,对天空区域和其他区区域选取不同的参数ω求透射率,在本实施例中,天空区域的参数为ω=0.65,其他区域的参数为ω=0.75,两部分透射率拼接融合后得到的透射率图如图4所示。对图4进行导向滤波,得到最终的透射率图,如图5所示。应用上面得到的大气光值和透射率,对有雾海上图像进行去雾,得到去雾后的海上图像,如图6所示,调整去雾后的海上图像的亮度得到最终的去雾后的海上图像,如图7所示。The effectiveness of the method for dehazing the marine image provided by the embodiment of the present invention is verified in combination with the specific image to be processed. FIG. 3 is a foggy marine image to be processed, and the foggy marine image to be processed is divided into two areas, namely the sky. In the area and other areas, when the sea image is dehazed, the sky area is used to obtain the atmospheric light value. When calculating the transmittance, different parameters ω are selected for the sky area and other areas to obtain the transmittance. In this embodiment, The parameter of the sky area is ω=0.65, and the parameter of other areas is ω=0.75. The transmittance map obtained after the two parts of transmittance are spliced and merged is shown in Figure 4. Guided filtering is performed on Figure 4 to obtain the final transmittance map, as shown in Figure 5. Apply the atmospheric light value and transmittance obtained above to dehaze the foggy marine image to obtain the dehazed marine image, as shown in Figure 6, adjust the brightness of the dehazed marine image to obtain the final dehazed image. Sea image, as shown in Figure 7.
本发明还提供一种海上图像去雾装置的具体实施方式,由于本发明提供的海上图像去雾装置与前述海上图像去雾方法的具体实施方式相对应,该海上图像去雾装置可以通过执行上述方法具体实施方式中的流程步骤来实现本发明的目的,因此上述海上图像去雾方法具体实施方式中的解释说明,也适用于本发明提供的海上图像去雾装置的具体实施方式,在本发明以下的具体实施方式中将不再赘述。The present invention also provides a specific embodiment of a device for defogging a marine image. Since the device for defogging a marine image provided by the present invention corresponds to the specific embodiment of the above-mentioned method for defogging a marine image, the device for defogging a marine image can perform the above-mentioned method. The process steps in the specific embodiment of the method are used to achieve the purpose of the present invention. Therefore, the explanations in the specific embodiment of the above-mentioned method for dehazing a marine image are also applicable to the specific embodiment of the device for defogging a marine image provided by the present invention. The detailed description will not be repeated in the following specific implementation manner.
如图8所示,本发明实施例还提供一种海上图像去雾装置,包括:As shown in FIG. 8 , an embodiment of the present invention further provides a device for defogging an image at sea, including:
分割模块11,用于获取有雾海上图像,将其分割为天空区域和其他区域;The segmentation module 11 is used to obtain the foggy sea image and segment it into the sky area and other areas;
第一确定模块12,用于利用天空区域求取整幅海上图像的大气光值;The first determination module 12 is used to obtain the atmospheric light value of the entire maritime image by using the sky area;
第二确定模块13,用于对天空区域和其他区域分别求取透射率,根据得到的天空区域和其他区域的透射率确定整幅海上图像的透射率;The second determination module 13 is used to obtain the transmittance of the sky area and other areas respectively, and determine the transmittance of the entire marine image according to the obtained transmittance of the sky area and other areas;
去雾模块14,用于根据得到的整幅海上图像的大气光值和透射率,对获取的有雾海上图像进行去雾处理,得到去雾后的海上图像。The defogging module 14 is configured to perform defogging processing on the obtained foggy marine image according to the obtained atmospheric light value and transmittance of the entire marine image, so as to obtain a defogged marine image.
本发明实施例所述的海上图像去雾装置,获取有雾海上图像,将其分割为天空区域和其他区域;利用天空区域求取整幅海上图像的大气光值;对天空区域和其他区域分别求取透射率,根据得到的天空区域和其他区域的透射率确定整幅海上图像的透射率;根据得到的整幅海上图像的大气光值和透射率,对获取的有雾海上图像进行去雾处理,得到去雾后的海上图像,这样,将有雾海上图像分割为天空区域和其他区域分别计算透射率后再确定整幅海上图像的透射率,能够避免去雾后天空区域失真的问题,从而提高去雾后的海上图像的质量。The marine image defogging device according to the embodiment of the present invention obtains a foggy marine image and divides it into a sky area and other areas; uses the sky area to obtain the atmospheric light value of the entire marine image; separates the sky area and other areas Calculate the transmittance, and determine the transmittance of the entire marine image according to the obtained transmittances of the sky area and other areas; according to the obtained atmospheric light value and transmittance of the entire marine image, defog the obtained foggy marine image process to obtain the sea image after defogging. In this way, the foggy sea image is divided into the sky area and other areas, and the transmittance is calculated separately, and then the transmittance of the whole sea image is determined, which can avoid the problem of sky area distortion after defogging. Thereby, the quality of the sea image after dehazing is improved.
图9是本发明实施例提供的一种电子设备600的结构示意图,该电子设备600可因配置或性能不同而产生比较大的差异,可以包括一个或一个以上处理器(centralprocessing units,CPU)601和一个或一个以上的存储器602,其中,所述存储器602中存储有至少一条指令,所述至少一条指令由所述处理器601加载并执行以实现上述海上图像去雾方法。9 is a schematic structural diagram of an
在示例性实施例中,还提供了一种计算机可读存储介质,例如包括指令的存储器,上述指令可由终端中的处理器执行以完成上述海上图像去雾方法。例如,所述计算机可读存储介质可以是ROM、随机存取存储器(RAM)、CD-ROM、磁带、软盘和光数据存储设备等。In an exemplary embodiment, a computer-readable storage medium, such as a memory including instructions, is also provided, and the instructions can be executed by a processor in the terminal to complete the above-mentioned method for dehazing an image at sea. For example, the computer-readable storage medium may be ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, and the like.
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。Those of ordinary skill in the art can understand that all or part of the steps of implementing the above embodiments can be completed by hardware, or can be completed by instructing relevant hardware through a program, and the program can be stored in a computer-readable storage medium. The storage medium mentioned may be a read-only memory, a magnetic disk or an optical disk, etc.
以上所述仅为本发明的较佳实施例,并不用以限制本发明,凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。The above are only preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention shall be included in the protection of the present invention. within the range.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010785724.7ACN111899198A (en) | 2020-08-06 | 2020-08-06 | A method and device for dehazing images at sea |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010785724.7ACN111899198A (en) | 2020-08-06 | 2020-08-06 | A method and device for dehazing images at sea |
| Publication Number | Publication Date |
|---|---|
| CN111899198Atrue CN111899198A (en) | 2020-11-06 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202010785724.7APendingCN111899198A (en) | 2020-08-06 | 2020-08-06 | A method and device for dehazing images at sea |
| Country | Link |
|---|---|
| CN (1) | CN111899198A (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN112907461A (en)* | 2021-01-26 | 2021-06-04 | 中国科学院上海技术物理研究所 | Defogging and enhancing method for infrared degraded image in foggy day |
| CN116740572A (en)* | 2023-06-25 | 2023-09-12 | 湖南大学 | Marine vessel target detection method and system based on improved YOLOX |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN104794688A (en)* | 2015-03-12 | 2015-07-22 | 北京航空航天大学 | Single image defogging method and device based on depth information separation sky region |
| CN107301623A (en)* | 2017-05-11 | 2017-10-27 | 北京理工大学珠海学院 | A kind of traffic image defogging method split based on dark and image and system |
| CN108876743A (en)* | 2018-06-26 | 2018-11-23 | 中山大学 | A kind of image rapid defogging method, system, terminal and storage medium |
| CN109523480A (en)* | 2018-11-12 | 2019-03-26 | 上海海事大学 | A kind of defogging method, device, computer storage medium and the terminal of sea fog image |
| US20190114747A1 (en)* | 2016-04-07 | 2019-04-18 | Carmel Haifa University Economic Corporation Ltd. | Image dehazing and restoration |
| CN110211067A (en)* | 2019-05-27 | 2019-09-06 | 哈尔滨工程大学 | One kind being used for UUV Layer Near The Sea Surface visible images defogging method |
| CN110428371A (en)* | 2019-07-03 | 2019-11-08 | 深圳大学 | Image defogging method, system, storage medium and electronic equipment based on super-pixel segmentation |
| CN110715622A (en)* | 2019-09-04 | 2020-01-21 | 华中科技大学 | A method for measuring the cross-sectional area of a cable conductor |
| CN111340826A (en)* | 2020-03-25 | 2020-06-26 | 南京林业大学 | Single tree crown segmentation algorithm for aerial image based on superpixels and topological features |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN104794688A (en)* | 2015-03-12 | 2015-07-22 | 北京航空航天大学 | Single image defogging method and device based on depth information separation sky region |
| US20190114747A1 (en)* | 2016-04-07 | 2019-04-18 | Carmel Haifa University Economic Corporation Ltd. | Image dehazing and restoration |
| CN107301623A (en)* | 2017-05-11 | 2017-10-27 | 北京理工大学珠海学院 | A kind of traffic image defogging method split based on dark and image and system |
| CN108876743A (en)* | 2018-06-26 | 2018-11-23 | 中山大学 | A kind of image rapid defogging method, system, terminal and storage medium |
| CN109523480A (en)* | 2018-11-12 | 2019-03-26 | 上海海事大学 | A kind of defogging method, device, computer storage medium and the terminal of sea fog image |
| CN110211067A (en)* | 2019-05-27 | 2019-09-06 | 哈尔滨工程大学 | One kind being used for UUV Layer Near The Sea Surface visible images defogging method |
| CN110428371A (en)* | 2019-07-03 | 2019-11-08 | 深圳大学 | Image defogging method, system, storage medium and electronic equipment based on super-pixel segmentation |
| CN110715622A (en)* | 2019-09-04 | 2020-01-21 | 华中科技大学 | A method for measuring the cross-sectional area of a cable conductor |
| CN111340826A (en)* | 2020-03-25 | 2020-06-26 | 南京林业大学 | Single tree crown segmentation algorithm for aerial image based on superpixels and topological features |
| Title |
|---|
| TIANYANG DONG 等: "Efficient Traffic Video Dehazing Using Adaptive Dark Channel Prior and Spatial-Temporal Correlations", 《SENSORS》, vol. 19, no. 7, pages 1 - 19* |
| 刘靖逸 等: "基于超像素分类的海天线检测方法", 《计量与测试技术》, vol. 44, no. 3, pages 104 - 106* |
| 陈浩 等: "基于ACO和K-means算法相结合的生菜叶片图像分割方法", 《现代计算机》, pages 45 - 49* |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN112907461A (en)* | 2021-01-26 | 2021-06-04 | 中国科学院上海技术物理研究所 | Defogging and enhancing method for infrared degraded image in foggy day |
| CN116740572A (en)* | 2023-06-25 | 2023-09-12 | 湖南大学 | Marine vessel target detection method and system based on improved YOLOX |
| Publication | Publication Date | Title |
|---|---|---|
| Zhang et al. | Underwater image enhancement via principal component fusion of foreground and background | |
| CN109460754A (en) | A kind of water surface foreign matter detecting method, device, equipment and storage medium | |
| Pei et al. | Effective image haze removal using dark channel prior and post-processing | |
| CN109087254A (en) | Unmanned plane image haze sky and white area adaptive processing method | |
| CN115631116B (en) | Aircraft power inspection system based on binocular vision | |
| CN111145086A (en) | Image processing method and device and electronic equipment | |
| CN113537037A (en) | Pavement disease identification method, system, electronic device and storage medium | |
| US12183060B2 (en) | Method and apparatus for extreme-light image enhancement | |
| CN113344796A (en) | Image processing method, device, equipment and storage medium | |
| CN116843581B (en) | Image enhancement method, system, device and storage medium for multi-scene graph | |
| Mi et al. | Multi-purpose oriented real-world underwater image enhancement | |
| Kumar et al. | Region-based adaptive single image dehazing, detail enhancement and pre-processing using auto-colour transfer method | |
| CN111899198A (en) | A method and device for dehazing images at sea | |
| CN111192213A (en) | Image defogging adaptive parameter calculation method, image defogging method and system | |
| CN117808699A (en) | Real world single image defogging method based on sky region segmentation and image fusion | |
| CN112200755A (en) | Image defogging method | |
| CN111311610A (en) | Image segmentation method and terminal device | |
| CN113379631B (en) | Image defogging method and device | |
| CN111598788A (en) | A single image dehazing method based on quadtree decomposition and non-local priors | |
| CN117078562B (en) | Video image defogging method, device, computer equipment and medium | |
| Rani et al. | for Underwater Image Enhancement | |
| US20240177316A1 (en) | Method for segmenting roads in images, electronic device, and storage medium | |
| CN115527257B (en) | Face recognition method and device | |
| CN110310235B (en) | Fundus image processing method, device and equipment and storage medium | |
| CN115908150A (en) | Image enhancement method and device, computer equipment and computer readable storage medium |
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| RJ01 | Rejection of invention patent application after publication | ||
| RJ01 | Rejection of invention patent application after publication | Application publication date:20201106 |