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

临沂网站改版装修计算器在线计算

临沂网站改版,装修计算器在线计算,新冠疫苗最新官方消息,好看免费的ppt模板下载目录 说明 效果 项目 代码 下载 参考 C# OpenCvSharp 部署MOWA#xff1a;多合一图像扭曲模型 说明 算法模型的paper名称是《MOWA: Multiple-in-One Image Warping Model》 ariv链接 https://arxiv.org/pdf/2404.10716 效果 Stitched Image 翻译成中文意思是多合一图像扭曲模型 说明 算法模型的paper名称是《MOWA: Multiple-in-One Image Warping Model》 ariv链接 https://arxiv.org/pdf/2404.10716  效果 Stitched Image 翻译成中文意思是拼接图像。效果图如下可以看到输入原图的边界是不规则的在经过模型推理之后输出的图的边界是规整了。 Rectified Wide-Angle Image 翻译成中文意思是矫正广角图像。效果图如下可以看到输入原图的左右上下边界是扭曲的在经过模型推理之后输出的图的边界是规整了。 Unrolling Shutter Image 翻译成中文意思是卷帘快门图像。效果图如下可以看到输入原图的右边界是弯曲的在经过模型推理之后输出的图的边界是规整了。 Rotated Image 翻译成中文意思是旋转图像。效果图如下可以看到输入原图是有明显倾斜的在经过模型推理之后输出的图是摆正了。 Fisheye Image 翻译成中文意思是鱼眼图像。效果图如下可以看到输入原图里的建筑物有明显扭曲的在经过模型推理之后输出的图里的建筑物是正直的了。 项目 代码 using OpenCvSharp; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.Drawing; using System.Drawing.Imaging; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace MOWA {     public partial class Form1 : Form     {         public Form1()         {             InitializeComponent();         } Stopwatch stopwatch new Stopwatch();         Mat image;         Mat mask;         Mat mesh_img;         Mat grid_mesh_img;         Mat flow_img; string image_path;         string mask_path;         string startupPath;         string fileFilter *.*|*.bmp;*.jpg;*.jpeg;*.tiff;*.tiff;*.png;         const string DllName MOWASharp.dll;         IntPtr engine; /*          //初始化         extern C _declspec(dllexport) int __cdecl  init(void** engine, char* model_dir,char* msg); //detect         extern C _declspec(dllexport) int __cdecl  detect(void* engine, Mat* srcimg, Mat* maskimg, char* msg, Mat* mesh_img, Mat* grid_mesh_img, Mat* flow_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 model_dir, StringBuilder msg); [DllImport(DllName, EntryPoint detect, CallingConvention CallingConvention.Cdecl)]         internal extern static int detect(IntPtr engine, IntPtr srcimg, IntPtr maskimg, StringBuilder msg, IntPtr mesh_img, IntPtr grid_mesh_img, IntPtr flow_img); [DllImport(DllName, EntryPoint destroy, CallingConvention CallingConvention.Cdecl)]         internal extern static int destroy(IntPtr engine); private void Form1_Load(object sender, EventArgs e)         {             startupPath Application.StartupPath; string model_dir startupPath \\model\\; StringBuilder msg new StringBuilder(512); int res init(ref engine, model_dir, msg);             if (res -1)             {                 MessageBox.Show(msg.ToString());                 return;             }             else             {                 Console.WriteLine(msg.ToString());             }             image_path startupPath \\test_img\\39501.png;             pictureBox1.Image new Bitmap(image_path); mask_path startupPath \\test_img\\39501_mask.png;             pictureBox3.Image new Bitmap(mask_path);         } private void Form1_FormClosed(object sender, FormClosedEventArgs e)         {             destroy(engine);         } private void button2_Click(object sender, EventArgs e)         {             if (image_path || mask_path )             {                 return;             } textBox1.Text 执行中……;             button2.Enabled false;             if (pictureBox2.Image ! null)             {                 pictureBox2.Image.Dispose();                 pictureBox2.Image null;             }             Application.DoEvents(); Cv2.DestroyAllWindows();             if (image ! null) image.Dispose();             if (mask ! null) mask.Dispose();             if (mesh_img ! null) mesh_img.Dispose();             if (grid_mesh_img ! null) grid_mesh_img.Dispose();             if (flow_img ! null) flow_img.Dispose(); StringBuilder msg new StringBuilder(512);             image new Mat(image_path);             mask new Mat(mask_path,ImreadModes.Grayscale);             mesh_img new Mat();             grid_mesh_img new Mat();             flow_img new Mat(); stopwatch.Restart(); int res detect(engine, image.CvPtr, mask.CvPtr, msg, mesh_img.CvPtr, grid_mesh_img.CvPtr, flow_img.CvPtr);             if (res 0)             {                 stopwatch.Stop();                 double costTime stopwatch.Elapsed.TotalMilliseconds;                 pictureBox2.Image new Bitmap(flow_img.ToMemoryStream());                 Cv2.ImShow(mesh_img, mesh_img);                 Cv2.ImShow(grid_mesh_img, grid_mesh_img);                 textBox1.Text $耗时:{costTime:F2}ms;             }             else             {                 textBox1.Text 失败, msg.ToString();             }             button2.Enabled true;         } private void button1_Click(object sender, EventArgs e)         {             OpenFileDialog ofd new OpenFileDialog();             ofd.Filter fileFilter;             ofd.InitialDirectory startupPath \\test_img;             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 button4_Click(object sender, EventArgs e)         {             OpenFileDialog ofd new OpenFileDialog();             ofd.Filter fileFilter;             ofd.InitialDirectory startupPath\\test_img;             if (ofd.ShowDialog() ! DialogResult.OK) return; pictureBox3.Image null;             pictureBox2.Image null;             textBox1.Text ; mask_path ofd.FileName;             pictureBox3.Image new Bitmap(mask_path);             mask new Mat(image_path);         } 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.Collections.Generic; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.Drawing; using System.Drawing.Imaging; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; using System.Windows.Forms;namespace MOWA {public partial class Form1 : Form{public Form1(){InitializeComponent();}Stopwatch stopwatch new Stopwatch();Mat image;Mat mask;Mat mesh_img;Mat grid_mesh_img;Mat flow_img;string image_path;string mask_path;string startupPath;string fileFilter *.*|*.bmp;*.jpg;*.jpeg;*.tiff;*.tiff;*.png;const string DllName MOWASharp.dll;IntPtr engine;/*//初始化extern C _declspec(dllexport) int __cdecl init(void** engine, char* model_dir,char* msg);//detectextern C _declspec(dllexport) int __cdecl detect(void* engine, Mat* srcimg, Mat* maskimg, char* msg, Mat* mesh_img, Mat* grid_mesh_img, Mat* flow_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 model_dir, StringBuilder msg);[DllImport(DllName, EntryPoint detect, CallingConvention CallingConvention.Cdecl)]internal extern static int detect(IntPtr engine, IntPtr srcimg, IntPtr maskimg, StringBuilder msg, IntPtr mesh_img, IntPtr grid_mesh_img, IntPtr flow_img);[DllImport(DllName, EntryPoint destroy, CallingConvention CallingConvention.Cdecl)]internal extern static int destroy(IntPtr engine);private void Form1_Load(object sender, EventArgs e){startupPath Application.StartupPath;string model_dir startupPath \\model\\;StringBuilder msg new StringBuilder(512);int res init(ref engine, model_dir, msg);if (res -1){MessageBox.Show(msg.ToString());return;}else{Console.WriteLine(msg.ToString());}image_path startupPath \\test_img\\39501.png;pictureBox1.Image new Bitmap(image_path);mask_path startupPath \\test_img\\39501_mask.png;pictureBox3.Image new Bitmap(mask_path);}private void Form1_FormClosed(object sender, FormClosedEventArgs e){destroy(engine);}private void button2_Click(object sender, EventArgs e){if (image_path || mask_path ){return;}textBox1.Text 执行中……;button2.Enabled false;if (pictureBox2.Image ! null){pictureBox2.Image.Dispose();pictureBox2.Image null;}Application.DoEvents();Cv2.DestroyAllWindows();if (image ! null) image.Dispose();if (mask ! null) mask.Dispose();if (mesh_img ! null) mesh_img.Dispose();if (grid_mesh_img ! null) grid_mesh_img.Dispose();if (flow_img ! null) flow_img.Dispose();StringBuilder msg new StringBuilder(512);image new Mat(image_path);mask new Mat(mask_path,ImreadModes.Grayscale);mesh_img new Mat();grid_mesh_img new Mat();flow_img new Mat();stopwatch.Restart();int res detect(engine, image.CvPtr, mask.CvPtr, msg, mesh_img.CvPtr, grid_mesh_img.CvPtr, flow_img.CvPtr);if (res 0){stopwatch.Stop();double costTime stopwatch.Elapsed.TotalMilliseconds;pictureBox2.Image new Bitmap(flow_img.ToMemoryStream());Cv2.ImShow(mesh_img, mesh_img);Cv2.ImShow(grid_mesh_img, grid_mesh_img);textBox1.Text $耗时:{costTime:F2}ms;}else{textBox1.Text 失败, msg.ToString();}button2.Enabled true;}private void button1_Click(object sender, EventArgs e){OpenFileDialog ofd new OpenFileDialog();ofd.Filter fileFilter;ofd.InitialDirectory startupPath \\test_img;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 button4_Click(object sender, EventArgs e){OpenFileDialog ofd new OpenFileDialog();ofd.Filter fileFilter;ofd.InitialDirectory startupPath\\test_img;if (ofd.ShowDialog() ! DialogResult.OK) return;pictureBox3.Image null;pictureBox2.Image null;textBox1.Text ;mask_path ofd.FileName;pictureBox3.Image new Bitmap(mask_path);mask new Mat(image_path);}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/MOWA-onnxrun
http://www.w-s-a.com/news/755612/

