C# OpenCvSharp 部署文档矫正,包括文档扭曲/模糊/阴影等情况

news2025/4/8 18:14:32

目录

说明

效果

模型

项目

代码

下载

参考


C# OpenCvSharp 部署文档矫正,包括文档扭曲/模糊/阴影等情况

说明

地址:https://github.com/RapidAI/RapidUnDistort

修正文档扭曲/模糊/阴影等情况,使用onnx模型简单轻量部署,未来持续跟进最新最好的文档矫正方案和模型,Correct document distortion using a lightweight ONNX model for easy deployment. We will continue to follow and integrate the latest and best document correction solutions and models in the future. 

效果

模型

drnet.onnx

Model Properties
-------------------------
---------------------------------------------------------------

Inputs
-------------------------
name:input
tensor:Float[-1, 6, -1, -1]
---------------------------------------------------------------

Outputs
-------------------------
name:output
tensor:Float[-1, 3, -1, -1]
---------------------------------------------------------------

gcnet.onnx

Model Properties
-------------------------
---------------------------------------------------------------

Inputs
-------------------------
name:input
tensor:Float[-1, 3, -1, -1]
---------------------------------------------------------------

Outputs
-------------------------
name:output
tensor:Float[-1, 3, -1, -1]
---------------------------------------------------------------

nafdpm.onnx

Model Properties
-------------------------
---------------------------------------------------------------

Inputs
-------------------------
name:input
tensor:Float[-1, 3, -1, -1]
---------------------------------------------------------------

Outputs
-------------------------
name:output
tensor:Float[-1, -1, -1, -1]
---------------------------------------------------------------

unetcnn.onnx

Model Properties
-------------------------
---------------------------------------------------------------

Inputs
-------------------------
name:input
tensor:Float[-1, 3, -1, -1]
---------------------------------------------------------------

Outputs
-------------------------
name:output
tensor:Float[-1, 1, -1, -1]
---------------------------------------------------------------

uvdoc.onnx

Model Properties
-------------------------
---------------------------------------------------------------

Inputs
-------------------------
name:input
tensor:Float[-1, 3, -1, -1]
---------------------------------------------------------------

Outputs
-------------------------
name:output
tensor:Float[-1, 2, -1, -1]
name:546
tensor:Float[-1, 3, -1, -1]
---------------------------------------------------------------

项目

代码

using OpenCvSharp;
using System;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;

