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 : Friday, July 24, 2009 5:17:11 AM(UTC)
mauriziom

Groups: Registered
Posts: 3


I need to capture a frame from an avi file, which is at the resolution 1344x1032.

I realized that the size of the picture I get is not the same as the size of the original movie, and it depends on the resolution of the video!
At a high resolution everything works fine. For example, at 1920x1200 the extracted frame has size 1344x1032.
But at lower video resolution, the picture is somehow resized at the res of the graphic card. E.g at 1280x1024, it is reduced 1276x1000.
I have a windows vista system, but the same happens on XP. The multimedia leadtools version is 15.1

Please find attached a simple code with the operations I perform to extract the frame.
 

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 : Friday, July 24, 2009 5:19:43 AM(UTC)
mauriziom

Groups: Registered
Posts: 3


Sorry this is the code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Leadtools;
using Leadtools.ImageProcessing;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Threading;
using System.Drawing;


namespace TestHiResAvi
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

public LTMMLib.ltmmPlay ltplay;

private void button1_Click(object sender, EventArgs ev)
{
try
{
LTMMLib.ltmmSupportManagerClass C = new LTMMLib.ltmmSupportManagerClass();
if (C.IsSupportLocked(1)) C.UnlockSupport(1, "*********************");

ltplay = new LTMMLib.ltmmPlayClass() as LTMMLib.ltmmPlay;
ltplay.sourcefile = this.textBox1.Text;
ltplay.CurrentFramePosition = 0;
ltplay.StillTap = 0; // test 0 and 1
ltplay.VideoWindowSizeMode = LTMMLib.ltmmSizeMode.ltmmNormal; // test normal and Fit


}
catch (Exception e)
{
string Msg = System.DateTime.Now.ToLongTimeString() + " -- " + e.Message;
if (e.InnerException != null) Msg += " -- inner ex " + e.InnerException.Message;
if (e.Source != null) Msg += " -- source " + e.Source;
if (e.StackTrace != null) Msg += " -- stack " + e.StackTrace;
MessageBox.Show(Msg);
Application.Exit();
}
Image Imm = GetMMFrame(0);
this.pictureBox1.Image = Imm;
this.textBox2.Text = "Width = " + Imm.Width + " Height = " + Imm.Height;
}

Image GetMMFrame(int nFrame)
{

ltplay.Stop();
ltplay.CurrentFramePosition = nFrame;
stdole.IPictureDisp pic;

try
{
pic = ltplay.GetStillPicture(20000);
}
catch (Exception e)
{
System.Diagnostics.Debug.Write(e.Message);
return null;
}
Image image1 = System.Drawing.Image.FromHbitmap(new IntPtr(pic.Handle), new IntPtr(pic.hPal));
return image1;
}
}
}
 
#3 Posted : Sunday, July 26, 2009 6:04:12 AM(UTC)

Adnan Ismail  
Guest

Groups: Guests
Posts: 3,022

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

When using one of the still capturing methods, the resulting image will depend on the video rendering resolution which could affect the quality of the output file.

If you want the image to be rendered at its original size, insert one of the LEADTOOLS video processing filters into the control. You don't have to enable the processing feature of that filter. You only need to add it to the internal filter graph.

 
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.092 seconds.