How to write on images using EmguCV in C#

884 views Asked by At

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. 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:

enter image description here

Image after Editing:

enter image description here

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. 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??

Thanks in advance.

1

There are 1 answers

0
erik7854 On

You can write on images with CvInvoke.PutText, one simple example is here:

// 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.