private static Bitmap GET_BITMAP(IntPtr hIRDX) { IntPtr pbitsImage = new IntPtr(); IntPtr bmiImage = new IntPtr(); ushort width = 0, height = 0; if (DIASDAQ.DDAQ_IRDX_IMAGE_GET_BITMAP(hIRDX, ref width, ref height, out pbitsImage, out bmiImage) != DIASDAQ.DDAQ_ERROR.NO_ERROR) { return(null); // failure } MethodInfo mi = typeof(Bitmap).GetMethod("FromGDIplus", BindingFlags.Static | BindingFlags.NonPublic); if (mi == null) { return(null); // permission problem } IntPtr pBmp = IntPtr.Zero; int status = DIASDAQ.GDIPLUS_GdipCreateBitmapFromGdiDib(bmiImage, pbitsImage, out pBmp); if ((status == 0) && (pBmp != IntPtr.Zero)) { return((Bitmap)mi.Invoke(null, new object[] { pBmp })); // success } else { return(null); // failure } }
private void button4_Click(object sender, EventArgs e) { if (DIASDAQ.DDAQ_DEVICE_GET_IRDX(m_nNumDetectDevices, ref hIRDX) != DIASDAQ.DDAQ_ERROR.NO_ERROR) { return; } if (DIASDAQ.DDAQ_IRDX_PIXEL_GET_SIZE(hIRDX, ref pSizeX, ref pSizeY) != DIASDAQ.DDAQ_ERROR.NO_ERROR) { return; } //ushort numpi = pSizeX; uint numPix = (uint)pSizeX * pSizeY; bufSize = (uint)numPix * sizeof(float); pFrameBuffer = new float(); //Marshal.FreeHGlobal(handle); //------------------------------------------------------------------- //IntPtr hirdx = new IntPtr(); //string str = "H:\\PyroSoftM\\PyroSoftM\\POSCO\\saving_1.irdx"; //DIASDAQ.DDAQ_IRDX_FILE_OPEN_READ(str, false, ref hIRDX); //Bitmap bmp = GET_BITMAP(hIRDX); //bmp = new Bitmap((Image)bmp, new Size(pictureBox1.Width, pictureBox1.Height)); //pictureBox1.Image = (Image)bmp; //---------------------------------------------------------------------- }
private void button3_Click(object sender, EventArgs e) { //if (m_nNumDetectDevices > 0) //{ // textBox1.Text = getIDString(1); //} //----------------------------------------- //DIASDAQ.DDAQ_SET_TEMPPRECISION(); //DIASDAQ.DDAQ_IRDX_OBJECT_SET_EMISSIVITY(); //DIASDAQ.DDAQ_IRDX_OBJECT_SET_TRANSMISSION(); //DIASDAQ.DDAQ_IRDX_PALLET_SET_BAR(); //DIASDAQ.DDAQ_IRDX_SCALE_SET_MINMAX(); //DIASDAQ.DDAQ_IRDX_PALLET_SET_ISOTHERM(); //DIASDAQ.DDAQ_IRDX_FILE_GET_NUMDATASETS(); //DIASDAQ.DDAQ_IRDX_FILE_GET_CURDATASET(); //DIASDAQ.DDAQ_IRDX_DEVICE_GET_IDSTRING(); //DIASDAQ.DDAQ_IRDX_DEVICE_GET_ID(); //DIASDAQ.DDAQ_IRDX_DEVICE_GET_DETECTORTEMP(); //DIASDAQ.DDAQ_IRDX_DEVICE_GET_CAMERATEMP(); //DIASDAQ.DDAQ_IRDX_PIXEL_GET_SIZE(); //DIASDAQ.DDAQ_IRDX_ACQUISITION_GET_TIMESTAMP(); //DIASDAQ.DDAQ_IRDX_DEVICE_GET_MRANGEMINMAX(); //DIASDAQ.DDAQ_IRDX_DEVICE_GET_INTERNALFPS(); //DIASDAQ.DDAQ_IRDX_ACQUISITION_GET_AVERAGING(); //----------------------------------------- DIASDAQ.DDAQ_ERROR error = DIASDAQ.DDAQ_DEVICE_DO_UPDATEDATA(m_nNumDetectDevices); if (error != DIASDAQ.DDAQ_ERROR.NO_ERROR) { return; } if (DIASDAQ.DDAQ_IRDX_PIXEL_GET_DATA(hIRDX, ref pFrameBuffer, bufSize) != 0) { Bitmap bmp = GET_BITMAP(hIRDX); //bmp = new Bitmap((Image)bmp, new Size(picBox.Width, picBox.Height)); pictureBox1.Image = (Image)bmp; } }
private string getIDString(uint DevNo) { uint nResult; byte[] pBuf = new byte[64]; char[] pID = new char[64]; nResult = DIASDAQ.DDAQ_DEVICE_GET_IDSTRING(1, pBuf, 64); for (int i = 0; i < 64; i++) { pID[i] = (char)pBuf[i]; } return(new string(pID)); }
private void button2_Click(object sender, EventArgs e) { //UseWaitCursor(); Cursor.Current = Cursors.WaitCursor; m_nNumDetectDevices = DIASDAQ.DDAQ_DEVICE_DO_DETECTION(); if (m_nNumDetectDevices <= 0 || m_nNumDetectDevices > 32 || DIASDAQ.DDAQ_DEVICE_DO_OPEN(m_nNumDetectDevices, null) != DIASDAQ.DDAQ_ERROR.NO_ERROR) { return; } Cursor.Current = Cursors.Default; if (m_nNumDetectDevices > 0) { MessageBox.Show("디바이스 연결 성공"); } }
private void button1_Click_1(object sender, EventArgs e) { DIASDAQ.DDAQ_ERROR error = DIASDAQ.DDAQ_IRDX_FILE_SET_CURDATASET(hIRDX, img_step); img_step++; }