PDA

View Full Version : Frame Drop Count - Option not available



yogaguy74
January 29, 2007, 07:14:21
When running the demo in C# and exploring the control attributes at runtime I get a Option not available exception when quickwatching DeviceCountOfFramesDropped I get the following information below:

base {"Option is not available"} {ICException}
InnerException {"Exception from HRESULT: 0x800A001D"} {COMException}
ErrorCode -2146828259 int

Any suggestions?

Microsoft DV Camera
IC Imaging Control.NET 3.0.3
PCMCIA Firewire Adapter
Canon ZR700


Yogaguy74

Stefan Geissler
January 29, 2007, 09:57:13
Hi Yogaguy74,

This property is only available, while the live video runs (as the documentations says.). You may insert following code:


private void Form1_Load(object sender, EventArgs e)
{
icImagingControl1.Device = icImagingControl1.Devices[0].Name;
icImagingControl1.LiveStart();
int i = icImagingControl1.DeviceCountOfFramesDropped;

}


You can find the documention also at http://www.imagingcontrol.com/support/documentation/dotnet/prop_descICImagingControl_DeviceCountOfFramesDropp ed.htm

yogaguy74
January 30, 2007, 06:59:40
I tried that and I still get the same result. Altered the Save AVI demo code to do a LiveStart() instead of a LiveStop() and break immediately after the LiveStart(). I get the same result.

Stefan Geissler
January 30, 2007, 09:18:18
Hi,

The sample, that I posted above did not work?

yogaguy74
January 30, 2007, 18:39:39
No. That's what confused me as well. Seemed pretty straight forward from the docs but something is askew in my situation and I can't figure out what it is. I'm going to do some more testing tonight but haven't figured out what's going on exactly. Only difference is I had to change Devices[0] to Devices[2] since the device I'm trying to use is the most recently loaded device (LeadTools library installed a couple of "virtual" devices).

The only other avenue I can think of right now is that I've been doing alot of POC'ing with various imaging libraries so tonight I'm going to try uninstalling all libs except IC and work from that.

Any other suggestions? Thanks Stefan.

Stefan Geissler
January 31, 2007, 12:06:37
I guess I have to create an own AVI Capture sample to check this out....

yogaguy74
January 31, 2007, 20:27:49
Sorry about that. Could have posted my sample...
Here is the code behind source for Form1 as I modified from Save timed AVI sample:

Also, another thing I noticed is that the assembly version number for ImagingControl3.dll is 3.0.1.4. I installed trial of 3.0.3. Is this correct? Why are the version numbers out of sync? Thanks again Stefan.



using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace Save_AVI_with_timed_stop
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private TIS.Imaging.ICImagingControl icImagingControl1;
private System.Windows.Forms.Button btnStartCapture;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox txtStopTime;
private System.Windows.Forms.Timer recordTimer;
private System.Windows.Forms.Label lblRecordedTime;
private System.ComponentModel.IContainer components;

public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

//
// TODO: Add any constructor code after InitializeComponent call
//
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.icImagingControl1 = new TIS.Imaging.ICImagingControl();
this.btnStartCapture = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.lblRecordedTime = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.txtStopTime = new System.Windows.Forms.TextBox();
this.recordTimer = new System.Windows.Forms.Timer(this.components);
((System.ComponentModel.ISupportInitialize)(this.i cImagingControl1)).BeginInit();
this.SuspendLayout();
//
// icImagingControl1
//
this.icImagingControl1.DeBayerMode = TIS.Imaging.DeBayerModes.Edgesensing;
this.icImagingControl1.DeBayerStartPattern = TIS.Imaging.DeBayerStartPatterns.BG;
this.icImagingControl1.ImageRingBufferSize = 5;
this.icImagingControl1.LiveDisplayHeight = 480;
this.icImagingControl1.LiveDisplayWidth = 640;
this.icImagingControl1.LiveShowLastBuffer = true;
this.icImagingControl1.Location = new System.Drawing.Point(8, 8);
this.icImagingControl1.Name = "icImagingControl1";
this.icImagingControl1.OverlayBitmapPosition = TIS.Imaging.PathPositions.Device;
this.icImagingControl1.SinkCompatibilityMode = true;
this.icImagingControl1.Size = new System.Drawing.Size(416, 296);
this.icImagingControl1.TabIndex = 0;
//
// btnStartCapture
//
this.btnStartCapture.Location = new System.Drawing.Point(8, 312);
this.btnStartCapture.Name = "btnStartCapture";
this.btnStartCapture.Size = new System.Drawing.Size(88, 24);
this.btnStartCapture.TabIndex = 1;
this.btnStartCapture.Text = "Start Capture";
this.btnStartCapture.Click += new System.EventHandler(this.btnStartCapture_Click);
//
// label1
//
this.label1.Location = new System.Drawing.Point(112, 312);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(88, 24);
this.label1.TabIndex = 2;
this.label1.Text = "Recorded time:";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// lblRecordedTime
//
this.lblRecordedTime.Location = new System.Drawing.Point(200, 312);
this.lblRecordedTime.Name = "lblRecordedTime";
this.lblRecordedTime.Size = new System.Drawing.Size(40, 23);
this.lblRecordedTime.TabIndex = 3;
this.lblRecordedTime.Text = "0s";
this.lblRecordedTime.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label3
//
this.label3.Location = new System.Drawing.Point(304, 312);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(112, 23);
this.label3.TabIndex = 4;
this.label3.Text = "Stop at s";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// txtStopTime
//
this.txtStopTime.Location = new System.Drawing.Point(352, 312);
this.txtStopTime.Name = "txtStopTime";
this.txtStopTime.Size = new System.Drawing.Size(32, 20);
this.txtStopTime.TabIndex = 5;
this.txtStopTime.Text = "10";
this.txtStopTime.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// recordTimer
//
this.recordTimer.Interval = 1000;
this.recordTimer.Tick += new System.EventHandler(this.recordTimer_Tick);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(432, 342);
this.Controls.Add(this.txtStopTime);
this.Controls.Add(this.label3);
this.Controls.Add(this.lblRecordedTime);
this.Controls.Add(this.label1);
this.Controls.Add(this.btnStartCapture);
this.Controls.Add(this.icImagingControl1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.Name = "Form1";
this.Text = "Save AVI with timed stop";
this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.i cImagingControl1)).EndInit();
this.ResumeLayout(false);

}
#endregion

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}

