小转盘基本都能出列
This commit is contained in:
@ -57,7 +57,7 @@ namespace DH.Devices.Camera
|
||||
throw new Exception($"Create device failed:{nRet:x8}");
|
||||
}
|
||||
|
||||
nRet = DVPCamera.dvpSetTargetFormat(m_handle, dvpStreamFormat);
|
||||
nRet = DVPCamera.dvpSetTargetFormat(m_handle, (dvpStreamFormat)dvpStreamFormat);
|
||||
if (dvpStatus.DVP_STATUS_OK != nRet)
|
||||
{
|
||||
throw new Exception($"Set image format failed:{nRet:x8}");
|
||||
@ -308,6 +308,8 @@ namespace DH.Devices.Camera
|
||||
|
||||
public int ImageCallbackFunc(uint handle, dvpStreamEvent _event, IntPtr pContext, ref dvpFrame refFrame, IntPtr pBuffer)
|
||||
{
|
||||
Mat cvImage = new Mat();
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@ -316,8 +318,7 @@ namespace DH.Devices.Camera
|
||||
|
||||
int nWidth = refFrame.iWidth;
|
||||
int nHeight = refFrame.iHeight;
|
||||
Mat cvImage = new Mat();
|
||||
|
||||
|
||||
// 根据图像格式创建Mat
|
||||
switch (refFrame.format)
|
||||
{
|
||||
@ -337,7 +338,8 @@ namespace DH.Devices.Camera
|
||||
default:
|
||||
throw new NotSupportedException($"Unsupported format: {refFrame.format}");
|
||||
}
|
||||
OnHImageOutput?.Invoke(DateTime.Now, this, cvImage);
|
||||
Mat smat = cvImage.Clone();
|
||||
OnHImageOutput?.Invoke(DateTime.Now, this, smat);
|
||||
|
||||
|
||||
|
||||
@ -348,6 +350,10 @@ namespace DH.Devices.Camera
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
cvImage?.Dispose();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user