namespace DocumentUndistort
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        Stopwatch stopwatch = new Stopwatch();
        Mat image;
        Mat out_img;
        string image_path;
        string startupPath;
        string fileFilter = "*.*|*.bmp;*.jpg;*.jpeg;*.tiff;*.tiff;*.png";
        const string DllName = "DocumentUndistortSharp.dll";
        IntPtr engine;

        /*
         //初始化
        extern "C" _declspec(dllexport) int __cdecl  init(void** engine, char* binary_model_path, char* unblur_model_path, char* unshadow_model_gcnet_path, char* unshadow_model_drnet_path, char* unwrap_model_path, char* msg);

        //binary
        extern "C" _declspec(dllexport) int __cdecl  binary(void* engine, Mat* srcimg, char* msg, Mat* out_img);

        //unblur
        extern "C" _declspec(dllexport) int __cdecl  unblur(void* engine, Mat* srcimg, char* msg, Mat* out_img);

        //unshadow
        extern "C" _declspec(dllexport) int __cdecl  unshadow(void* engine, Mat* srcimg, char* msg, Mat* out_img);

        //unwrap
        extern "C" _declspec(dllexport) int __cdecl  unwrap(void* engine, Mat* srcimg, char* msg, Mat* out_img);

        //openCvBilateral
        extern "C" _declspec(dllexport) int __cdecl  openCvBilateral(Mat* srcimg, char* msg, Mat* out_img);

        //释放
        extern "C" _declspec(dllexport) void __cdecl destroy(void* engine);
         */


        [DllImport(DllName, EntryPoint = "init", CallingConvention = CallingConvention.Cdecl)]
        internal extern static int init(ref IntPtr engine, string binary_model_path, string unblur_model_path, string unshadow_model_gcnet_path, string unshadow_model_drnet_path, string unwrap_model_path, StringBuilder msg);

        [DllImport(DllName, EntryPoint = "binary", CallingConvention = CallingConvention.Cdecl)]
        internal extern static int binary(IntPtr engine, IntPtr srcimg, StringBuilder msg, IntPtr out_img);

        [DllImport(DllName, EntryPoint = "unblur", CallingConvention = CallingConvention.Cdecl)]
        internal extern static int unblur(IntPtr engine, IntPtr srcimg, StringBuilder msg, IntPtr out_img);

        [DllImport(DllName, EntryPoint = "unshadow", CallingConvention = CallingConvention.Cdecl)]
        internal extern static int unshadow(IntPtr engine, IntPtr srcimg, StringBuilder msg, IntPtr out_img);

        [DllImport(DllName, EntryPoint = "unwrap", CallingConvention = CallingConvention.Cdecl)]
        internal extern static int unwrap(IntPtr engine, IntPtr srcimg, StringBuilder msg, IntPtr out_img);

        [DllImport(DllName, EntryPoint = "openCvBilateral", CallingConvention = CallingConvention.Cdecl)]
        internal extern static int openCvBilateral(IntPtr srcimg, StringBuilder msg, IntPtr out_img);

        [DllImport(DllName, EntryPoint = "destroy", CallingConvention = CallingConvention.Cdecl)]
        internal extern static int destroy(IntPtr engine);

        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Filter = fileFilter;
            if (ofd.ShowDialog() != DialogResult.OK) return;

            pictureBox1.Image = null;
            pictureBox2.Image = null;
            textBox1.Text = "";

            image_path = ofd.FileName;
            pictureBox1.Image = new Bitmap(image_path);
            image = new Mat(image_path);
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            startupPath = Application.StartupPath;

            string binary_model_path = startupPath + "\\model\\unetcnn.onnx";
            string unblur_model_path = startupPath + "\\model\\nafdpm.onnx";
            string unshadow_model_gcnet_path = startupPath + "\\model\\gcnet.onnx";
            string unshadow_model_drnet_path = startupPath + "\\model\\drnet.onnx";
            string unwrap_model_path = startupPath + "\\model\\uvdoc.onnx";

            StringBuilder msg = new StringBuilder(512);

            int res = init(ref engine, binary_model_path, unblur_model_path, unshadow_model_gcnet_path, unshadow_model_drnet_path, unwrap_model_path, msg);
            if (res == -1)
            {
                MessageBox.Show(msg.ToString());
                return;
            }
            else
            {
                Console.WriteLine(msg.ToString());
            }
            image_path = startupPath + "\\test_img\\2.jpg";
            pictureBox1.Image = new Bitmap(image_path);
            image = new Mat(image_path);
        }

        private void Form1_FormClosed(object sender, FormClosedEventArgs e)
        {
            destroy(engine);
        }

        /// <summary>
        /// unwrap
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button2_Click(object sender, EventArgs e)
        {
            if (image_path == "")
            {
                return;
            }

            textBox1.Text = "执行中……";
            Application.DoEvents();

            if (image != null) image.Dispose();
            if (out_img != null) out_img.Dispose();
            if (pictureBox1.Image != null) pictureBox1.Image.Dispose();

            StringBuilder msg = new StringBuilder(512);
            image = new Mat(image_path);
            out_img = new Mat();

            stopwatch.Restart();

            int res = unwrap(engine, image.CvPtr, msg, out_img.CvPtr);
            if (res == 0)
            {
                stopwatch.Stop();
                double costTime = stopwatch.Elapsed.TotalMilliseconds;
                pictureBox2.Image = new Bitmap(out_img.ToMemoryStream());
                textBox1.Text = $"耗时:{costTime:F2}ms";
            }
            else
            {
                textBox1.Text = "失败," + msg.ToString();
            }
        }

        /// <summary>
        /// openCvBilateral
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button7_Click(object sender, EventArgs e)
        {
            if (image_path == "")
            {
                return;
            }

            textBox1.Text = "执行中……";
            Application.DoEvents();

            if (image != null) image.Dispose();
            if (out_img != null) out_img.Dispose();
            if (pictureBox1.Image != null) pictureBox1.Image.Dispose();

            StringBuilder msg = new StringBuilder(512);
            image = new Mat(image_path);
            out_img = new Mat();

            stopwatch.Restart();

            int res = openCvBilateral(image.CvPtr, msg, out_img.CvPtr);
            if (res == 0)
            {
                stopwatch.Stop();
                double costTime = stopwatch.Elapsed.TotalMilliseconds;
                pictureBox2.Image = new Bitmap(out_img.ToMemoryStream());
                textBox1.Text = $"耗时:{costTime:F2}ms";
            }
            else
            {
                textBox1.Text = "失败," + msg.ToString();
            }
        }

        /// <summary>
        /// unshadow
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button6_Click(object sender, EventArgs e)
        {
            if (image_path == "")
            {
                return;
            }

            textBox1.Text = "执行中……";
            Application.DoEvents();

            if (image != null) image.Dispose();
            if (out_img != null) out_img.Dispose();
            if (pictureBox1.Image != null) pictureBox1.Image.Dispose();

            StringBuilder msg = new StringBuilder(512);
            image = new Mat(image_path);
            out_img = new Mat();

            stopwatch.Restart();

            int res = unshadow(engine, image.CvPtr, msg, out_img.CvPtr);
            if (res == 0)
            {
                stopwatch.Stop();
                double costTime = stopwatch.Elapsed.TotalMilliseconds;
                pictureBox2.Image = new Bitmap(out_img.ToMemoryStream());
                textBox1.Text = $"耗时:{costTime:F2}ms";
            }
            else
            {
                textBox1.Text = "失败," + msg.ToString();
            }
        }

        /// <summary>
        /// unblur
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button5_Click(object sender, EventArgs e)
        {
            if (image_path == "")
            {
                return;
            }

            textBox1.Text = "执行中……";
            Application.DoEvents();

            if (image != null) image.Dispose();
            if (out_img != null) out_img.Dispose();
            if (pictureBox1.Image != null) pictureBox1.Image.Dispose();

            StringBuilder msg = new StringBuilder(512);
            image = new Mat(image_path);
            out_img = new Mat();

            stopwatch.Restart();

            int res = unblur(engine, image.CvPtr, msg, out_img.CvPtr);
            if (res == 0)
            {
                stopwatch.Stop();
                double costTime = stopwatch.Elapsed.TotalMilliseconds;
                pictureBox2.Image = new Bitmap(out_img.ToMemoryStream());
                textBox1.Text = $"耗时:{costTime:F2}ms";
            }
            else
            {
                textBox1.Text = "失败," + msg.ToString();
            }
        }

        /// <summary>
        /// binary
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button4_Click(object sender, EventArgs e)
        {
            if (image_path == "")
            {
                return;
            }

            textBox1.Text = "执行中……";
            Application.DoEvents();

            if (image != null) image.Dispose();
            if (out_img != null) out_img.Dispose();
            if (pictureBox1.Image != null) pictureBox1.Image.Dispose();

            StringBuilder msg = new StringBuilder(512);
            image = new Mat(image_path);
            out_img = new Mat();

            stopwatch.Restart();

            int res = binary(engine, image.CvPtr, msg, out_img.CvPtr);
            if (res == 0)
            {
                stopwatch.Stop();
                double costTime = stopwatch.Elapsed.TotalMilliseconds;
                pictureBox2.Image = new Bitmap(out_img.ToMemoryStream());
                textBox1.Text = $"耗时:{costTime:F2}ms";
            }
            else
            {
                textBox1.Text = "失败," + msg.ToString();
            }
        }

        private void button3_Click(object sender, EventArgs e)
        {
            if (pictureBox2.Image == null)
            {
                return;
            }
            Bitmap output = new Bitmap(pictureBox2.Image);
            var sdf = new SaveFileDialog();
            sdf.Title = "保存";
            sdf.Filter = "Images (*.jpg)|*.jpg|Images (*.png)|*.png|Images (*.bmp)|*.bmp";
            if (sdf.ShowDialog() == DialogResult.OK)
            {
                switch (sdf.FilterIndex)
                {
                    case 1:
                        {
                            output.Save(sdf.FileName, ImageFormat.Jpeg);
                            break;
                        }
                    case 2:
                        {
                            output.Save(sdf.FileName, ImageFormat.Png);
                            break;
                        }
                    case 3:
                        {
                            output.Save(sdf.FileName, ImageFormat.Bmp);
                            break;
                        }
                }
                MessageBox.Show("保存成功,位置:" + sdf.FileName);
            }
        }
    }
}
 

