public static int SnapThreadCallback(int m_iCam, ref Byte pbyBuffer, ref tDSFrameInfo sFrInfo) { frames++; int pBmp24 = Camera.CameraISP(m_iCam, ref pbyBuffer, ref sFrInfo); Camera.CameraDisplayRGB24(m_iCam, pBmp24, ref sFrInfo); return 0; }
private static void HandleCapture(Image <Bgr, Byte> img, int pBmp24, ref tDSFrameInfo sFrInfo) { if (_captureState == CaptureState.NO_CAPTURE) { return; } XCamera cam = XCamera.GetInstance(); //HandleSingleCapture(img, cam); //HandleMutiCapture(img, cam); HandleFluCapture(img, cam); HandleVideoCapture(pBmp24, ref sFrInfo); }
private static void HandleVideoCapture(int pBmp24, ref tDSFrameInfo sFrInfo) { try { if (_captureState == CaptureState.VIDEO_CAPTURING) { if (!XCamera.GetInstance().RecordFrame(pBmp24, ref sFrInfo)) { StopVideoCapture(); } } } catch (System.Exception ex) { _logger.Error(ex.Message); } }
/// <summary> /// 相机回调函数 /// </summary> /// <param name="m_iCam"></param> /// <param name="pbyBuffer"></param> /// <param name="sFrInfo"></param> /// <returns></returns> private static int SnapThreadCallback(int m_iCam, ref Byte pbyBuffer, ref tDSFrameInfo sFrInfo) { try { int pBmp24 = XCamera.CameraISP(m_iCam, ref pbyBuffer, ref sFrInfo); //-------- int width = Convert.ToInt32(sFrInfo.uiWidth); int height = Convert.ToInt32(sFrInfo.uiHeight); frameWidth = width; frameHeight = height; int stride = width * 3; Image <Bgr, Byte> _frameImage = new Image <Bgr, Byte>(width, height, stride, (IntPtr)(pBmp24)); HandleCapture(_frameImage, pBmp24, ref sFrInfo); MarkFrame(_frameImage); //--------- if (!_isCustomDrawing) { //test code 原先刷新帧图像的方法 emDSCameraStatus status = XCamera.CameraDisplayRGB24(m_iCam, pBmp24, ref sFrInfo); //尝试新的方法 //imageBox.Image = _frameImage; } else { imageBox.Image = _frameImage; } return(0); } catch (System.Exception ex) { _logger.Error(ex.Message); return(-1); } }
public static extern int CameraISP(int m_iCameraID, ref Byte pbyRAW, ref tDSFrameInfo psFrInfo);
public static extern emDSCameraStatus CameraDisplayRGB24(int m_iCameraID, int pbyRGB24, ref tDSFrameInfo psFrInfo);
public static extern emDSCameraStatus CameraSaveBMPFile(int iCameraID, String lpszFileName, int pbyRGB24, ref tDSFrameInfo psFrInfo);
public static extern emDSCameraStatus CameraRecordFrame(int m_iCameraID, int pbyRGB, ref tDSFrameInfo psFrInfo);