Ejemplo n.º 1
0
        public void xfer_XferNotify(object sender, SapXferNotifyEventArgs argsNotify)
        {
            DateTime StartTime = DateTime.Now;


            //1.计算图像采集时间
            if (firstFrame)
            {
                firstFrame = false;
                start      = DateTime.Now.Second + (float)DateTime.Now.Millisecond / 1000;
                return;
            }

            end      = DateTime.Now.Second + (float)DateTime.Now.Millisecond / 1000;
            duration = end - start;
            start    = end;
            Console.WriteLine("图像采集时间:" + duration.ToString() + "秒\n");
            Model.AcquisionImageTime[AcquisionImageCount] = duration;



            //2.图像缓存转化为halcon图像类型
            int SubImageWidth  = 13384;
            int SubImageHeight = 100;//7635


            IntPtr dataAddress = IntPtr.Zero;
            bool   Flag        = m_Buffers.GetAddress(out dataAddress);

            if (!Flag)
            {
                MessageBox.Show("图像缓存获取失败!");
            }

            AutoMachineDAL.DAL Dal = new AutoMachineDAL.DAL();
            Model.RawImage = Dal.ImageProcessObject.ImagePtrToHobject(SubImageWidth, SubImageHeight, ref dataAddress);
            HOperatorSet.DispObj(Model.RawImage, Model.MainUI_Camera_WindowID);

            if (Model.SaveImageFlag)
            {
                SaveImage(Model.RawImage, true);
            }


            //CombinImage(CommonModuleClass.RawImage, SubImageWidth, SubImageHeight);


            //5.计算图像转换时间
            DateTime EndTime    = DateTime.Now;
            TimeSpan ts         = EndTime - StartTime;
            double   difference = ts.TotalSeconds; //秒单位

            Console.WriteLine("图像转换时间:" + difference.ToString() + "秒\n");
        }
Ejemplo n.º 2
0
        private AutoMachineDAL.DAL CutMachineDal;                                 //数据访问层

        public CutMachineBLL()
        {
            CutMachineDal = new AutoMachineDAL.DAL();
        }