需要转换,参考海康MVS的例程。
- MyCamera.MV_PIXEL_CONVERT_PARAM stPixelConvertParam = new MyCamera.MV_PIXEL_CONVERT_PARAM();
- stPixelConvertParam.pSrcData = stFrameOut.pBufAddr;//源数据
- stPixelConvertParam.nWidth = stFrameOut.stFrameInfo.nWidth;//图像宽度
- stPixelConvertParam.nHeight = stFrameOut.stFrameInfo.nHeight;//图像高度
- stPixelConvertParam.enSrcPixelType = stFrameOut.stFrameInfo.enPixelType;//源数据的格式
- stPixelConvertParam.nSrcDataLen = stFrameOut.stFrameInfo.nFrameLen;
- stPixelConvertParam.nDstBufferSize = (uint)nImageBufSize;
- stPixelConvertParam.pDstBuffer = pImageBuf;//转换后的数据
- stPixelConvertParam.enDstPixelType = MyCamera.MvGvspPixelType.PixelType_Gvsp_RGB8_Packed;
- nRet = device.MV_CC_ConvertPixelType_NET(ref stPixelConvertParam);//格式转换
- if (MyCamera.MV_OK != nRet)
- {
- break;
- }
- pTemp = pImageBuf;
- try
- {
- HOperatorSet.GenImageInterleaved(out Hobj, (HTuple)pTemp, (HTuple)"rgb", (HTuple)stFrameOut.stFrameInfo.nWidth, (HTuple)stFrameOut.stFrameInfo.nHeight, -1, "byte", 0, 0, 0, 0, -1, 0);
- }
- catch (System.Exception ex)
- {
- MessageBox.Show(ex.ToString());
- break;
- }
复制代码
|