How can i save to the hard disk also the next 5 or 10 frames after the first frame its saving ?

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<pre class="prettyprint int ISampleGrabberCB.BufferCB(double sampleTime, IntPtr pBuffer, int bufferLen)
{
if (Form1.ExtractAutomatic == true)
{
using (var bitmap = new Bitmap(_width, _height, _width * 3, PixelFormat.Format24bppRgb, pBuffer))
{
if (!this.Secondpass)
{
long[] HistogramValues = Form1.GetHistogram(bitmap);
long t = Form1.GetTopLumAmount(HistogramValues, 1000);
Form1.averagesTest.Add(t);
}
else
{
//this is the changed part
if (_frameId > 0)
{
if (Form1.averagesTest[_frameId] / 1000.0 - Form1.averagesTest[_frameId - 1] / 1000.0 > 150.0)
{
bitmap.RotateFlip(RotateFlipType.Rotate180FlipX);
bitmap.Save(Path.Combine(_outFolder, _frameId.ToString("D6") + ".bmp"));
}
}
}

_frameId++;

//let only report each 100 frames for performance
if (_frameId % 100 == 0)
OnProgressChanged(_frameId);
}
}[/code]
In the if (Form1.averagesTest[_frameId] / 1000.0 - Form1.averagesTest[_frameId - 1] / 1000.0 > 150.0) im saving each time a single frame/image to the hard disk and again and so on.
I want that after he saved one frame/image it will also save the next 5 or 10 frames/images that are right after the one he just saved.

For example it did the IF and jumped and decide to save frame/image number 003432.bmp i want it to save now also the frames/images 003433,003434,003435,003436 and lets say after he save 4 frames after the first one(003432) it will move to the next one will
do the IF again and if its entering it will save the image as it is now and the next 4 or 5 after the one he just saved.

Since sometimes a lightning is built with more then one frame so i want to give the user the option to save lets say another 5 frames after the one it just saved. This is the automatic mode i mean its saving the frames automatic to the hard disk each frame
that containing a lightning he save it then he keep moving over the images on hard disk and then again the next frame with a lightning he save it. I want that it will save it and the next 4 or 5 frames after it.

Thanks.
<hr class="sig danieli

View the full article
 
Back
Top