映美精黑白相机IFrameQueueBuffer转halcon的HObject

映美精黑白相机,用wpf+halcon开发取图

1.到官网下载,开发包

1sdk 2c++开发例子 3c#开发例子

  1. 引入TIS.Imaging.ICImagingControl35.dll

3.ICImagingControl使用这个类控制相机

csharp 复制代码
/// <summary>
/// 相机控制
/// </summary>
public ICImagingControl _ic_imaging_control = new ICImagingControl();

 //设置不把图片显示在控件
_ic_imaging_control.LiveDisplay = false;
//禁止覆盖位图
_ic_imaging_control.OverlayBitmapPosition = PathPositions.None;

if (_ic_imaging_control.Devices.Length > 0)
   {
        int device_count_ = _ic_imaging_control.Devices.Length;
        for (int i = 0; i < device_count_; i++)
            {
             if (_ic_imaging_control.Devices[i].Name.Contains(_camer_parameter._camer_name))
                {
                   _ic_imaging_control.Device = _ic_imaging_control.Devices[i];
                   _camer_name = _ic_imaging_control.Devices[i].Name;
                 }
             }
    }

4.采用回调方式取图

csharp 复制代码
CamerTakeImage.CamerTakeImage._camer_take_image_static.Init();
if (CamerTakeImage.CamerTakeImage._camer_take_image_static._camer_name != "")
{
    _currently_displayed_buffer = null;
    //创建相机的回调函数
    _sink = new TIS.Imaging.FrameQueueSink((arg) => CamerCallback(arg), TIS.Imaging.MediaSubtypes.Y800, 5);
    CamerTakeImage.CamerTakeImage._camer_take_image_static._ic_imaging_control.Sink = _sink;                             
}

5.把图片转成HObject

csharp 复制代码
    /// <summary>
    /// 相机的回调函数
    /// </summary>
    /// <param name="buffer"></param>
    /// <returns></returns>
    FrameQueuedResult CamerCallback(IFrameQueueBuffer buffer)
    {
        DealWithImage.DealWithImage._deal_with_image_static._exit_image = false;
        DealWithImage.DealWithImage._deal_with_image_static._image.Dispose();
        HOperatorSet.GenImage1(out DealWithImage.DealWithImage._deal_with_image_static._image,
            "byte",
            buffer.FrameType.Width,
            buffer.FrameType.Height,
            buffer.GetIntPtr());
        DealWithImage.DealWithImage._deal_with_image_static._exit_image = true;
        hswin_image.RefreshWindow();
       
       //这句话一定要有,不然取图只有五张
        if (_currently_displayed_buffer != null)
        {
            _sink.QueueBuffer(_currently_displayed_buffer);
        }
        _currently_displayed_buffer = buffer;

        return FrameQueuedResult.SkipReQueue;
    }
相关推荐
mm_exploration1 天前
halcon激光三角测量(二十一)calibrate_sheet_of_light_calplate
图像处理·3d·halcon·点云处理
lingxiao168885 天前
Halcon相机标定
halcon·数字图像·图形处理
mm_exploration5 天前
halcon激光三角测量(十七)calibrate_sheet_of_light_3d_calib_object
图像处理·3d·halcon·点云处理
mm_exploration9 天前
halcon三维点云数据处理(十四)在3D场景中去除背景的三种方式
图像处理·3d·halcon·点云处理
mm_exploration9 天前
halcon三维点云数据处理(十三)reduce_object_model_3d_by_view
图像处理·3d·halcon·点云处理
光谷码农13 天前
C#+halcon机器视觉九点标定算法
c#·halcon·机器视觉·标定
机器视觉小小测试员1 个月前
工业相机 SDK 二次开发-Halcon 插件
halcon·工业相机·sdk开发
mm_exploration1 个月前
halcon三维点云数据处理(九)create_shape_model_3d_ignore_part_polarity
图像处理·3d·halcon·点云处理
mm_exploration1 个月前
halcon三维点云数据处理(七)find_shape_model_3d_recompute_score
图像处理·3d·halcon·点云处理
mm_exploration2 个月前
halcon三维点云数据处理(五)创建代表工具和机器人底座的3D模型
图像处理·halcon·点云处理