当前位置: 代码迷 >> 综合 >> C# halcon hobject 快速转Bitmap
  详细解决方案

C# halcon hobject 快速转Bitmap

热度:99   发布时间:2024-01-27 23:37:10.0
 Bitmap Honject2Bitmap(HObject hObject){//获取图像尺寸HOperatorSet.GetImageSize(hObject, out HTuple width0, out HTuple height0);HOperatorSet.GetImageSize(hObject, out width0, out height0);//创建交错格式图像HOperatorSet.InterleaveChannels(hObject, out HObject InterImage, "rgb", 4 * width0, 0);//获取交错格式图像指针HOperatorSet.GetImagePointer1(InterImage, out HTuple Pointer, out HTuple type, out HTuple width, out HTuple height);IntPtr ptr = Pointer;//构建新Bitmap图像Bitmap bitmap = new Bitmap(width / 4, height, width, PixelFormat.Format24bppRgb, ptr);return bitmap;}