using OpenCvSharp;
using System;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms;

namespace DocumentUndistort
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        Stopwatch stopwatch = new Stopwatch();
        Mat image;
        Mat out_img;
        string image_path;
        string startupPath;
        string fileFilter = "*.*|*.bmp;*.jpg;*.jpeg;*.tiff;*.tiff;*.png";
        const string DllName = "DocumentUndistortSharp.dll";
        IntPtr engine;

        /*
         //初始化
        extern "C" _declspec(dllexport) int __cdecl  init(void** engine, char* binary_model_path, char* unblur_model_path, char* unshadow_model_gcnet_path, char* unshadow_model_drnet_path, char* unwrap_model_path, char* msg);

        //binary
        extern "C" _declspec(dllexport) int __cdecl  binary(void* engine, Mat* srcimg, char* msg, Mat* out_img);

        //unblur
        extern "C" _declspec(dllexport) int __cdecl  unblur(void* engine, Mat* srcimg, char* msg, Mat* out_img);

        //unshadow
        extern "C" _declspec(dllexport) int __cdecl  unshadow(void* engine, Mat* srcimg, char* msg, Mat* out_img);

        //unwrap
        extern "C" _declspec(dllexport) int __cdecl  unwrap(void* engine, Mat* srcimg, char* msg, Mat* out_img);

        //openCvBilateral
        extern "C" _declspec(dllexport) int __cdecl  openCvBilateral(Mat* srcimg, char* msg, Mat* out_img);

        //释放
        extern "C" _declspec(dllexport) void __cdecl destroy(void* engine);
         */


        [DllImport(DllName, EntryPoint = "init", CallingConvention = CallingConvention.Cdecl)]
        internal extern static int init(ref IntPtr engine, string binary_model_path, string unblur_model_path, string unshadow_model_gcnet_path, string unshadow_model_drnet_path, string unwrap_model_path, StringBuilder msg);

        [DllImport(DllName, EntryPoint = "binary", CallingConvention = CallingConvention.Cdecl)]
        internal extern static int binary(IntPtr engine, IntPtr srcimg, StringBuilder msg, IntPtr out_img);

        [DllImport(DllName, EntryPoint = "unblur", CallingConvention = CallingConvention.Cdecl)]
        internal extern static int unblur(IntPtr engine, IntPtr srcimg, StringBuilder msg, IntPtr out_img);

        [DllImport(DllName, EntryPoint = "unshadow", CallingConvention = CallingConvention.Cdecl)]
        internal extern static int unshadow(IntPtr engine, IntPtr srcimg, StringBuilder msg, IntPtr out_img);

        [DllImport(DllName, EntryPoint = "unwrap", CallingConvention = CallingConvention.Cdecl)]
        internal extern static int unwrap(IntPtr engine, IntPtr srcimg, StringBuilder msg, IntPtr out_img);

        [DllImport(DllName, EntryPoint = "openCvBilateral", CallingConvention = CallingConvention.Cdecl)]
        internal extern static int openCvBilateral(IntPtr srcimg, StringBuilder msg, IntPtr out_img);

        [DllImport(DllName, EntryPoint = "destroy", CallingConvention = CallingConvention.Cdecl)]
        internal extern static int destroy(IntPtr engine);

        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Filter = fileFilter;
            if (ofd.ShowDialog() != DialogResult.OK) return;

            pictureBox1.Image = null;
            pictureBox2.Image = null;
            textBox1.Text = "";

            image_path = ofd.FileName;
            pictureBox1.Image = new Bitmap(image_path);
            image = new Mat(image_path);
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            startupPath = Application.StartupPath;

            string binary_model_path = startupPath + "\\model\\unetcnn.onnx";
            string unblur_model_path = startupPath + "\\model\\nafdpm.onnx";
            string unshadow_model_gcnet_path = startupPath + "\\model\\gcnet.onnx";
            string unshadow_model_drnet_path = startupPath + "\\model\\drnet.onnx";
            string unwrap_model_path = startupPath + "\\model\\uvdoc.onnx";

            StringBuilder msg = new StringBuilder(512);

            int res = init(ref engine, binary_model_path, unblur_model_path, unshadow_model_gcnet_path, unshadow_model_drnet_path, unwrap_model_path, msg);
            if (res == -1)
            {
                MessageBox.Show(msg.ToString());
                return;
            }
            else
            {
                Console.WriteLine(msg.ToString());
            }
            image_path = startupPath + "\\test_img\\2.jpg";
            pictureBox1.Image = new Bitmap(image_path);
            image = new Mat(image_path);
        }

        private void Form1_FormClosed(object sender, FormClosedEventArgs e)
        {
            destroy(engine);
        }

        /// <summary>
        /// unwrap
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button2_Click(object sender, EventArgs e)
        {
            if (image_path == "")
            {
                return;
            }

            textBox1.Text = "执行中……";
            Application.DoEvents();

            if (image != null) image.Dispose();
            if (out_img != null) out_img.Dispose();
            if (pictureBox1.Image != null) pictureBox1.Image.Dispose();

            StringBuilder msg = new StringBuilder(512);
            image = new Mat(image_path);
            out_img = new Mat();

            stopwatch.Restart();

            int res = unwrap(engine, image.CvPtr, msg, out_img.CvPtr);
            if (res == 0)
            {
                stopwatch.Stop();
                double costTime = stopwatch.Elapsed.TotalMilliseconds;
                pictureBox2.Image = new Bitmap(out_img.ToMemoryStream());
                textBox1.Text = $"耗时:{costTime:F2}ms";
            }
            else
            {
                textBox1.Text = "失败," + msg.ToString();
            }
        }

        /// <summary>
        /// openCvBilateral
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button7_Click(object sender, EventArgs e)
        {
            if (image_path == "")
            {
                return;
            }

            textBox1.Text = "执行中……";
            Application.DoEvents();

            if (image != null) image.Dispose();
            if (out_img != null) out_img.Dispose();
            if (pictureBox1.Image != null) pictureBox1.Image.Dispose();

            StringBuilder msg = new StringBuilder(512);
            image = new Mat(image_path);
            out_img = new Mat();

            stopwatch.Restart();

            int res = openCvBilateral(image.CvPtr, msg, out_img.CvPtr);
            if (res == 0)
            {
                stopwatch.Stop();
                double costTime = stopwatch.Elapsed.TotalMilliseconds;
                pictureBox2.Image = new Bitmap(out_img.ToMemoryStream());
                textBox1.Text = $"耗时:{costTime:F2}ms";
            }
            else
            {
                textBox1.Text = "失败," + msg.ToString();
            }
        }

        /// <summary>
        /// unshadow
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button6_Click(object sender, EventArgs e)
        {
            if (image_path == "")
            {
                return;
            }

            textBox1.Text = "执行中……";
            Application.DoEvents();

            if (image != null) image.Dispose();
            if (out_img != null) out_img.Dispose();
            if (pictureBox1.Image != null) pictureBox1.Image.Dispose();

            StringBuilder msg = new StringBuilder(512);
            image = new Mat(image_path);
            out_img = new Mat();

            stopwatch.Restart();

            int res = unshadow(engine, image.CvPtr, msg, out_img.CvPtr);
            if (res == 0)
            {
                stopwatch.Stop();
                double costTime = stopwatch.Elapsed.TotalMilliseconds;
                pictureBox2.Image = new Bitmap(out_img.ToMemoryStream());
                textBox1.Text = $"耗时:{costTime:F2}ms";
            }
            else
            {
                textBox1.Text = "失败," + msg.ToString();
            }
        }

        /// <summary>
        /// unblur
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button5_Click(object sender, EventArgs e)
        {
            if (image_path == "")
            {
                return;
            }

            textBox1.Text = "执行中……";
            Application.DoEvents();

            if (image != null) image.Dispose();
            if (out_img != null) out_img.Dispose();
            if (pictureBox1.Image != null) pictureBox1.Image.Dispose();

            StringBuilder msg = new StringBuilder(512);
            image = new Mat(image_path);
            out_img = new Mat();

            stopwatch.Restart();

            int res = unblur(engine, image.CvPtr, msg, out_img.CvPtr);
            if (res == 0)
            {
                stopwatch.Stop();
                double costTime = stopwatch.Elapsed.TotalMilliseconds;
                pictureBox2.Image = new Bitmap(out_img.ToMemoryStream());
                textBox1.Text = $"耗时:{costTime:F2}ms";
            }
            else
            {
                textBox1.Text = "失败," + msg.ToString();
            }
        }

        /// <summary>
        /// binary
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button4_Click(object sender, EventArgs e)
        {
            if (image_path == "")
            {
                return;
            }

            textBox1.Text = "执行中……";
            Application.DoEvents();

            if (image != null) image.Dispose();
            if (out_img != null) out_img.Dispose();
            if (pictureBox1.Image != null) pictureBox1.Image.Dispose();

            StringBuilder msg = new StringBuilder(512);
            image = new Mat(image_path);
            out_img = new Mat();

            stopwatch.Restart();

            int res = binary(engine, image.CvPtr, msg, out_img.CvPtr);
            if (res == 0)
            {
                stopwatch.Stop();
                double costTime = stopwatch.Elapsed.TotalMilliseconds;
                pictureBox2.Image = new Bitmap(out_img.ToMemoryStream());
                textBox1.Text = $"耗时:{costTime:F2}ms";
            }
            else
            {
                textBox1.Text = "失败," + msg.ToString();
            }
        }

        private void button3_Click(object sender, EventArgs e)
        {
            if (pictureBox2.Image == null)
            {
                return;
            }
            Bitmap output = new Bitmap(pictureBox2.Image);
            var sdf = new SaveFileDialog();
            sdf.Title = "保存";
            sdf.Filter = "Images (*.jpg)|*.jpg|Images (*.png)|*.png|Images (*.bmp)|*.bmp";
            if (sdf.ShowDialog() == DialogResult.OK)
            {
                switch (sdf.FilterIndex)
                {
                    case 1:
                        {
                            output.Save(sdf.FileName, ImageFormat.Jpeg);
                            break;
                        }
                    case 2:
                        {
                            output.Save(sdf.FileName, ImageFormat.Png);
                            break;
                        }
                    case 3:
                        {
                            output.Save(sdf.FileName, ImageFormat.Bmp);
                            break;
                        }
                }
                MessageBox.Show("保存成功,位置:" + sdf.FileName);
            }
        }
    }
}

