设置首页收藏本站
开启左侧

求灰点相机C#回调方式取图SDK,并转halcon格式

[复制链接]
luliang971212 发表于 2024-6-18 14:45:09 | 显示全部楼层 |阅读模式
跪求 大佬   灰点相机C#回调方式取图SDK,并输出halcon格式图像。。。。
奖励计划已经开启,本站鼓励作者发布最擅长的技术内容和资源,流量变现就在现在,[点我]加入吧~~~Go
街角 发表于 2024-6-26 12:21:52 | 显示全部楼层
你好,有找到么,求分享一下
奖励计划已经开启,本站鼓励作者发布最擅长的技术内容和资源,流量变现就在现在,[点我]加入吧~~~Go
yaofeng2217 发表于 2024-8-13 08:49:58 | 显示全部楼层
构造函数:
  1.     public CameraFLIRRGB(string CameraSerial_str, string PC_IP1, string Camera_IP1)
  2.         {
  3.             CameraSerial = CameraSerial_str;      //序列号
  4.             PC_IP = PC_IP1;                                  //电脑IP
  5.             Camera_IP = Camera_IP1;                  //相机IP
  6.             BindEvent();                                        //注册事件
  7.         }
复制代码



注册事件:
  1. public delegate void GrabImageDelegate(IntPtr pData, uint ImageWidth, uint ImageHeight);
  2.         event GrabImageDelegate GrabImageEvent;
  3.         public void BindEvent()
  4.         {
  5.             RemoveEvent();
  6.             try
  7.             {
  8.                 GrabImageEvent += new GrabImageDelegate(get_Image);

  9.             }
  10.             catch (Exception ex)
  11.             {
  12.                 LogName.ErrorLog.Fatal(ex);
  13.             }
  14.         }

  15. //拿图放进队列
  16.     private void get_Image(IntPtr pData, uint ImageWidth, uint ImageHeight)
  17.         {
  18.             try
  19.             {
  20.                 image.Dispose();
  21.                 HOperatorSet.GenImageInterleaved(out image, pData, "rgb", ImageWidth, ImageHeight, -1, "byte", ImageWidth, ImageHeight, 0, 0, -1, 0);
  22.                 //释放指针很重要!!!!!
  23.                 Marshal.FreeHGlobal(pData);
  24.                 HTuple w, h;
  25.                 HOperatorSet.GetImageSize(image, out w, out h);

  26.                 if (w != 0 && h != 0)
  27.                 {
  28.                     QueueGrabImage.Enqueue(new HObject(image));
  29.                     if (FrameCount >= ulong.MaxValue)
  30.                         FrameCount = 0;
  31.                     FrameCount++;
  32.                     bo_jisuan = true;                                                                                                                 //当图像确定采集到了,标志位置为true
  33.                     Grab_Image = true;
  34.                     LogName.CameraLog.Fatal(CameraSerial + " 采集到图像,图像进队,当前队列个数:" + QueueGrabImage.Count.ToString());                   //新增记录
  35.                 }
  36.             }
  37.             catch (Exception ex)
  38.             {
  39.                 LogName.ErrorLog.Fatal(ex);
  40.             }
  41.         }
复制代码
奖励计划已经开启,本站鼓励作者发布最擅长的技术内容和资源,流量变现就在现在,[点我]加入吧~~~Go
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表