Reference to jpegvideosource.get

How to instantiate​ an object for jpegvideosource.get please? Image attached.

Tom​

You must use the constructor and must call the Init() method. I would like to recommend that you take a look at the CameraStreamResolution sample source code, the GetRes() method must be what you need..

http://doc.developer.milestonesys.com/html/index.html?base=miphelp/class_video_o_s_1_1_platform_1_1_data_1_1_j_p_e_g_video_source.html&tree=tree_search.html?search=jpegvideosource

http://doc.developer.milestonesys.com/html/index.html?base=samples/camerastreamresolution.html&tree=tree_search.html?search=jpegvideosource

I see the solution with getres() for live. Regarding get() to return list of jpeg​, I see how to reference a specific indice of ‘new1.get()[0], as shown in screenshot’. Not having luck with writing list< jpegdata > = new1.get() as list however. Is there an example of generating a reference to a jpeg list sequence please?

Aim is 'what is fastest means to process a series of images, for example 20 frames in specific start end time 2 min window. Would serializing, building with get()[0] indice ​in loop be similar performance as one call to return list of increments between start and end time through get() please? A goal is to not write to disk until 20 images are image processed in batch and then write once one file. I think defining time of frame in memorystream to return jpeg may be an alternative if reason of significant faster performance exists.

Tom​

This code (modified within the CameraStreamResolution sample) works for me.

static void GetRes()
{
    var jpegSource = new JPEGVideoSource(_camera);
    jpegSource.Init();
    jpegSource.Height = 0;
    jpegSource.Width = 0;
    Console.WriteLine("Asking for recorded images from camera {0} ",
        _camera.Name);
 
    DateTime startTime = DateTime.UtcNow + TimeSpan.FromSeconds(-2);
    int i = 0;
    List<object> js = jpegSource.Get(startTime, TimeSpan.FromSeconds(2), 4);
    foreach(var j in js)
    {
        i++;
        SaveImage(j as JPEGData, i.ToString());
    }
}
 
static void SaveImage(JPEGData JpData, string num)
{
    int len = JpData.Bytes.GetLength(0);
    Byte[] jpeg = new Byte[len];
    Array.Copy(JpData.Bytes, 0, jpeg, 0, len);
    string fname = $@"C:\TEST\test{num}.jpg";
    System.IO.File.WriteAllBytes(fname, jpeg);
    Console.WriteLine("Written to disk. " + fname);
}

Solution works great as described, however upon editing to 20 jpegs over two minutes there is a Timeout waiting for move operation response.​

Tom​

Update, error is resolved. All is well.​