下载

源码下载

参考

https://github.com/hpc203/document-undistort-onnxrun

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2281054.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

贪心算法(题1)区间选点

输出 2 #include <iostream> #include<algorithm>using namespace std;const int N 100010 ;int n; struct Range {int l,r;bool operator <(const Range &W)const{return r<W.r;} }range[N];int main() {scanf("%d",&n);for(int i0;i&l…

煤矿场景下安全帽检测数据集VOC+YOLO格式179张2类别

数据集格式&#xff1a;Pascal VOC格式YOLO格式(不包含分割路径的txt文件&#xff0c;仅仅包含jpg图片以及对应的VOC格式xml文件和yolo格式txt文件) 图片数量(jpg文件个数)&#xff1a;170 标注数量(xml文件个数)&#xff1a;170 标注数量(txt文件个数)&#xff1a;170 标注…

RTX 5090原型据称有24576个CUDA核心和800 W TDP -两个16针连接器

英伟达今年早些时候发布、将于1月30日上市的GeForce RTX 5090&#xff0c;有望成为最出色的显卡之一。然而&#xff0c;硬件侦探HXL发掘出了一款疑似早期原型产品。不过&#xff0c;考虑到传闻中的规格参数&#xff0c;它很有可能会成为GeForce RTX 5090 Ti或者RTX Titan Black…

哪个控制面板适合您?

如今&#xff0c;VPS云主机的控制面板在网站托管中变得越来越重要。对于网站管理者和普通用户来说&#xff0c;这类控制面板提供了一站式的管理工具&#xff0c;可以在同一个界面中处理所有网站的管理任务&#xff0c;极大地减少了多系统间重复操作的麻烦。 但随着越来越多的公…

Redis - 通用命令

目录 了解Redis客户端set 和 getRedis全局命令keys命令exists命令del命令expire命令ttl命令Redis中key的过期策略type 了解Redis客户端 想要输入Redis命令,必须先进入Redis客户端 使用redis-cli连接本机的命令行客户端 redis-cli如果想连接其他的ip和端口的客户端&#xff0…

重学SpringBoot3-WebClient配置与使用详解

更多SpringBoot3内容请关注我的专栏&#xff1a;《SpringBoot3》 期待您的点赞??收藏评论 重学SpringBoot3-WebClient配置与使用详解 1. 简介2. 环境准备 2.1 依赖配置 3. WebClient配置 3.1 基础配置3.2 高级配置3.3 retrieve()和exchange()区别 4. 使用示例 4.1 基本请求操…

HTML5 新表单属性详解

HTML5 为 <form> 和 <input> 标签引入了一系列新属性&#xff0c;极大地增强了表单的功能和用户体验。这些新属性不仅简化了开发者的工作&#xff0c;还为用户提供了更友好、更高效的交互方式。本文将详细介绍这些新属性&#xff0c;并结合代码示例帮助大家更好地理…

