zl程序教程

您现在的位置是:首页 >  其他

当前栏目

halcon-sobel_amp计算边缘

amp边缘计算 HALCON Sobel
2023-09-27 14:28:41 时间

 

 

在HDevelop中

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

sobel_amp (GrayImage, EdgeAmplitude, 'sum_abs', 3)
*计算边缘
*参数2:输出图像
*参数3:掩码类型
*参数4:掩码大小


get_image_size (GrayImage, Width, Height)
dev_open_window(10,10,Width, Height,'black',WindowHandle)
dev_display(EdgeAmplitude)

 

 

在QtCreator中

  HObject  ho_Image, ho_GrayImage, ho_EdgeAmplitude;
  HTuple  hv_Width, hv_Height, hv_WindowHandle;
  ReadImage(&ho_Image, "D:/bb/tu/1.jpg");
  Rgb1ToGray(ho_Image, &ho_GrayImage);

  SobelAmp(ho_GrayImage, &ho_EdgeAmplitude, "sum_abs", 3);
  //计算边缘
  //参数2:输出图像
  //参数3:掩码类型
  //参数4:掩码大小


  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_EdgeAmplitude, HDevWindowStack::GetActive());