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

编程入门 行业动态 更新时间:2024-10-14 10:37:27

C# OpenCvSharp 环形文字处理 <a href=https://www.elefans.com/category/jswz/34/1691468.html style=直角坐标与极坐标转换"/>

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下载

更多推荐

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

本文发布于:2023-11-15 18:55:07,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1604547.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:直角坐标   环形   文字处理   极坐标   OpenCvSharp

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!