Light Random Sprays Retinex 传统的图像增强算法LRSR


前言

  Light Random Sprays Retinex, 即“光随机喷雾Retinex”,简称LRSR。作为一种改进的图像处理算法,旨在实现局部颜色恒定性和图像增强,同时解决原始随机喷雾Retinex(RSR)算法在降低噪声和计算成本方面的问题。
  该算法引入了一种新的噪声去除方法,使得可以使用更小尺寸的喷雾,从而降低了计算成本。同时通过插值技术进一步提高计算效率,保持了图像的感知质量。


1、Light Random Sprays Retinex 概况

论文名称:
Light Random Sprays Retinex: Exploiting the Noisy Illumination Estimation
作者:
Nikola Banić,Sven Lončarić

  “光随机喷雾Retinex”(Light Random Sprays Retinex,简称LRSR)的算法,基于Retinex模型(解释了人类视觉系统如何根据周围视觉场景感知颜色,即颜色感知的局部性),通过随机喷雾的方式来模拟像素邻域,计算新的像素强度,以实现动态范围压缩、颜色恒常性和颜色及亮度的再现。其与路径依赖的方法相比,LRSR算法减少了对路径几何形状的依赖,降低了计算成本,并减少了采样噪声。

2、Light Random Sprays Retinex 具体实现

2.1、噪声去除

  通过计算各通道每个像素的强度变化,并应用低通滤波器,以实现在显著改变图像亮度和颜色变化的前提下,有效减少噪声。
① 计算局部强度变化:
  对于每个像素,计算其在应用RSR算法后的强度变化,其通过比较原始图像和RSR处理后的图像的像素值来完成。强度变化即:I’(x,y,c)=I(x,y,c)-Irsr(x,y,c),其中,I(x,y,c)是原始图像的像素值,Irsr(x,y,c)是RSR处理后的像素值,c表示颜色通道。
② 可视化强度变化:
  计算得到的强度变化可以为每个颜色通道单独可视化,以便于观察噪声的分布和强度变化的模式。
③ 应用低通滤波器:
  噪声主要存在于图像中,但强度变化在空间上的变化是缓慢的。其意味着可以应用低通滤波器来平滑这些变化,从而减少噪声,而不会对图像的整体强度变化产生太大影响。
  低通滤波器可以采用平均核(averaging kernel)来实现,该核可对局部像素的强度变化进行平均。
  主要以卷积操作完成,即:I’’(x,y,c)=I’(x,y,c)*K(x,y,c),其中,I’’(x,y,c)是滤波后的强度变化,K(x,y,c)是平均核。
④ 结合滤波前后的强度变化:
  为了进一步去除噪声,该算法结合了滤波前后的强度变化。主要通过将滤波后的强度变化与原始图像的强度变化相结合来实现的,从而得到最终的噪声减少后的强度变化。
⑤ 应用最终的强度变化:
  最后,将减少噪声后的强度变化应用回原始图像,以生成最终的输出图像。对于每个像素,其在给定通道上的强度可以被输出图像的像素Ioutput(x,y,c)所表示。即:Ioutput(x,y,c)= I(x,y,c)+ I’’(x,y,c)

2.2、亮度调整

  通过分析和处理图像中的局部照明变化来实现图像的亮度调整。
① 计算局部强度变化:
  与噪声去除的步骤类似,即计算每个像素在应用RSR算法后的强度变化,其不仅反映了颜色的变化,也反映了亮度的调整。
② 局部照明估计:
  通过观察像素周围区域的颜色和亮度变化,来实现对其局部照明变化的估计。其主要以随机喷雾的方式来完成,喷雾代表了像素邻域。
③亮度调整因子计算:
  通过分析局部强度变化,算法可以确定每个像素的亮度调整因子。这个因子是一个标量值,表示相对于原始图像的亮度变化量。

2.3、插值技术

  在维持图像质量的同时,采用插值技术减少算法的计算量。
① 确定采样模式:
  通过设置行列步长,确定对应的采样模式,其定义了哪些像素直接被计算强度变化,哪些像素将通过插值来估计其强度变化。
② 计算直接采样像素:
  对于直接采样的像素,按照之前的步骤计算强度变化,包括RSR算法及噪声去除的步骤。
③ 插值未采样像素:
  对于未直接采样的像素,算法使用插值方法来估计它们的强度变化。主要有最近邻域插值、双线性插值、二三次插值等。
④ 最近邻域插值:
  采用最近邻域插值以简单高效估计未采样像素的强度变化,对于每个未采样的像素,找到最近距离的已计算像素,并直接使用该像素的强度变化。

3、Light Random Sprays Retinex源码

/**
	Performs image enhancement using the Light Random Sprays Algorithm on a given image for specified parameters.

	@param[in]	source The image to be enhanced.
	@param[out]	destination The resulting image.
	@param[in]	N Number of sprays to create.
	@param[in]	n Size of individual spray in pixels.
	@param[in]	inputKernelSize The size of the kernel for blurring the original image and the RSR resulting image.
	@param[in]	inputSigma The input kernel sigma when using Gaussian kernels. If set to 0, the averaging kernel is used.
	@param[in]	intensityChangeKernelSize The size of the kernel for blurring the intensity change.
	@param[in]	intensityChangeSigma The intensity change kernel sigma when using Gaussian kernels. If set to 0, the averaging kernel is used.
	@param[in]	rowsStep Rows counting step.
	@param[in]	colsStep Columns counting step.
	@param[in]	normalizeIntensityChange The flag indicating wheather to normalize the intensity change (i. e. to perform only chromatic adaptation) or not (i. e. to perform chromatic adaptation and brightness adjustment).
	@param[in]	upperBound Maximal value for a pixel channel.
 */
