当前位置: 首页 > news >正文

网站建设i rsky网站名称在哪里注册

网站建设i rsky,网站名称在哪里注册,校区网站建设,专业 网站设计目录 说明 效果 模型 项目 代码 下载 参考 C# OpenCvSharp 部署文档矫正#xff0c;包括文档扭曲/模糊/阴影等情况 说明 地址#xff1a;https://github.com/RapidAI/RapidUnDistort 修正文档扭曲/模糊/阴影等情况#xff0c;使用onnx模型简单轻量部署#xff0c…目录 说明 效果 模型 项目 代码 下载 参考 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 ------------------------- nameinput tensorFloat[-1, 6, -1, -1] --------------------------------------------------------------- Outputs ------------------------- nameoutput tensorFloat[-1, 3, -1, -1] --------------------------------------------------------------- gcnet.onnx Model Properties ------------------------- --------------------------------------------------------------- Inputs ------------------------- nameinput tensorFloat[-1, 3, -1, -1] --------------------------------------------------------------- Outputs ------------------------- nameoutput tensorFloat[-1, 3, -1, -1] --------------------------------------------------------------- nafdpm.onnx Model Properties ------------------------- --------------------------------------------------------------- Inputs ------------------------- nameinput tensorFloat[-1, 3, -1, -1] --------------------------------------------------------------- Outputs ------------------------- nameoutput tensorFloat[-1, -1, -1, -1] --------------------------------------------------------------- unetcnn.onnx Model Properties ------------------------- --------------------------------------------------------------- Inputs ------------------------- nameinput tensorFloat[-1, 3, -1, -1] --------------------------------------------------------------- Outputs ------------------------- nameoutput tensorFloat[-1, 1, -1, -1] --------------------------------------------------------------- uvdoc.onnx Model Properties ------------------------- --------------------------------------------------------------- Inputs ------------------------- nameinput tensorFloat[-1, 3, -1, -1] --------------------------------------------------------------- Outputs ------------------------- nameoutput tensorFloat[-1, 2, -1, -1] name546 tensorFloat[-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 namesender/param         /// param namee/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 namesender/param         /// param namee/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 namesender/param         /// param namee/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 namesender/param         /// param namee/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 namesender/param         /// param namee/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 namesender/param/// param namee/paramprivate 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 namesender/param/// param namee/paramprivate 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 namesender/param/// param namee/paramprivate 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 namesender/param/// param namee/paramprivate 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 namesender/param/// param namee/paramprivate 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.dnsts.com.cn/news/91797.html

相关文章:

  • 合肥网站网站建设把自己做的网站传到网上
  • 四川网站排名app和微网站的区别是什么
  • 福田网站建设龙岗网站建设罗湖网站建设网站开发交接表
  • 天河建设网站制作网站建设淘宝类目
  • 微信h5制作网站开发电商主图模板
  • 品牌服装网站建设现状wordpress noren
  • 网站建设方案书一定要有吗可以注册公司的地址
  • 网站开发职业wordpress 关键字 插件
  • 企业网站为什么做优化医疗网站建设行业现状
  • 加快信用网站建设全屋整装十大排名全国前十强
  • 装修设计网站哪个平台最好做公司官网大概多少钱
  • 平泉市住房和城乡建设局网站网站设置屏蔽广告
  • 接做网站需要问什么软件公司网站突然404
  • 网站建设公司 温州wordpress termux
  • 网页制作建立站点淄博网站建设相关文章
  • 专业做酒类营销的网站如何进入微网站
  • php网站开发参考书籍网站推广策划书包括哪些点
  • 如何做网站淘客推广百度小游戏入口
  • 上海建站哪家好有哪些网站做的很好
  • 做网站需要机吗成都网站设计制作公司
  • 企业电子商务网站建设策划书图片制作视频
  • 广东住房和城乡建设局网站wordpress的cms主题
  • 利用社交网站做淘宝客岳阳网站建设网站
  • 网站正在建设中是什么意思网站开发技术架构
  • 做课题查新网站设计师服务平台素材羊
  • html如果制作一个内容多的网站建设 投资基金管理有限公司网站
  • 盘锦网站制作大石桥城乡规划建设局网站
  • 重庆建设造价工程信息网站wordpress伪静态不跳转404
  • 网站开发的前后台的步骤分别为南平高速建设有限公司网站
  • 兰溪市建设局官方网站集团网站建设定制网站建设