相关文章:

  • 温州 网站优化网站开发公司前置审批
  • 网站开发具体的工作内容网站下载app免费
  • seo网站建设时文章频率昆山网站建设ikelv
  • 中天建设中瑞物资网站优化建立生育支持政策体系
  • 网站页面的宽度大网站怎样选域名
  • icp网站备案流程wordpress post 405
  • 网站怎样上传到空间重庆有多少网站
  • 用模板建商城购物网站嘉定专业网站建设
  • 网站开发与应用 论文dede手机医院网站模板
  • 织梦 网站栏目管理 很慢自学网页设计难吗
  • 茶文化建设网站的意义平顶山网站建设服务公司
  • 建设网站详细流程南京宣传片制作公司
  • 合肥网站排名什么网站做电气自动化兼职
  • 如何用api做网站交通建设门户网站
  • 阳西住房和城乡规划建设局网站长沙网站seo技巧
  • 长沙知名网站推广手机画设计图软件
  • 顺德公司做网站自己有网站怎么优化
  • 南京网站开发南京乐识专业外贸流程知乎
  • 盐田区住房和建设局网站分类网站有哪些
  • 建一个团购网站WordPress文章字号设置
  • 做漂亮的网站东营网站seo
  • 网站开发摊销做设计哪个网站可以接单
  • 惠州h5网站建设建设公司网站报价
  • 做网站多少钱 优帮云嘉兴五县两区网站建设
  • 三亚旅游网站策划书企业网站建设的定位
  • 网站建设工作台账网站建设的实验结论
  • 商业网站建设平台制作软件的软件
  • 本地网站开发wordpress页面关键词和描述
  • 微网站 合同软件开发培训方案
  • 怎么做淘宝客网站备案广告公司图片大全