private void Form1_Load(object sender, System.EventArgs e)
{
//icImagingControl1.ShowDeviceSettingsDialog();

//if( !icImagingControl1.DeviceValid )
//{
// Close();
// return;
//}

// without LeadTools installed
//icImagingControl1.Device = icImagingControl1.Devices[0].Name;
// with LeadTools installed
icImagingControl1.Device = icImagingControl1.Devices[2].Name;

icImagingControl1.LiveStart();
System.Threading.ThreadStart start = new System.Threading.ThreadStart(BreakPoint);
start.Invoke();
}

protected void BreakPoint()
{
System.Threading.Thread.Sleep(10000);
MessageBox.Show(string.Format("Number of Dropped Frames = {0}\nNumber of Captured Frames = {1}",
icImagingControl1.DeviceCountOfFramesDropped,
icImagingControl1.DeviceCountOfFramesNotDropped));
}

private void btnStartCapture_Click(object sender, System.EventArgs e)
{
icImagingControl1.LiveStop();
icImagingControl1.AviStartCapture( "video.avi", "DV Video Encoder" );
btnStartCapture.Enabled = false;

recordedTime = 0;
recordTimer.Start();
}
int recordedTime = 0;

private void recordTimer_Tick(object sender, System.EventArgs e)
{
recordedTime += 1;
lblRecordedTime.Text = recordedTime.ToString() + "s";

if( recordedTime >= int.Parse( txtStopTime.Text ) )
{
recordTimer.Stop();

icImagingControl1.AviStopCapture();
icImagingControl1.LiveStart();
btnStartCapture.Enabled = true;
}
}
}
}

Stefan Geissler
February 1, 2007, 09:55:03
Hi,

I tested your sample code, especially the BreakPoint() method. It worked fine on my computer. But I used on of our cameras and not a LeadTools device. I guess in the Leadtools software this dropped frame count is not available. (This is also the text of the exception you have posted.)


The component's current version number is 3.0.1.4, but the IC Imaging Control software package version number is 3.0.3. Sorry for this confusion.

yogaguy74
February 1, 2007, 18:00:44
>> I guess in the LeadTools software this dropped frame count is not available.

Actually that's one of the confusing parts. In LeadTools the frame drop count is available and our client is looking at other approaches because we are getting fairly high loss rates and are looking at using other APIs. The one difference is in the case of LeadTools we are using the LeadTools created virtual device created in Windows for capture instead of the physical device.

I have uninstalled all the other frameworks to no avail. Problem still happens. I'm wondering if it could be my hardware combination:

SIIG FireWire 800 3-Port CardBus (PCMCIA adapter)
Canon ZR700 DV camera
Dell Laptop running Win XP Pro sp2

Do you know of any other way to verify the number of frames being dropped during capture of a fixed length clip? I can't recommend an approach for our client unless I can validate the output. Thanks again.



Mike

Stefan Geissler
February 2, 2007, 09:12:13
Mike,

I have no personal experiences with Leadtools, thus I wont say anything about their drivers.

But I have some very personal experiences with DELL laptops. They have very often problems with data loss through USB and FireWire. I recommend to set the power setting to AC (i mean not battery :-) ) and power the laptop through external power (even not battery too :-)) )

In this case that the data transfer from FireWire to memory through DMA is interrupted, the frame drop counter wont give you exact informations.

I suggest to run your software on a desktop computer for testing.

yogaguy74
February 5, 2007, 18:39:18
Unfortunately I am a traveling consultant and this is not my primary customer therefore I do not have a desktop to test this with but we have had the same issue occurring on a desktop host at the client site. I really believe (in the case of LT) that it is a software problem and their algorithm overwrites frames before they have been serialized but their support has been "uncooperative" therefore I am proposing alternatives to the client.

I was looking at IC .NET because of the configurable image buffer but have been unable to validate that there is not frame loss. The most significant information I have been able to determine is using VirtualDub to determine the number of frames and the actual runtime of the clip recorded and then calculate the fps but this is average therefore technically there still may be frame loss (from this analysis the frame rate on my laptop is 29.96~29.97 fps for a capture of RGB32 720 rez at 29.97 fps according to VirtualDub).

Thanks for all the help. I think I've done as much as I can with the hardware that I have access to. Now it's time to do some other prototyping and then make a suggestion to our client.

I'm still leaning towards this being a hardware issue that is causing the API to fail but I'm not sure how IC tracks lost frames so I can't confirm. The good thing about this is that my test environment does not accurately represent the clients environment (Panasonic cam, desktop PC, primary bus firewire... instead of Canon cam, laptop PC, pcmcia firewire).

Stefan Geissler
February 6, 2007, 18:14:48
The best way to to check for dropped frames would be the use of a frame filter directly behind the device. The frame times (sample times) can be checked from frame to the next frame. If the time difference is bigger than twice of the frame rate time, then a frame was dropped.