halcon-roberts计算边缘

 

 

在HDevelop中

复制代码
dev_close_window ()
read_image (Image, 'D:/bb/tu/1.jpg')
rgb1_to_gray (Image, GrayImage)

roberts (GrayImage, ImageRoberts, 'gradient_sum')
*计算边缘
*参数1:输入图像
*参数2:输出图像
*参数3:过滤器类型
*       'gradient_sum'    默认
*       'gradient_max'
*       'roberts_max'

get_image_size (GrayImage, Width, Height)
dev_open_window(10,10,Width, Height,'black',WindowHandle)
dev_display(ImageRoberts)
复制代码

 

 


在QtCreator中

  HObject  ho_Image, ho_GrayImage, ho_ImageRoberts;
  HTuple  hv_Width, hv_Height, hv_WindowHandle;
复制代码
  if (HDevWindowStack::IsOpen())
    CloseWindow(HDevWindowStack::Pop());
  ReadImage(&ho_Image, "D:/bb/tu/1.jpg");
  Rgb1ToGray(ho_Image, &ho_GrayImage);

  Roberts(ho_GrayImage, &ho_ImageRoberts, "gradient_sum");
  //计算边缘
  //参数1:输入图像
  //参数2:输出图像
  //参数3:过滤器类型
  //      'gradient_sum'    默认
  //      'gradient_max'
  //      'roberts_max'

  GetImageSize(ho_GrayImage, &hv_Width, &hv_Height);
  SetWindowAttr("background_color","black");
  OpenWindow(10,10,hv_Width,hv_Height,0,"visible","",&hv_WindowHandle);
  HDevWindowStack::Push(hv_WindowHandle);
  if (HDevWindowStack::IsOpen())
    DispObj(ho_ImageRoberts, HDevWindowStack::GetActive());
复制代码

 

 

 

 

 

 

 

posted @   天子骄龙  阅读(341)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
历史上的今天:
2019-03-12 matplotlib-2D绘图库-面向对象
点击右上角即可分享
微信分享提示

目录导航