void InitCam(int CamID) { //if opened before, close now if (FuEyeCam.IsOpen()) { FuEyeCam.ExitCamera(); FreeImages(); } //open a camera if (FuEyeCam.InitCamera(CamID, Handle.ToInt32()) != uEye.IS_SUCCESS) { FHost.Log(TLogType.Error, "Failed to initialize uEyCam, ID: " + CamID); return; } // check for image size uEye.SENSORINFO sensorInfo = new uEye.SENSORINFO(); FuEyeCam.GetSensorInfo(ref sensorInfo); int x = sensorInfo.nMaxWidth; int y = sensorInfo.nMaxHeight; FuEyeCam.SetImageSize(x, y); FWidth = x; FHeight = y; // alloc images FuEyeCam.ClearSequence(); int nLoop = 0; for (nLoop = 0; nLoop < IMAGE_COUNT; nLoop++) { // alloc memory FuEyeCam.AllocImageMem(x, y, FBits, ref FuEyeImages[nLoop].pMemory, ref FuEyeImages[nLoop].MemID); // add our memory to the sequence FuEyeCam.AddToSequence(FuEyeImages[nLoop].pMemory, FuEyeImages[nLoop].MemID); // set sequence number FuEyeImages[nLoop].nSeqNum = nLoop + 1; } FuEyeCam.SetColorMode(FColorMode); FuEyeCam.EnableMessage(uEye.IS_FRAME, this.Handle.ToInt32()); UpdateInfos(); // free image if (Preview.Image != null) { Preview.Image.Dispose(); Preview.Image = null; } // capture a single image FuEyeCam.CaptureVideo(uEye.IS_WAIT); Refresh(); }
public bool GetSensorInfo(ref string sensorname) { uEye.SENSORINFO pSensorInfo = new uEye.SENSORINFO(); if (m_uEye.GetSensorInfo(ref pSensorInfo) == uEye.IS_SUCCESS) { sensorname = pSensorInfo.strSensorName; return(true); } return(false); }
private void UpdateInfos() { string info; int ver = uEye.GetDLLVersion(); info = String.Format("uEye SDK Version: {0}.{1}.{2}", (ver >> 24), (ver >> 16 & 0xff), (ver & 0xffff)); int nrOfCameras = 0; uEye.GetNumberOfCameras(ref nrOfCameras); info += "\n" + String.Format("Connected cameras: {0}", nrOfCameras); // camera infos if (FuEyeCam.IsOpen()) { // Sensorinfo uEye.SENSORINFO sensorInfo = new uEye.SENSORINFO(); FuEyeCam.GetSensorInfo(ref sensorInfo); info += "\n" + "Sensor: " + sensorInfo.strSensorName; // Camerainfo uEye.CAMINFO cameraInfo = new uEye.CAMINFO(); FuEyeCam.GetCameraInfo(ref cameraInfo); info += "\n" + "CameraInfo:"; info += "\n" + " SerNo: " + cameraInfo.SerNo; info += "\n" + " Date: " + cameraInfo.Date; info += "\n" + " Version: " + cameraInfo.Version; info += "\n" + String.Format(" Camera ID: {0}", cameraInfo.id); // Memory board query if (FuEyeCam.IsMemoryBoardConnected()) { info += "\n" + "Memoryboard connected"; } else { info += "\n" + "No Memoryboard connected"; } } FInfoPin.SetString(0, info); }
public bool Open(int bin_mode) // binning parameter as input { // if opened before, close now if (m_uEye.IsOpen()) { m_uEye.ExitCamera(); m_bIsConnected = false; } //if (bin_mode == (uEye.IS_BINNING_2X_HORIZONTAL | uEye.IS_BINNING_2X_VERTICAL)) //{ // local_bin_mode = bin_mode; m_uEye.SetBinning(bin_mode); //} // open a camera int nRet = m_uEye.InitCamera(0, hWindow.ToInt32()); if (nRet == uEye.IS_STARTER_FW_UPLOAD_NEEDED) { /************************************************************************************************/ /* */ /* If the camera returns with "IS_STARTER_FW_UPLOAD_NEEDED", an upload of a new firmware */ /* is necessary. This upload can take several seconds. We recommend to check the required */ /* time with the function is_GetDuration(). */ /* */ /* In this case, the camera can only be opened if the flag "IS_ALLOW_STARTER_FW_UPLOAD" */ /* is "OR"-ed to m_hCam. This flag allows an automatic upload of the firmware. */ /* */ /************************************************************************************************/ uint nUploadTime = 25000; m_uEye.GetDuration(uEye.IS_SE_STARTER_FW_UPLOAD, ref nUploadTime); String Str; Str = "This camera requires a new firmware. The upload will take about " + nUploadTime / 1000 + " seconds. Please wait ..."; //STRING_uEYE_075 //System.Windows.Forms.MessageBox.Show(Str, Globals.languageResource.GetString("STRING_3nethra")); nRet = m_uEye.InitCamera(0 | uEye.IS_ALLOW_STARTER_FW_UPLOAD, hWindow.ToInt32()); } if (nRet != uEye.IS_SUCCESS) { //System.Windows.Forms.MessageBox.Show("Camera initialization failed", "3nethra"); //return false; // System.Windows.Forms.MessageBox.Show("Camera not connected, connect camera and relaunch the application", "3nethra"); IsCameraConnected = false; return(false); } // check for image size uEye.SENSORINFO sensorInfo = new uEye.SENSORINFO(); //m_uEye.SetTopoFlashMode(); m_uEye.GetSensorInfo(ref sensorInfo); m_uEye.SetBinning(bin_mode); AllocateMemory(); m_uEye.EnableMessage(uEye.IS_FRAME, hWndProc.ToInt32()); m_uEye.EnableMessage(uEye.IS_NEW_DEVICE, hWndProc.ToInt32()); m_uEye.EnableMessage(uEye.IS_DEVICE_REMOVED, hWndProc.ToInt32()); m_uEye.EnableMessage(uEye.IS_UEYE_MESSAGE, hWndProc.ToInt32()); // m_uEye. // free image //if (liveDisplayWindow.Image != null) //{ // liveDisplayWindow.Image.Dispose(); // liveDisplayWindow.Image = null; //} // capture a single image m_uEye.FreezeVideo(uEye.IS_WAIT); m_bIsConnected = true; //Send event in case handlers have been hooked if (StatusChanged != null) { StatusChanged(this, new EventArgs()); } return(true); }