void PerformLightRandomSpraysRetinex(cv::Mat source, cv::Mat& destination, int N, int n, int inputKernelSize, double inputSigma, int intensityChangeKernelSize, double intensityChangeSigma, int rowsStep, int colsStep, bool normalizeIntensityChange, double upperBound) {

	cv::Mat inputSource;
	cv::Mat inputRetinex;
	cv::Mat retinex;

	//执行RSR算法
	PerformRandomSpraysRetinex(source, retinex, N, n, upperBound, rowsStep, colsStep);

	//将源图像和经过RSR算法处理后的图像转换为CV_64FC3类型,即64位浮点型,3通道,用于后续计算强度变化。
	source.convertTo(inputSource, CV_64FC3);
	retinex.convertTo(inputRetinex, CV_64FC3);

	//强度归一化处理
	if (normalizeIntensityChange) {
		cv::Mat illuminant;
		cv::divide(inputSource, inputRetinex, illuminant);
		std::vector<cv::Mat> illuminantChannels;

		split(illuminant, illuminantChannels);
		cv::Mat illuminantAverage = (illuminantChannels[0] + illuminantChannels[1] + illuminantChannels[2]) / 3;
		for (int i = 0; i < 3; ++i) {
			cv::divide(illuminantChannels[i], illuminantAverage, illuminantChannels[i]);
		}
		cv::merge(illuminantChannels, illuminant);

		inputSource = inputRetinex.mul(illuminant);
	}

	//应用低通滤波器 平滑强度变化 减少噪声
	if (inputKernelSize > 1) {
		if (inputSigma == 0.0) {
			cv::Mat averaging = cv::Mat::ones(inputKernelSize, inputKernelSize, CV_64FC1) / (double)(inputKernelSize * inputKernelSize);
			Filter64F(inputSource, inputSource, inputKernelSize);
			Filter64F(inputRetinex, inputRetinex, inputKernelSize);
		}
		else {
			GaussianBlur(inputSource, inputSource, cv::Size(inputKernelSize, inputKernelSize), inputSigma);
			GaussianBlur(inputRetinex, inputRetinex, cv::Size(inputKernelSize, inputKernelSize), inputSigma);
		}
	}

	//光照强度变化平滑
	cv::Mat illuminant;
	divide(inputSource, inputRetinex, illuminant);
	std::vector<cv::Mat> illuminantChannels;

	if (intensityChangeKernelSize > 1) {
		if (intensityChangeSigma == 0.0) {
			cv::Mat averaging = cv::Mat::ones(intensityChangeKernelSize, intensityChangeKernelSize, CV_64FC1) / (double)(intensityChangeKernelSize * intensityChangeKernelSize);
			Filter64F(illuminant, illuminant, intensityChangeKernelSize);
		}
		else {
			GaussianBlur(illuminant, illuminant, cv::Size(intensityChangeKernelSize, intensityChangeKernelSize), intensityChangeSigma);
		}
	}

	//通道处理 目标图像
	std::vector<cv::Mat> destinationChannels;
	split(source, destinationChannels);
	split(illuminant, illuminantChannels);
	for (int i = 0; i < (int)destinationChannels.size(); ++i) {
		destinationChannels[i].convertTo(destinationChannels[i], CV_64FC1);
		cv::divide(destinationChannels[i], illuminantChannels[i], destinationChannels[i]);
	}

	cv::merge(destinationChannels, destination);

	double* check = (double*)destination.data;
	for (int i = 0; i < destination.rows * destination.cols * 3; ++i) {
		if (check[i] >= upperBound) {
			check[i] = upperBound - 1;
		}
	}

	destination.convertTo(destination, source.type());

}

4、Light Random Sprays Retinex效果及结论

  LRSR算法在图像质量和计算效率方面均优于原始的Random Sprays Retinex (RSR) 算法。通过引入新的噪声去除方法和亮度调整技术,LRSR算法能够在降低计算成本的同时提供更高质量的图像增强结果。

在这里插入图片描述

相关推荐

  1. 基于深度学习热红外图像增强算法

    2024-03-16 07:48:08       52 阅读
  2. 热红外图像增强算法

    2024-03-16 07:48:08       51 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-03-16 07:48:08       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-03-16 07:48:08       100 阅读
  3. 在Django里面运行非项目文件

    2024-03-16 07:48:08       82 阅读
  4. Python语言-面向对象

    2024-03-16 07:48:08       91 阅读

热门阅读

  1. android studio配置gradle

    2024-03-16 07:48:08       39 阅读
  2. 什么是深度学习?

    2024-03-16 07:48:08       40 阅读
  3. 【学习】目标检测中的anchor

    2024-03-16 07:48:08       38 阅读
  4. MacOS安装Homebrew详细教程以及案例

    2024-03-16 07:48:08       39 阅读
  5. 富格林:安全交易阻挠被骗攻略

    2024-03-16 07:48:08       45 阅读
  6. SQLZoo:SELECT from WORLD Tutorial/zh

    2024-03-16 07:48:08       38 阅读
  7. sui move动态字段练习(5)- 总结与思考

    2024-03-16 07:48:08       43 阅读
  8. centos9安装php8及以上

    2024-03-16 07:48:08       39 阅读
  9. oracle分区表和非分区表exchange

    2024-03-16 07:48:08       39 阅读
  10. 构建部署_docker-compose常用命令

    2024-03-16 07:48:08       40 阅读