C# OpenCvSharp 部署文档矫正,包括文档扭曲/模糊/阴影等情况
目录
说明
效果
模型
项目
代码
下载
参考
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);//binaryextern "C" _declspec(dllexport) int __cdecl binary(void* engine, Mat* srcimg, char* msg, Mat* out_img);//unblurextern "C" _declspec(dllexport) int __cdecl unblur(void* engine, Mat* srcimg, char* msg, Mat* out_img);//unshadowextern "C" _declspec(dllexport) int __cdecl unshadow(void* engine, Mat* srcimg, char* msg, Mat* out_img);//unwrapextern "C" _declspec(dllexport) int __cdecl unwrap(void* engine, Mat* srcimg, char* msg, Mat* out_img);//openCvBilateralextern "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
相关文章:

C# OpenCvSharp 部署文档矫正,包括文档扭曲/模糊/阴影等情况
目录 说明 效果 模型 项目 代码 下载 参考 C# OpenCvSharp 部署文档矫正,包括文档扭曲/模糊/阴影等情况 说明 地址:https://github.com/RapidAI/RapidUnDistort 修正文档扭曲/模糊/阴影等情况,使用onnx模型简单轻量部署,…...

go读取excel游戏配置
1.背景 游戏服务器,配置数据一般采用csv/excel来作为载体,这种方式,策划同学配置方便,服务器解析也方便。在jforgame框架里,我们使用以下的excel配置格式。 然后可以非常方便的进行数据检索,例如ÿ…...
特殊类设计
[本节目标] 掌握常见特殊类的设计方式 1.请设计一个类,不能被拷贝 拷贝只会放生在两个场景中:拷贝构造函数以及赋值运算符重载,因此想要让一个类禁止拷贝,只需让该类不能调用拷贝构造函数以及赋值运算符重载即可。 C98 将拷贝构…...

图像去雾数据集的下载和预处理操作
前言 目前,因为要做对比实验,收集了一下去雾数据集,并且建立了一个数据集的预处理工程。 这是以前我写的一个小仓库,我决定还是把它用起来,下面将展示下载的路径和数据处理的方法。 下面的代码均可以在此找到。Auo…...

