Drawing an unfilled square on a video using a mouse

Hi,

I am using dshownet(first time) and C#. I have got a sample to take the web cam input and display it on a form. I now need to draw a rectangle on top of the video stream using the mouse. (the intent is to track what is inside the box from there onwards).

I heard that there is something called VMR. So I went to the dshownet samples and went through them. I didnt find any samples that use the mouse to overlay a shape on the video stream. Someone on here suggested to use colorkey. Another person said to use GDI+ and mouse handling. I tried to compile the DXLogo sample but got this error :


Error 1 Cannot create an instance of the abstract class or interface ‘System.Drawing.Image’ C:\Documents and Settings\TLNA\Desktop\Final Year Project\Libraries\DirectShow library 2\DirectShowSamples-2010-February\Samples\Capture\DxLogo\Capture.cs 128 32 DxLogo-2008


for the code section:


if (fileName.Length > 0)
{
m_Bitmap = new Image(fileName); // error happened here

Rectangle r = new Rectangle(0, 0, m_Bitmap.Width, m_Bitmap.Height);
m_bmdLogo = m_Bitmap.LockBits(r, ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);
}


I know that I must go through the Bitmap9 Interface. But I really dont know where to start. Should I read the Directshow API docs.

btw I also have the book Programming Microsoft Directshow for digital video and television. I started reading that book and stopped after a few pages since the code is mainly in C++. Should I continue to read this is book ? How can I accomplish the certain mentioned tasks in C# ?

Any suggestions as how to draw on the video. Some useful links(tutorials) would be helpful.

Many Thanks
Tlna

I know nothing about this, but it sounds like the class that you are trying
to create an instance of is abstract, so it should fail. Assuming that this
is correct, and you’d have to derive a class from it and define the
necessary pure functions and then create an instance.

Despite the fact that you got help here before, this question is not related
to windows drivers. I’m not sure what list of there would be more likely to
provide better help, but there has to be one.

Good luck,

mm

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Thursday, June 24, 2010 11:09 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Drawing an unfilled square on a video using a mouse

Hi,

I am using dshownet(first time) and C#. I have got a sample to take the web
cam input and display it on a form. I now need to draw a rectangle on top of
the video stream using the mouse. (the intent is to track what is inside the
box from there onwards).

I heard that there is something called VMR. So I went to the dshownet
samples and went through them. I didnt find any samples that use the mouse
to overlay a shape on the video stream. Someone on here suggested to use
colorkey. Another person said to use GDI+ and mouse handling. I tried to
compile the DXLogo sample but got this error :


Error 1 Cannot create an instance of the abstract class or interface
‘System.Drawing.Image’ C:\Documents and Settings\TLNA\Desktop\Final Year
Project\Libraries\DirectShow library
2\DirectShowSamples-2010-February\Samples\Capture\DxLogo\Capture.cs 128
32 DxLogo-2008


for the code section:


if (fileName.Length > 0)
{
m_Bitmap = new Image(fileName); // error happened here

Rectangle r = new Rectangle(0, 0, m_Bitmap.Width,
m_Bitmap.Height);
m_bmdLogo = m_Bitmap.LockBits(r, ImageLockMode.ReadOnly,
PixelFormat.Format24bppRgb);
}


I know that I must go through the Bitmap9 Interface. But I really dont know
where to start. Should I read the Directshow API docs.

btw I also have the book Programming Microsoft Directshow for digital video
and television. I started reading that book and stopped after a few pages
since the code is mainly in C++. Should I continue to read this is book ?
How can I accomplish the certain mentioned tasks in C# ?

Any suggestions as how to draw on the video. Some useful links(tutorials)
would be helpful.

Many Thanks
Tlna


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

OP: No offense, but please take your question to StackOverflow or a similar, more appropriate, forum. This is really off topic for this list.

Peter
OSR

On 25/06/2010 04:09, xxxxx@gmail.com wrote:

Hi,

I am using dshownet(first time) and C#.

OK - then to get help from people who know about such things follow this
link:

http://tmhare.mvps.org/help.htm#where

Contains at least 8 or 9 links to appropriate newsgroups and the MSDN
forum for directshow. Took me 15 seconds to find via google.

MH.

ok thanks for letting me know

On Fri, Jun 25, 2010 at 7:02 PM, wrote:

> OP: No offense, but please take your question to StackOverflow or a
> similar, more appropriate, forum. This is really off topic for this list.
>
> Peter
> OSR
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>


B. T. A. P.