【专题】为2025制定可付诸实践的IT战略规划报告汇总PDF洞察(附原数据表)

原文链接&#xff1a;https://tecdat.cn/?p39055 在当今瞬息万变的商业环境中&#xff0c;制定有效的 IT 战略规划对于企业的成功与可持续发展至关重要。本报告深入探讨了制定 IT 战略规划的关键活动&#xff0c;旨在为企业和决策者提供全面且实用的指导。 Gartner的《为202…

JAVA实战开源项目:课程作业管理系统(Vue+SpringBoot) 附源码

本文项目编号 T 023 &#xff0c;文末自助获取源码 \color{red}{T023&#xff0c;文末自助获取源码} T023&#xff0c;文末自助获取源码 目录 一、系统介绍二、演示录屏三、启动教程四、功能截图五、文案资料5.1 选题背景5.2 国内外研究现状5.3 可行性分析 六、核心代码6.1 查…

代码随想录算法训练营day32

代码随想录算法训练营 —day32 文章目录 代码随想录算法训练营前言一、动态规划理论基础二、509. 斐波那契数动态规划动态规划优化空间版递归法 三、70. 爬楼梯动态规划动态规划空间优化 746. 使用最小花费爬楼梯动态规划空间优化 总结 前言 今天是算法营的第32天&#xff0c…

