Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Wednesday, October 8, 2008 11:58:07 PM(UTC)
sdecorme

Groups: Registered
Posts: 17


Hi
I need to make a soft that will be able to
Capture video
draw text and shape (circle square..)
edit video (cut / save)
preview video
Is the sdk able all of this without more plug-in ?
On my evaluation sdk I've found
preview video
edit video (cut / save)
Capture video
But I didn't found simple way to make my overlay (I know I've always the same problem)
do you have a simple sample to do it for the V16 version ?
thanks
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Thursday, October 9, 2008 6:01:30 AM(UTC)

Yasir Alani  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

Do you want to draw these shapes on the surface of the control, or do you want them to become part of the video contents.

If it's on the surface, you could try to use Windows GDI graphics functions to draw on the control's window.

On the other hand, if you want to modify the video frames, you can do that using our Video Callback filter which gives you access to the pixel data of each frame of the video. You can modify that pixel data in any way you want (like drawing text or shapes on them) and then preview them.

The toolkit has demos that use the Video Callback filter, but these demos require LEADTOOLS imaging toolkit to be installed. However, you can use the filter even without the imaging toolkit.
 
#3 Posted : Thursday, October 9, 2008 6:07:46 AM(UTC)
sdecorme

Groups: Registered
Posts: 17


This is the problem I don't know how to implement the callback filter
I've made all the other function but sorry I didn't find the way to do that [:'(]
Please help me I use multimedia sdk V16 and VS2005
In the demo I didn't find the callback overlay part.
Thanks
 
#4 Posted : Thursday, October 9, 2008 6:08:55 AM(UTC)
sdecorme

Groups: Registered
Posts: 17


More precision
I want to put it in the video frame
 
#5 Posted : Thursday, October 9, 2008 10:53:38 PM(UTC)
sdecorme

Groups: Registered
Posts: 17


I've made a simple solution that capture video I've added the callbackCapture file from your sample
In this file I've delete all the raster function ,know when I compile my prog  I pass in the ReceiveProc function .
Know what can I do to add a simple circle in my video or to put  some text
Is it possible when I will finish to put my sample in the forum ?
thanks
 
#6 Posted : Friday, October 10, 2008 5:28:46 AM(UTC)
sdecorme

Groups: Registered
Posts: 17


In my ReceiveProc function I've put
LMVTextOverlayLib.LMVTextOverlayClass IncrustText = new LMVTextOverlayLib.LMVTextOverlayClass();
                IncrustText.OverlayText = "ESSAI OVERLAY";
                IncrustText.XPos = 50;
                IncrustText.YPos = 50;

But It doesn't work
where is the documentation about LMVTextOverlayLib
nothing in the Multimedia API Help
nothing in the Multimedia COM Objects Help
nothing in the Getting Started with LEADTOOLS Multimedia
It is impossible to find a sample that not use the raster lib
I'm disappointed about the help file and the sample I'm looking for two days for help or sample and each time nobody have a simple solution to draw a text or a circle.
I've read all the post in the forum about callback or overlay and each time the solution is with the raster lib nobody use any other way I don't want to buy the raster lib
[:@]



 
#7 Posted : Friday, October 10, 2008 7:08:36 AM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 764


Documentation for filters such as the TextOverlay filter will be in the filters help file.  You can find a shortcut to it in Start Menu\Programs\LEADTOOLS Multimedia 16\Processing\Filters\Multimedia Filters Help.

In order to set the properties of a filter, you need to first add the filter to the graph, and then use GetSubObject to get the instance of it.  A while back, I made a demo for this in v15, so I did a quick port to v16 and have attached it.

In regards to drawing on the video frame using the Video Callback, it is certainly possible to not use our Raster library.  The callback provides you with the necessary information to allocate an image (pointer to the data buffer, length of the buffer, width, height, etc.).  You can use whichever library you wish, but we cannot provide support for other libraries including Microsoft GDI.

Finally, if you make a sample and wish to post it on the forums, you are welcome and encouraged to do so as it would help other customers.  Just make sure to follow these guidelines:

1.) Zip the file(s) up.
2.) Make sure it is less than 5 MB.
3.) Remove ANY AND ALL unlock codes and LEADTOOLS DLLs.
4.) Do not click the preview button, the attachment will not show up when you post it.

File Attachment(s):
 
