1. 程式人生 > 其它 >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());