开发者

Drawing a rectangle on a video in C#

Hi I want to draw a rect开发者_如何学Goangle on a video stream(web cam video or loaded saved video) that I have streaming on a picture box. This is a C# application and I am using EmguCV 2.1.0.0. I have been successful in displaying the video stream on the picturebox in the form.

Can I use Emgucv to draw on the video or should I use something else ? Can I use Dshownet or something like that ?

Thanks for taking the time to read this.

Many Thanks


The simplest way is update the picture box on some callback you receive with every frame:

Bitmap bm = ...;    
using (Graphics gr = Graphics.FromImage(bm))
{
    gr.DrawRectangle(somePoint, someRectangle);
}

pictureBox.Image = bm;

The downside of this method is the image won't refresh itself unless another frame comes along, so you may have to have other methods to invoke a draw action. You can also use gr.DrawString and any other methods in the Graphics class to draw to the bitmap.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