设计模式的艺术-开闭原则

原则使用频率图&#xff08;仅供参考&#xff09; 1.如何理解开闭原则 简单来说&#xff0c;开闭原则指的是 “对扩展开放&#xff0c;对修改关闭”。 当软件系统需要增加新的功能时&#xff0c;应该通过扩展现有代码的方式来实现&#xff0c;而不是去修改已有的代码。 例如我…

grafana新增email告警

选择一个面板 比如cpu 新增一个临界点表达式 input选A 就是A的值达到某个临界点 触发告警 我这边IS ABOVE0.15就是cpu大于0.15%就触发报警&#xff0c;这个值怎么填看指标的值显示 这里要设置一下报警条件 这边随便配置下 配置标签和通知&#xff0c;选择你的邮件 看下告警…

C++17 新特性深入解析:constexpr 扩展、if constexpr 和 constexpr lambda

C17 不仅增强了现有特性&#xff0c;还引入了一些全新的编程工具&#xff0c;极大地提升了代码的效率和表达力。在这篇文章中&#xff0c;我们将深入探讨 C17 中与 constexpr 相关的三个重要特性&#xff1a;constexpr 的扩展用法、if constexpr 和 constexpr lambda。这些特性…

ChatGPT 摘要,以 ESS 作为你的私有数据存储

