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

C# OpenCvSharp 环形文字处理 直角坐标与极坐标转换

效果1

效果2

项目

代码

using OpenCvSharp;
using System;
using System.Drawing;
using System.Text;
using System.Windows.Forms;namespace OpenCvSharp_Demo
{public partial class frmMain : Form{public frmMain(){InitializeComponent();}string fileFilter = "*.*|*.bmp;*.jpg;*.jpeg;*.tiff;*.tiff;*.png";string image_path = "";DateTime dt1 = DateTime.Now;DateTime dt2 = DateTime.Now;Mat image;Mat result_image;StringBuilder sb = new StringBuilder();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;image_path = ofd.FileName;pictureBox1.Image = new Bitmap(image_path);image = new Mat(image_path);}private void Form1_Load(object sender, EventArgs e){}private void button2_Click(object sender, EventArgs e){image_path = "test_img/2.jpg";image = new Mat(image_path);pictureBox1.Image = new Bitmap(image_path);result_image = new Mat();float h, w, cx, cy;h = (float)image.Height;w = (float)image.Width;//以图像中心点作为变换中心cx = w / 2;cy = h / 2;double maxR = Math.Max(cx, cy); // 最大变换半径Cv2.LinearPolar(image, result_image, new Point2f(cx, cy), maxR, InterpolationFlags.Linear);Cv2.Rotate(result_image, result_image, RotateFlags.Rotate90Counterclockwise);pictureBox2.Image = new Bitmap(result_image.ToMemoryStream());}private void button3_Click(object sender, EventArgs e){image_path = "test_img/1.jpg";image = new Mat(image_path);pictureBox1.Image = new Bitmap(image_path);result_image = new Mat();float h, w, cx, cy;h = (float)image.Height;w = (float)image.Width;//以图像中心点作为变换中心cx = w / 2;cy = h / 2;Cv2.LogPolar(image, result_image, new Point2f(cx, cy), 80, InterpolationFlags.Linear | InterpolationFlags.WarpFillOutliers);Cv2.Rotate(result_image, result_image, RotateFlags.Rotate90Counterclockwise);pictureBox2.Image = new Bitmap(result_image.ToMemoryStream());}private void pictureBox2_DoubleClick(object sender, EventArgs e){Common.ShowNormalImg(pictureBox2.Image);}private void pictureBox1_DoubleClick(object sender, EventArgs e){Common.ShowNormalImg(pictureBox1.Image);}}
}

其他

结合印章检测和OCR识别,可实现印章文字识别。

印章检测 C# PaddleDetection yolo 印章检测

OCR识别 C# OpenVINO 通用OCR识别 文字识别 中文识别 服务

下载

Demo下载

http://www.lryc.cn/news/225210.html

相关文章:

  • 计算机视觉与深度学习 | 视频/图像转换及保存播放(Matlab源码)
  • 网格变形算法
  • 2. Spark报错,Task is Failed,errorMsg: FileNotFoundException xxxx
  • Flutter开发实战之上传身份照片并认证
  • C++文件加密、解密
  • 使用Java语言实现基本RS触发器
  • c++函数指针作为std::map值
  • data对象内新增属性,console.log()可以打印出来,不重新渲染
  • React:实现一个定时器计数器,每秒自动+1
  • rocksdb 中 db_bench 的使用方法
  • 【前端】TypeScript核心知识点讲解
  • 【工具推荐】一键多平台文章发布神器推荐(免费)
  • PDF有限制密码,不能复制怎么办?
  • 【原创学位论文】基于python和定向爬虫的商品比价系统.docx
  • 【Proteus仿真】【STM32单片机】汽车尾灯控制设计
  • 多线程—锁
  • uniapp使用vue
  • 能源监测管理系统有哪些作用与效果?
  • 数据分析是什么?
  • 【kafka】Java客户端代码demo:自动异步提交、手动同步提交及提交颗粒度、动态负载均衡
  • 【Git】Gui图形化管理、SSH协议私库集成IDEA使用
  • AIX5.3安装weblogic10.3
  • 聊聊logback的FixedWindowRollingPolicy
  • 详解机器学习最优化算法
  • 文件缓存的读写
  • Debian 修改主机名
  • 多线程返回计时问题代码案例
  • 【STM32】STM32的Cube和HAL生态
  • 汇编-EQU伪指令(数值替换)
  • 超声波俱乐部分享:Enter AI native application