[C#]winform使用引导APSF和梯度自适应卷积增强夜间雾图像的可见性算法实现夜间雾霾图像的可见度增强

【算法介绍】

提升夜间雾霾图像可见度的技术研究:引导APSF与梯度自适应卷积的应用

随着城市化的快速发展,雾霾现象日益严重,尤其是在夜间,雾霾对图像的可见度造成了极大的影响。因此,提升夜间雾霾图像的可见度成为了图像处理领域的研究热点。在ACM International Conference on Multimedia 2023(ACMMM2023)上,一篇题为“Enhancing Visibility in Nighttime Haze Images Using Guided APSF and Gradient Adaptive Convolution”的论文,为我们提供了一种全新的解决方案。

该论文提出了一种结合引导APSF(Adaptive Point Spread Function)和梯度自适应卷积的方法来增强夜间雾霾图像的可见度。引导APSF是一种能够模拟雾霾天气下光线散射现象的技术,它可以有效地估计和补偿图像中的雾霾效应。而梯度自适应卷积则能够根据图像的局部特征自适应地调整卷积核,从而更好地保留图像的细节和边缘信息。

通过结合这两种技术,该论文的方法能够在去除雾霾的同时,保留图像的细节和色彩信息,从而显著提高夜间雾霾图像的可见度。这一方法不仅在理论上具有创新性,而且在实验中也取得了显著的效果。实验结果表明,与传统的图像去雾方法相比,该方法在提升图像可见度、保留图像细节和色彩信息等方面都具有明显的优势。

总之,该论文的研究为我们提供了一种新的思路和方法来增强夜间雾霾图像的可见度。这一方法不仅具有重要的理论价值,而且在实际应用中也有着广阔的前景。随着技术的不断进步和应用场景的不断拓展,相信这一方法将在未来的图像处理领域中发挥更加重要的作用。

【框架地址】 

https://github.com/jinyeying/nighttime_dehaze

【效果展示】

【实现部分代码】 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using OpenCvSharp;

namespace FIRC
{

    public partial class Form1 : Form
    {
        Mat src = null;
        NighttimeNet detector = new NighttimeNet();

        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            openFileDialog.Filter = "图文件(*.*)|*.jpg;*.png;*.jpeg;*.bmp";
            openFileDialog.RestoreDirectory = true;
            openFileDialog.Multiselect = false;
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
              
                src = Cv2.ImRead(openFileDialog.FileName);
                pictureBox1.Image = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(src);


            }


        }

        private void button2_Click(object sender, EventArgs e)
        {
            if(pictureBox1.Image==null)
            {
                return;
            }
            var result = detector.Inference(src);
            pictureBox2.Image = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(result);
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            detector.LoadWeights(Application.StartupPath+ "\\weights\\nighttime_dehaze_realnight_1x3x512x512.onnx", 512,512);
        }

        private void button3_Click(object sender, EventArgs e)
        {
            VideoCapture capture = new VideoCapture(0);
            if (!capture.IsOpened())
            {
                Console.WriteLine("video not open!");
                return;
            }
            Mat frame = new Mat();
            var sw = new Stopwatch();
            int fps = 0;
            while (true)
            {

                capture.Read(frame);
                if (frame.Empty())
                {
                    Console.WriteLine("data is empty!");
                    break;
                }
                sw.Start();
                var result = detector.Inference(frame);
                sw.Stop();
                fps = Convert.ToInt32(1 / sw.Elapsed.TotalSeconds);
                sw.Reset();
                Cv2.PutText(result, "FPS=" + fps, new OpenCvSharp.Point(30, 30), HersheyFonts.HersheyComplex, 1.0, new Scalar(255, 0, 0), 3);
                //显示结果
                Cv2.ImShow("Result", result);
                int key = Cv2.WaitKey(10);
                if (key == 27)
                    break;
            }

            capture.Release();
        }
    }
}

【视频演示】

https://www.bilibili.com/video/BV1B6421M78e/?vd_source=989ae2b903ea1b5acebbe2c4c4a635ee

【源码下载】

https://download.csdn.net/download/FL1623863129/88860837

【测试环境】

vs2019,netframework4.7.2,opencvsharp4.8.0,onnxruntime1.16

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

FL1623863129

你的打赏是我写文章最大的动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值