简体   繁体   English

如何使用 EmguCV 在图像上书写 C#

[英]How to write on images using EmguCV in C#

I wanna write on images using EmguCV in Windows Form C# In actual I wanna create a simple app for images as an image editor.我想在Windows 表格 C#中使用EmguCV在图像上书写 实际上,我想为图像创建一个简单的应用程序作为图像编辑器。 Its simple purpose is to open images through an open file dialogue I can open the file but now I can't get any help or resource on How to write on images?它的简单目的是通过打开文件对话框打开图像我可以打开文件但现在我无法获得有关如何在图像上书写的任何帮助或资源? . . Let me explain my question through some image examples:让我通过一些图像示例来解释我的问题:

Image Before Editing:编辑前的图像:

在此处输入图像描述

Image after Editing:编辑后的图像:

在此处输入图像描述

So how can I do this using EmguCV in C# I am newbie in dealing with images if there any way so kindly tell me.那么我如何在C#中使用EmguCV来做到这一点我是处理图像的新手,如果有任何方式请告诉我。 And If there is not a such function involved in writing on images using EmguCV then please tell the alternative if any of you know??如果没有这样的 function 涉及使用EmguCV在图像上书写,那么如果你们有人知道,请告诉替代方案?

Thanks in advance.提前致谢。

You can write on images with CvInvoke.PutText , one simple example is here:您可以使用CvInvoke.PutText在图像上书写,这里是一个简单的示例:

// load the image        
Mat image = new Mat("test.png");
// write "hello!" in red(0,0,255) at 100,100 coordinate from the top left corner
CvInvoke.PutText(image, "hello!", new System.Drawing.Point(100, 100), FontFace.HersheySimplex, 1.0, new MCvScalar(0, 0, 255), 2);
// display the result
CvInvoke.Imshow("Image with text", image);
// wait for user input to dismiss the image
CvInvoke.WaitKey();
// free allocated memory
image.Dispose();

Seems confusing for somebody new to EmguCV but it really is just a matter of looking at what each parameters do, more info in the EmguCV official documentation.对于刚接触 EmguCV 的人来说似乎很困惑,但这实际上只是查看每个参数的作用的问题,更多信息请参阅EmguCV 官方文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM