Skip to content

auto_thresholdAutoThresholdAutoThresholdauto_thresholdauto_threshold🔗

説明🔗

auto_thresholdAutoThresholdAutoThresholdauto_thresholdauto_threshold — ヒストグラムから決まるしきい値を用いて画像を分割する。

書式🔗

auto_threshold( image Image, out region Regions, number Sigma )void AutoThreshold( const HObject& Image, HObject* Regions, const HTuple& Sigma )static void HOperatorSet.AutoThreshold( HObject image, out HObject regions, HTuple sigma )def auto_threshold( image: HObject, sigma: Union[int, float] ) -> HObject

Herror auto_threshold( const Hobject Image, Hobject* Regions, double Sigma )

Herror T_auto_threshold( const Hobject Image, Hobject* Regions, const Htuple Sigma )

HRegion HImage::AutoThreshold( const HTuple& Sigma ) const

HRegion HImage::AutoThreshold( double Sigma ) const

HRegion HImage.AutoThreshold( HTuple sigma )

HRegion HImage.AutoThreshold( double sigma )

説明🔗

auto_thresholdAutoThreshold は複数のしきい値を用いて 1 チャンネルの画像 を分割します。最初にグレイ値に関する絶対ヒストグラムを作成し、そ のヒストグラムから最小値が抽出されます。抽出された複数の最小値は、 しきい値操作に対するパラメーターとして連続的に使用されます。バイト 画像で使用するしきい値は 0、255 とヒストグラムから抽出された すべての最小値です(ヒストグラムは標準偏差 Sigmasigmasigma を使用し ガウスフィルターを使用し平滑化されます)。各グレイ値のために、内部 に 1 つの領域が生成されます。したがって、領域数は最小値数 + 1 です。uint2 画像の場合、上記の処理が同じように使用されます。し かし、ここでは最大しきい値は 65535 です。 さらに、uint2 画像の場合、高い解像度をもつ内部ヒストグラムが使用さ れた場合でも、Sigmasigmasigma 値(実質)は 256 の値をもつヒストグラ ムを参照します。これは、パラメーター Sigmasigmasigma を変更すること なく画像種別を簡単に切り替えるために実行されます。float 画像の場 合、しきい値は、画像の最小グレイ値と最大グレイ値で、ヒストグラムか ら抽出されるすべての最小値です。ここで、パラメーター Sigmasigmasigma のスケーリングは、画像の元のグレイ値です。 Sigmasigmasigma に大きな値を選択すればするほど、より小さい領域が抽 出されます。このオペレーターは抽出される領域が同じようなグレイ値を 持つ(同次領域)の場合有効です。

実行情報🔗

実行情報
  • マルチスレッドタイプ: リエントラント(非排他なオペレーターと並列に動作)

  • マルチスレッドスコープ: グローバル(他のスレッドから呼び出される可能性あり)

  • tupleレベルで自動的に並列演算処理を実施

  • 内部データレベルで自動的に並列演算処理を実施

パラメーター🔗

Imageimageimage (input_object) singlechannelimage(-array) → object (byte / uint2 / real)HObject (byte / uint2 / real)HImage (byte / uint2 / real)HObject (byte / uint2 / real)Hobject (byte / uint2 / real)

入力画像

Regionsregionsregions (output_object) region-array → objectHObjectHRegionHObjectHobject *

自動的に決定された区間内のグレイ値をもつ領域

Sigmasigmasigma (input_control) number → (real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[int, float]Htuple (double / Hlong)

ヒストグラムに適用するガウススムージング量

初期値: 2.02.0
推奨値: 0.0, 0.5, 1.0, 2.0, 3.0, 4.0, 5.00.0, 0.5, 1.0, 2.0, 3.0, 4.0, 5.0
値域: Sigma (lin)
最小増分: 0.01
推奨増分: 0.3

例🔗

(HDevelop)


read_image (Image, 'fabrik')
median_image (Image, Median, 'circle', 3, 'mirrored')
auto_threshold (Median, Seg, 2.0)
connection (Seg, Connected)
(C)
read_image(&Image,"fabrik")\;
median_image(Image,&Median,"circle",3,"mirrored")\;
auto_threshold(Median,&Seg,2.0)\;
connection(Seg,&Connected)\;
set_colored(WindowHandle,12)\;
disp_obj(Connected,WindowHandle)\;
(C++)
#include "HIOStream.h"
#if !defined(USE_IOSTREAM_H)
using namespace std\;
#endif
#include "HalconCpp.h"
using namespace Halcon\;

int main (int argc, char *argv[])
{
  if (argc != 2)
  {
    cout << "Usage : " << argv[0] << " 'image' " << endl\;
    return -1\;
  }
 HImage       image(argv[1])\;
  HImage       med\;
  HWindow      w\;
 w.SetDraw("margin")\;
  w.SetColored(12)\;
 image.Display (w)\;
 med = image.MedianImage("circle", 3, "mirrored")\;
  med.Display(w)\;
 HRegionArray reg = med.AutoThreshold(2.0)\;
  HRegionArray con = reg.Connection()\;
 cout << "Display image after AutoThreshold segmentation " << endl\;
  con.Display(w)\;
  w.Click()\;
 return 0\;
}

他のオペレーターとの組み合わせ🔗

組み合わせ

前処理の候補

anisotropic_diffusionAnisotropicDiffusion, median_imageMedianImage, illuminateIlluminate

後処理の候補

connectionConnection, select_shapeSelectShape, select_graySelectGray

他の選択候補

binary_thresholdBinaryThreshold, char_thresholdCharThreshold

関連項目

gray_histoGrayHisto, gray_histo_absGrayHistoAbs, histo_to_threshHistoToThresh, smooth_funct_1d_gaussSmoothFunct1dGauss, thresholdThreshold

モジュール🔗

Foundation