其他分享
首页 > 其他分享> > halcon-local_threshold局部阈值--适合不均匀照明

halcon-local_threshold局部阈值--适合不均匀照明

作者:互联网

 

 

 

在HDevelop中

read_image (Image, 'D:/bb/tu/11.png')
get_image_size (Image, Width, Height)

dev_open_window (10, 10, Width, Height, 'black', WindowHandle)

local_threshold (Image, Region, 'adapted_std_deviation', 'dark', [], [])
*局部阈值--适合不均匀照明-->渐变背景
*参数1:输入图像
*参数2:分割后的区域
*参数3:分割方法     'adapted_std_deviation'  
*参数4:提取前景还是背景

dev_display(Region)

 

 

在QtCreator中

  HObject  ho_Image, ho_Region;
  HTuple  hv_Width, hv_Height, hv_WindowHandle;
  ReadImage(&ho_Image, "D:/bb/tu/11.png");
  GetImageSize(ho_Image, &hv_Width, &hv_Height);

  SetWindowAttr("background_color","black");
  OpenWindow(10,10,hv_Width,hv_Height,0,"visible","",&hv_WindowHandle);
  HDevWindowStack::Push(hv_WindowHandle);

  LocalThreshold(ho_Image, &ho_Region, "adapted_std_deviation", "dark", HTuple(), 
      HTuple());
  //局部阈值--适合不均匀照明-->渐变背景
  //参数1:输入图像
  //参数2:分割后的区域
  //参数3:分割方法     'adapted_std_deviation'
  //参数4:提取前景还是背景

  if (HDevWindowStack::IsOpen())
    DispObj(ho_Region, HDevWindowStack::GetActive());

 

 

 

 

 

标签:--,Image,hv,halcon,Width,ho,threshold,Height,Region
来源: https://www.cnblogs.com/liming19680104/p/16116962.html