private void ThreadProc() { uint StrAddr = 0; uint Size_Byte = 0; hEvent.Handle = Event; // Set the Handle to the event from while (true) { hEvent.WaitOne(); hEvent.Reset(); if (ISR_ON == false) //don't use "while(ISR_ON)" { break; //because it will capture 2 pictures in one_shot mode by disconstruct } Angelo.AngeloRTV_Get_Frame(PortNo, ref StrAddr, ref width, ref height, ref Size_Byte); HOperatorSet.GenEmptyObj(out ho_Image); ho_Image.Dispose(); // HOperatorSet.GenImage1(out ho_Image, "byte", (int)width, (int)height, (int)StrAddr); HTuple Width1, Height1; HOperatorSet.GenImageInterleaved(out ho_Image, (int)StrAddr, "bgr", width, height, 0, "byte", width, height, 0, 0, -1, 0); //获取图像大小 HOperatorSet.GetImageSize(ho_Image, out Width1, out Height1); //显示全图 //以适应窗口方式显示图像 HOperatorSet.SetPart(this.hWindowControl1.HalconID, 0, 0, Height1 - 1, Width1 - 1); HOperatorSet.DispObj(ho_Image, this.hWindowControl1.HalconWindow); monitorTest(signal.TestBegin); } }
private void CallBackProc(IntPtr BufferAddress, ushort PortNo) { uint StrAddr = 0; uint Size_Byte = 0; Angelo.AngeloRTV_Get_Frame(PortNo, ref StrAddr, ref width, ref height, ref Size_Byte); HOperatorSet.GenEmptyObj(out m_Image); m_Image.Dispose(); HTuple Width1, Height1; HOperatorSet.GenImageInterleaved(out m_Image, (int)StrAddr, "bgr", width, height, 0, "byte", width, height, 0, 0, -1, 0); //获取图像大小 HOperatorSet.GetImageSize(m_Image, out Width1, out Height1); //显示全图 //以适应窗口方式显示图像 HOperatorSet.SetPart(this.hWindowControl1.HalconID, 0, 0, Height1 - 1, Width1 - 1); HOperatorSet.DispObj(m_Image, this.hWindowControl1.HalconWindow); }