【LeetCode】--- MySQL刷题集合
1.组合两个表(外连接) select p.firstName,p.lastName,a.city,a.state from Person p left join Address a on p.personId a.personId; 以左边表为基准,去连接右边的表。取两表的交集和左表的全集 2.第二高的薪水 (子查询、if…...

基于Python的多元医疗知识图谱构建与应用研究(上)
一、引言 1.1 研究背景与意义 在当今数智化时代,医疗数据呈爆发式增长,如何高效管理和利用这些数据,成为提升医疗服务质量的关键。传统医疗数据管理方式存在数据孤岛、信息整合困难等问题,难以满足现代医疗对精准诊断和个性化治疗的需求。知识图谱作为一种知识表示和管理…...
小哆啦解题记:如何计算除自身以外数组的乘积
小哆啦开始力扣每日一题的第十二天 https://leetcode.cn/problems/product-of-array-except-self/description/ 《小哆啦解题记:如何计算除自身以外数组的乘积》 在一个清晨的阳光下,小哆啦坐在书桌前,思索着一道困扰已久的题目:…...
渐进式图片的实现原理
渐进式图片(Progressive JPEG)的实现原理与传统的基线 JPEG(Baseline JPEG)不同。它通过改变图片的编码和加载方式,使得图片在加载时能够逐步显示从模糊到清晰的图像。 1. 传统基线 JPEG 的加载方式 在传统的基线 JP…...
SQL刷题快速入门(三)
其他章节: SQL刷题快速入门(一) SQL刷题快速入门(二) 承接前两个章节,本系列第三章节主要讲SQL中where和having的作用和区别、 GROUP BY和ORDER BY作用和区别、表与表之间的连接操作(重点&…...

mybatis(19/134)
大致了解了一下工具类,自己手敲了一边,java的封装还是真的省去了很多麻烦,封装成一个工具类就可以不用写很多重复的步骤,一个工厂对应一个数据库一个environment就好了。 mybatis中调用sql中的delete占位符里面需要有字符…...

sqlmap 自动注入 -01
1: 先看一下sqlmap 的help: 在kali-linux 系统里面,可以sqlmap -h看一下: Target: At least one of these options has to be provided to define the target(s) -u URL, --urlURL Target URL (e.g. "Salesforce Platform for Application Development | Sa…...
3.8.Trie树
Trie树 Trie 树,又称字典树或前缀树,是一种用于高效存储和检索字符串数据的数据结构,以下是关于它的详细介绍: 定义与原理 定义:Trie 树是一种树形结构,每个节点可以包含多个子节点,用于存储…...
day 21
进程、线程、协程的区别 进程:操作系统分配资源的最小单位,其中可以包含一个或者多个线程,进程之间是独立的,可以通过进程间通信机制(管道,消息队列,共享内存,信号量,信…...
基于模板方法模式-消息队列发送
基于模板方法模式-消息队列发送 消息队列广泛应用于现代分布式系统中,作为解耦、异步处理和流量控制的重要工具。在消息队列的使用中,发送消息是常见的操作。不同的消息队列可能有不同的实现方式,例如,RabbitMQ、Kafka、RocketMQ…...

俄语画外音的特点
随着全球媒体消费的增加,语音服务呈指数级增长。作为视听翻译和本地化的一个关键方面,画外音在确保来自不同语言和文化背景的观众能够以一种真实和可访问的方式参与内容方面发挥着重要作用。说到俄语,画外音有其独特的特点、挑战和复杂性&…...

PyTorch使用教程(10)-torchinfo.summary网络结构可视化详细说明
1、基本介绍 torchinfo是一个为PyTorch用户量身定做的开源工具,其核心功能之一是summary函数。这个函数旨在简化模型的开发与调试流程,让模型架构一目了然。通过torchinfo的summary函数,用户可以快速获取模型的详细结构和统计信息࿰…...

亚博microros小车-原生ubuntu支持系列:5-姿态检测
MediaPipe 介绍参见:亚博microros小车-原生ubuntu支持系列:4-手部检测-CSDN博客 本篇继续迁移姿态检测。 一 背景知识 以下来自亚博官网 MediaPipe Pose是⼀个⽤于⾼保真⾝体姿势跟踪的ML解决⽅案,利⽤BlazePose研究,从RGB视频…...

C语言之高校学生信息快速查询系统的实现
🌟 嗨,我是LucianaiB! 🌍 总有人间一两风,填我十万八千梦。 🚀 路漫漫其修远兮,吾将上下而求索。 C语言之高校学生信息快速查询系统的实现 目录 任务陈述与分析 问题陈述问题分析 数据结构设…...

WPF基础 | WPF 基础概念全解析:布局、控件与事件
WPF基础 | WPF 基础概念全解析:布局、控件与事件 一、前言二、WPF 布局系统2.1 布局的重要性与基本原理2.2 常见布局面板2.3 布局的测量与排列过程 三、WPF 控件3.1 控件概述与分类3.2 常见控件的属性、方法与事件3.3 自定义控件 四、WPF 事件4.1 路由事件概述4.2 事…...
迷宫1.2
先发一下上次的代码 #include<bits/stdc.h> #include<windows.h> #include <conio.h> using namespace std; char a[1005][1005]{ " ", "################", "# # *#", "# # # #&qu…...
03 Deep learning神经网络的编程基础 代价函数(Cost function)--吴恩达
深度学习中的损失函数(Cost Function)用于量化模型预测与真实数据的差距,是优化神经网络的核心指标。以下是常见类型及数学表达: 核心原理 逻辑回归通过sigmoid函数将线性预测结果转换为概率: y ^ ( i ) \hat{y}^{(i)}...
ES6——对象扩展之Set对象
在ES6(ECMAScript 2015)中,Set 对象允许存储任何类型的唯一值,无论是原始值还是对象引用。Set 对象有一些有用的方法,可以操作集合中的数据。以下是一些常用的 Set 对象方法: 方法描述 add 向 Set 对象添加…...
在 Windows 系统上运行 Docker 容器中的 Ubuntu 镜像并显示 GUI
在 Windows 上安装一个 X Server(如 VcXsrv 或 X410),Ubuntu 容器通过网络将图形界面转发到 Windows。 步骤: 安装 X Server: 推荐使用VcXsrv,免费开源。 安装后运行 XLaunch,选择࿱…...
centos查看开启关闭防火墙状态
执行:systemctl status firewalld ,即可查看防火墙状态 防火墙的开启、关闭、禁用命令 (1)设置开机启用防火墙:systemctl enable firewalld.service (2)设置开机禁用防火墙:system…...
Java常用的判空方法
文章目录 Java常用的判空方法JDK 自带的判空方法1. 使用 或 ! 运算符2. 使用 equals 方法3. Objects.isNull / Objects.nonNull4. Objects.equals4. JDK8 中的 Optional 第三方工具包1. Apache Commons Lang32. Google Guava3. Lombok 注解4. Vavr(函数式风格&…...
Neo4j 数据建模:原理、技术与实践指南
Neo4j 作为领先的图数据库,其核心优势在于利用图结构直观地表达和高效地查询复杂关系。其数据建模理念与传统关系型数据库截然不同,专注于实体(节点)及其连接(关系)。以下基于官方文档,系统阐述其建模原理、关键技术、实用技巧及最佳实践: 一、 核心原理:以关系为中心…...
【华为云Astro-服务编排】服务编排中图元的使用与配置
目录 子服务编排图元 子服务编排图元的作用 如何使用子服务编排图元 脚本图元 脚本图元的作用 如何使用脚本图元 记录创建图元 记录创建图元的作用 如何使用记录创建图元 记录删除图元 记录删除图元的作用 如何使用记录删除图元 记录查询图元 记录查询图元的作用…...

第R9周:阿尔茨海默病诊断(优化特征选择版)
文章目录 1. 导入数据2. 数据处理2.1 患病占比2.2 相关性分析2.3 年龄与患病探究 3. 特征选择4. 构建数据集4.1 数据集划分与标准化4.2 构建加载 5. 构建模型6. 模型训练6.1 构建训练函数6.2 构建测试函数6.3 设置超参数 7. 模型训练8. 模型评估8.1 结果图 8.2 混淆矩阵9. 总结…...

【Linux】find 命令详解及使用示例:递归查找文件和目录
【Linux】find 命令详解及使用示例:递归查找文件和目录 引言 find 是 Linux/Unix 系统中强大的文件搜索工具,用于在目录层次结构中递归查找文件和目录。它提供了丰富的搜索条件和灵活的操作选项,可以满足从简单到复杂的各种文件查找需求。 …...
在uni-app中如何从Options API迁移到Composition API?
uni-app 从 Options API 迁移到 Composition API 的详细指南 一、迁移前的准备 升级环境: 确保 HBuilderX 版本 ≥ 3.2.0项目 uni-app 版本 ≥ 3.0.0 了解 Composition API 基础: 响应式系统:ref、reactive生命周期钩子:onMount…...