views:

141

answers:

1

Hi I want to draw a rectangle 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

+2  A: 

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.

kidjan
thks for the reply. I am particularly interested in drawing using a mouse. I am sorri I didnt mention that
Haxed