首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >[C#]winform使用引导APSF和梯度自适应卷积增强夜间雾图像的可见性算法实现夜间雾霾图像的可见度增强

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

作者头像
云未归来
发布2025-07-20 14:17:26
发布2025-07-20 14:17:26
9000
代码可运行
举报
运行总次数:0
代码可运行

【算法介绍】

提升夜间雾霾图像可见度的技术研究:引导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

【效果展示】

【实现部分代码】

代码语言:javascript
代码运行次数:0
运行
复制
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

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2024-02-21,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档