#8 Posted : Sunday, October 12, 2008 10:51:01 PM(UTC)
sdecorme

Groups: Registered
Posts: 17


It work geat
I've added a simple function to draw a rectangle in GDI in the btnChangeProperties_Click_1 function

            IntPtr hwnd = new IntPtr();
            hwnd = axltmmPlayCtrl1.Handle;
            Graphics newGraphics = Graphics.FromHwnd(hwnd);
            newGraphics.DrawRectangle(new Pen(Color.Red, 3), 0, 0, 200, 100);
            newGraphics.Dispose();

It work in the part where the video is not refresh so I put it in the callback loop

                Form1 form1 = new Form1();
                IntPtr hwnd = new IntPtr();
                hwnd = form1.axltmmCaptureCtrl1.Handle;
                Graphics newGraphics = Graphics.FromHwnd(hwnd);
                newGraphics.DrawRectangle(new Pen(Color.Red, 3), 0, 0, 200, 100);
                newGraphics.Dispose();

But it doesn't work at all and the video flux is decelerated
do you have an idea ?
I never work with video before it is interesting but not really easy to understand
Thanks
 
#9 Posted : Monday, October 13, 2008 1:52:56 AM(UTC)
sdecorme

Groups: Registered
Posts: 17


I try to use overlay lib with a capture object like this
_TextOverlay  = (LMVTextOverlay)axltmmCaptureCtrl1.GetSubObject((int)LTMMLib.ltmmCapture_Object.ltmmCapture_Object_SelVideoProcessor);
but it ask me that an error
Exception de HRESULT : 0x80004002 (E_NOINTERFACE)).
what is my error ?
 
#10 Posted : Monday, October 13, 2008 3:44:22 AM(UTC)
sdecorme

Groups: Registered
Posts: 17


Is it possible to add more than 1 text with the overlay text function ?
 
#11 Posted : Monday, October 13, 2008 10:58:29 AM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 764


 sdecorme wrote:
It work geat
I've added a simple function to draw a rectangle in GDI in the btnChangeProperties_Click_1 function

            IntPtr hwnd = new IntPtr();
            hwnd = axltmmPlayCtrl1.Handle;
            Graphics newGraphics = Graphics.FromHwnd(hwnd);
            newGraphics.DrawRectangle(new Pen(Color.Red, 3), 0, 0, 200, 100);
            newGraphics.Dispose();

It work in the part where the video is not refresh so I put it in the callback loop

                Form1 form1 = new Form1();
                IntPtr hwnd = new IntPtr();
                hwnd = form1.axltmmCaptureCtrl1.Handle;
                Graphics newGraphics = Graphics.FromHwnd(hwnd);
                newGraphics.DrawRectangle(new Pen(Color.Red, 3), 0, 0, 200, 100);
                newGraphics.Dispose();

But it doesn't work at all and the video flux is decelerated
do you have an idea ?
I never work with video before it is interesting but not really easy to understand
Thanks


That is because you are drawing on the graphics handle of the control rather than the actual image data.  You  need to create a new bitmap from the information provided in the ReceiveProc callback and draw on that.

 sdecorme wrote:
I try to use overlay lib with a capture object like this
_TextOverlay  = (LMVTextOverlay)axltmmCaptureCtrl1.GetSubObject((int)LTMMLib.ltmmCapture_Object.ltmmCapture_Object_SelVideoProcessor);
but it ask me that an error
Exception de HRESULT : 0x80004002 (E_NOINTERFACE)).
what is my error ?


Have you added the TextOverlay filter with the SelectedVideoProcessors.Add function to the list of selected video processors first?

 sdecorme wrote:
Is it possible to add more than 1 text with the overlay text function ?


Yes, you should be able to add multiple instances of the video overlay filter.  You need to add it multiple times.
 
#12 Posted : Tuesday, October 21, 2008 4:46:42 AM(UTC)
sdecorme

Groups: Registered
Posts: 17


Here is my sample it is not complete because I don't understand how the callback work it is too complex too make simple thing so I use another object to make acquisition and overlay.
All the callback structure is done for player and acquisition
Good luck for people how wants to go this way  , may I can Help you with my small experience.

 

File Attachment(s):
LeadVideoOverlay.rar (221kb) downloaded 45 time(s).
 