作者&#xff1a;来自 Elastic Ryan_Earle 本教程介绍如何设置 Elasticsearch 网络爬虫&#xff0c;将网站索引到 Elasticsearch 中&#xff0c;然后利用 ChatGPT 使用我们的私人数据来总结对其提出的问题。 Python 脚本的 Github Repo&#xff1a;https://github.com/Gunner…

算法刷题笔记——图论篇

这里写目录标题 理论基础图的基本概念图的种类度 连通性连通图强连通图连通分量强连通分量 图的构造邻接矩阵邻接表 图的遍历方式 深度优先搜索理论基础dfs 与 bfs 区别dfs 搜索过程深搜三部曲所有可达路径广度优先搜索理论基础广搜的使用场景广搜的过程 岛屿数量孤岛的总面积沉…

神经网络:什么是交叉熵?

在机器学习和深度学习中&#xff0c;交叉熵&#xff08;Cross Entropy&#xff09; 是一种常见的损失函数&#xff0c;特别适用于分类问题。尽管这个术语听起来可能有点复杂&#xff0c;但通过一个类比&#xff0c;我们可以更直观地理解它的含义和作用。 类比场景&#xff1a;…

数据结构——队列和栈(介绍、类型、Java手搓实现循环队列)

我是一个计算机专业研0的学生卡蒙Camel&#x1f42b;&#x1f42b;&#x1f42b;&#xff08;刚保研&#xff09; 记录每天学习过程&#xff08;主要学习Java、python、人工智能&#xff09;&#xff0c;总结知识点&#xff08;内容来自&#xff1a;自我总结网上借鉴&#xff0…

[Spring] OpenFeign的使用

&#x1f338;个人主页:https://blog.csdn.net/2301_80050796?spm1000.2115.3001.5343 &#x1f3f5;️热门专栏: &#x1f9ca; Java基本语法(97平均质量分)https://blog.csdn.net/2301_80050796/category_12615970.html?spm1001.2014.3001.5482 &#x1f355; Collection与…

LangChain + llamaFactory + Qwen2-7b-VL 构建本地RAG问答系统

单纯仅靠LLM会产生误导性的 “幻觉”&#xff0c;训练数据会过时&#xff0c;处理特定知识时效率不高&#xff0c;缺乏专业领域的深度洞察&#xff0c;同时在推理能力上也有所欠缺。 正是在这样的背景下&#xff0c;检索增强生成技术&#xff08;Retrieval-Augmented Generati…

SpringCloud Gateway 集成 Sentinel 详解 及实现动态监听Nacos规则配置实时更新流控规则

目录 一、前言二、版本选择和适配2.1、本文使用各组件版本2.2、官方推荐版本 三、部署sentinel-dashboard3.1、下载 sentinel-dashboard jar包3.2、启动 sentinel-dashboard 四、Gateway 集成 Sentinel实现控制台配置流控规则测试4.1、添加Gateway 集成 Sentinel 包4.2、添加 G…