Example #1
0
        // Several pictures extracted by index
        internal static object[] getSamples(List <string> folders, List <int> indexes, List <PcPhysicalPoint> locations, List <System.Drawing.Point> sizes)
        {
            try
            {
                using (IPcLink link = HPPC.CreateLink())
                {
                    object[] returned;
                    using (IPcMoment moment = link.CaptureMoment())
                    {
                        IPcPicture picture  = link.ExtractPicture(moment);
                        IPcOutline outlines = link.ExtractOutline(moment);

                        returned = PictureHandling.SaveSamples(picture, outlines, folders, indexes, locations, sizes);
                        outlines.Dispose();
                        picture.Dispose();
                        moment.Dispose();
                    }
                    link.Dispose();
                    return(returned);
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine("\t\t*****An error occurred*****\n\n{0}{1}\n\nExit now, or this console will automatically exit in 15 seconds.", ToolBox.TimeStamp(), exception.Message);
                ToolBox.AppExceptionExit();
                return(null);
            }
        }
Example #2
0
        // Several pictures extracted by index
        internal static List <Image> getSamples(List <string> folders, List <int> indexes)
        {
            try
            {
                using (IPcLink link = HPPC.CreateLink())
                {
                    using (IPcMoment moment = link.CaptureMoment())
                    {
                        IPcPicture picture = link.ExtractPicture(moment);

                        List <Image> img = PictureHandling.SaveSamples(picture, folders, indexes);
                        return(img);
                    }
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine("\t\t*****An error occurred*****\n\n{0}{1}\n\nExit now, or this console will automatically exit in 15 seconds.", ToolBox.TimeStamp(), exception.Message);
                ToolBox.AppExceptionExit();
                return(null);
            }
        }