sufree
2022-08-03 22:25
VM算法平台

相机采图Bayer BG8转换成RGB8格式后赋值给图像源,为什么好多条状图形不正常,帮看一下

[图片][图片]

左图是采集的图像,右图是转换后赋值给图像源SDK的,好多条状,怎么回事


 Dim imageS As ImageSourceModuleTool = CType(VmSolution.Instance("流程1.图像源1"), ImageSourceModuleTool)
While (m_bIsGrabbing)

Dim nRet = dev(0).MV_CC_GetImageBuffer_NET(stFrameOut, 1000)
If MyCamera.MV_OK = nRet Then

m_ReadWriteLock.AcquireWriterLock(System.Threading.Timeout.Infinite)
If stFrameOut.stFrameInfo.nFrameLen > m_nBufSizeForDriver Then
m_nBufSizeForDriver = stFrameOut.stFrameInfo.nFrameLen
ReDim m_pBufForDriver(m_nBufSizeForDriver)
End If

ReDim m_pBufForDriver(stFrameOut.stFrameInfo.nFrameLen)
m_stFrameInfo = stFrameOut.stFrameInfo
Marshal.Copy(stFrameOut.pBufAddr, m_pBufForDriver, 0, stFrameOut.stFrameInfo.nFrameLen)
m_ReadWriteLock.ReleaseWriterLock() ' 释放写入锁定

'**************************************************************************************************************************************
'转换图像格式
nBufForConvertSzie = stFrameOut.stFrameInfo.nFrameLen * nChannelNum
If pBufForConvert = IntPtr.Zero Then
pBufForConvert = Marshal.AllocHGlobal(nBufForConvertSzie)
End If

stConvertParam.nHeight = stFrameOut.stFrameInfo.nWidth
stConvertParam.nWidth = stFrameOut.stFrameInfo.nHeight
stConvertParam.pSrcData = stFrameOut.pBufAddr
stConvertParam.nSrcDataLen = stFrameOut.stFrameInfo.nFrameLen
stConvertParam.enSrcPixelType = stFrameOut.stFrameInfo.enPixelType
stConvertParam.enDstPixelType = MyCamera.MvGvspPixelType.PixelType_Gvsp_RGB8_Packed
stConvertParam.pDstBuffer = pBufForConvert
stConvertParam.nDstBufferSize = nBufForConvertSzie
nRet = dev(0).MV_CC_ConvertPixelType_NET(stConvertParam)
'**************************************************************************************************************************************
'赋值图像给流程图像源
ReDim m_byteImageBuffer(nBufForConvertSzie)
Marshal.Copy(pBufForConvert, m_byteImageBuffer, 0, nBufForConvertSzie)
stImageData.ImageData = m_byteImageBuffer
stImageData.DataLen = nBufForConvertSzie 'stConvertParam.nDstBufferSize
stImageData.Width = stConvertParam.nHeight
stImageData.Height = stConvertParam.nWidth
stImageData.Pixelformat = MyCamera.MvGvspPixelType.PixelType_Gvsp_RGB8_Packed
imageS.SetImageData(stImageData)

大神抽空给看下哪里有问题

2022-08-06 17:57发布追问
  • 34
  • 0
  • 分享

暂无回答

请升级浏览器版本

您正在使用的浏览器版本过低,请升级最新版本以获得更好的体验。

推荐使用以下浏览器