Example #1
0
        void CameraDDeal()
        {
            int idx = 3;

            //  HObject Obj;
            //  HOperatorSet.GenEmptyObj(out Obj);

            while (true)
            {
                mEvt_Cam[idx].WaitOne();
                try
                {
                    Obj[idx].Dispose();
                    GrabImage.Grab(out Obj[idx], idx);
                    global.GetIns().res[idx]      = "T4," + ImageOperate.Check_gear(Obj[idx], this.Cam4_Disp.HalconID, INI.gear_roi.imgthreshold, INI.gear_roi.threshold, ImageOperate.Gear_Model) + ",";
                    global.GetIns().GotImage[idx] = 1;
                }
                catch (HalconException ex)
                {
                    try
                    {
                        HOperatorSet.ReadImage(out Obj[idx], @"D:\img\4.bmp");
                        global.GetIns().GotImage[idx] = 1;
                    }
                    catch (HalconException exe)
                    {
                        global.GetIns().res[idx]      = "T4," + "22,";
                        global.GetIns().GotImage[idx] = 0;
                        Console.WriteLine(ex.ToString());
                    }
                }
            }
        }