#13 Posted : Tuesday, October 21, 2008 6:19:04 AM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 764


Just as a suggestion, you have a lot of hard-coded values that aren't necessarily going to exist on other people's machines (such as the available capture devices).  You should handle those kinds of errors a little differently so that the application will work and not just crash.

What is the problem you were having with the Video Callback?  You are adding the callback and handling the ReceiveProc function properly, but all you're doing is a Debug.Print
 
#14 Posted : Tuesday, October 21, 2008 9:26:16 PM(UTC)
sdecorme

Groups: Registered
Posts: 17


Actually to make my overlay text and drawing it is really simple I 've to do this

private void XXXXXXXXX_OverlayUpdate(object sender, XXXXXXXXX.OverlayUpdateEventArgs e)
   {
   OverlayBitmap ob = XXXXXXXXX.OverlayBitmapAtPath[PathPositions.Device];
   e.overlay.Fill(e.overlay.DropOutColor);  
   // Enable the overlay bitmap for drawing.
   ob.Enable = true;
   if (checkBackColor.Checked)
      {
//back screen activated
      
System.Drawing.Color CouleurFond = System.Drawing.Color.FromArgb(127, 50, 60);
      e.overlay.DrawSolidRect(CouleurFond, 0, 0, XXXXXXXXX.Width, XXXXXXXXX.Height);
      ob.FontBackColor = CouleurFond;   
      
}
   
else
      
{   
      ob.FontBackColor = e.overlay.DropOutColor;
      }
   
//draw my text
   ob.Font = ListBoxItemFont[index, PageEnCours];
   System.Drawing.Color c = System.Drawing.Color.FromArgb(65, 30,127);
   ob.DrawText(c, 30,100,
"OVERLAY TEXT");
   }

As you can see it is really efficient and simple . I think your callback is more efficient but it is too complex for me , I've try to draw like this in the callback function but it doesn't work
Form1 form1 = new Form1();
IntPtr hwnd = new IntPtr();
hwnd = form1.axltmmCaptureCtrl1.Handle;
Graphics newGraphics = Graphics.FromHwnd(hwnd);
newGraphics.DrawRectangle(new Pen(Color.Red, 3), 0, 0, 200, 100);

I've tried to add text as you can see in my code in the BtnAdd_click but the overlay is not refreshed.
I'm not a great c# programmer I'm always looking for the easy way
If you explain me who to make what I need I will modify my sample and make update in the forum

thanks

 

 

 
#15 Posted : Wednesday, October 22, 2008 7:42:26 AM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 764


You need to create a new Graphics object from the information we give you in the ReceiveProc method.  Since you'll have to use Microsoft objects for the drawing, please contact Microsoft regarding how to create a Graphics object with the information we provide.

Why do you have a player control and a capture control on the same form?  What exactly are you hoping to accomplish?  Please explain your goals in more detail so I can try to point you in the right direction.
 
#16 Posted : Wednesday, October 22, 2008 8:17:36 AM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 764


Here's a simple ReceiveProc that shows how to create the Graphics object, draw on it, and then save the image to disk:


public void ReceiveProc(int pData, int lWidth, int lHeight, int lBitCount, int lSize, int bTopDown)
{
    try
    {
        Bitmap bmp = new Bitmap(lWidth, lHeight, lBitCount / 8 * lWidth, PixelFormat.Format32bppRgb, new IntPtr(pData));
        if (bTopDown == 0)
            bmp.RotateFlip(RotateFlipType.RotateNoneFlipY);

        Graphics g = Graphics.FromImage(bmp);

        g.DrawRectangle (new Pen(Brushes.DodgerBlue), new Rectangle(10,10,50,50));

        bmp.Save("d:\\junk folder\\test.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.ToString());
    }
}

 
#17 Posted : Wednesday, October 22, 2008 10:44:06 PM(UTC)
sdecorme

Groups: Registered
Posts: 17


It works thanks but why I can't see it on the live video ?
 
#18 Posted : Thursday, October 23, 2008 3:53:13 AM(UTC)

GregR  
GregR

Groups: Registered, Tech Support, Administrators
Posts: 764


You will need to copy the modified image data back to pData with something like Marshal.Copy.  For details on how to copy image data from a System.Drawing.Bitmap object into a memory buffer, please check out MSDN.
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.218 seconds.