Skip to content

depth_from_focusDepthFromFocusDepthFromFocusdepth_from_focusdepth_from_focus🔗

説明🔗

depth_from_focusDepthFromFocusDepthFromFocusdepth_from_focusdepth_from_focus — 複数のフォーカスレベルを使って深さを抽出する。

書式🔗

depth_from_focus( image MultiFocusImage, out image Depth, out image Confidence, string Filter, string Selection )void DepthFromFocus( const HObject& MultiFocusImage, HObject* Depth, HObject* Confidence, const HTuple& Filter, const HTuple& Selection )static void HOperatorSet.DepthFromFocus( HObject multiFocusImage, out HObject depth, out HObject confidence, HTuple filter, HTuple selection )def depth_from_focus( multi_focus_image: HObject, filter: MaybeSequence[Union[str, int]], selection: MaybeSequence[str] ) -> Tuple[HObject, HObject]

Herror depth_from_focus( const Hobject MultiFocusImage, Hobject* Depth, Hobject* Confidence, const char* Filter, const char* Selection )

Herror T_depth_from_focus( const Hobject MultiFocusImage, Hobject* Depth, Hobject* Confidence, const Htuple Filter, const Htuple Selection )

HImage HImage::DepthFromFocus( HImage* Confidence, const HTuple& Filter, const HTuple& Selection ) const

HImage HImage::DepthFromFocus( HImage* Confidence, const HString& Filter, const HString& Selection ) const

HImage HImage::DepthFromFocus( HImage* Confidence, const char* Filter, const char* Selection ) const

HImage HImage::DepthFromFocus( HImage* Confidence, const wchar_t* Filter, const wchar_t* Selection ) const (Windows only)

HImage HImage.DepthFromFocus( out HImage confidence, HTuple filter, HTuple selection )

HImage HImage.DepthFromFocus( out HImage confidence, string filter, string selection )

説明🔗

オペレーター depth_from_focusDepthFromFocus はフォーカスを変えながら撮影したシーケンス画像を使 って深さを抽出します。フォーカスのシーケンス画像はマルチチャンネル 画像 (MultiFocusImagemultiFocusImagemulti_focus_image) として渡す必要があります。それぞれ のピクセルに対する深さはチャンネル数として Depthdepthdepth に返りま す。パラメーター Confidenceconfidenceconfidence はそれぞれの深さ評価に対する 信頼値が返ります。この値がより大きいと、それだけ深さ評価の信頼性が 高いことを意味します。

depth_from_focusDepthFromFocus は全てのフォーカスレベルの一番良いフォー カスでピクセルを選択します。これらのピクセルを抽出するために使用す る方法は、パラメーター Filterfilterfilter と Selectionselectionselection で指 定します。

パラメーター Filterfilterfilter の場合、値 'highpass'"highpass" と 'bandpass'"bandpass" から選択できます。画像内のフォーカスを決定する には、ハイパスフィルターかバンドパスフィルターを適用できます。フィ ルターの応答が大きいほど、この場所での画像のフォーカスが鮮明になり ます。ハイパスフィルターと比較すると、バンドパスフィルターは高周波 数を抑制します。バンドパスフィルターは特に強いノイズを含む画像に適 しています。

任意に、フィルター処理された画像を平滑化フィルターを使って滑らかに できます。それには、マスクサイズを表す追加の 2 つの整数値をパラ メーター Filterfilterfilter(例えば、 ['highpass'"highpass", 77,77]) に渡します。これは、近傍ピクセル間のフォーカス領域をにじませるため、 画像内のテクスチャのない小さな領域を埋めることができます。このスムー ジングはオリジナル画像のノイズを抑制しません。抑制しないのは、ス ムージングがハイパスフィルターやバンドパスフィルターの後にのみ適用 されるからです。

パラメーター Selectionselectionselection は、フォーカスの最適化レベルを決定 します。 値 'next_maximum'"next_maximum" を渡すと、最大のフォーカスレベルが近傍に使 用されます。一方、値 'local'"local" を渡すと、フォーカスレベル は、ピクセルのすべてのフォーカスレベルのフォーカス値に基づいて決定 されます。'next_maximum'"next_maximum" を使用すると、一般に多少平滑化さ れたロバストな結果が得られます。

テレセントリックレンズが入力画像を撮影するために使用された場合、追 加スムージングが有効です。この場合、オブジェクトの位置はシーケンス 内にわずかに移動します。適切なスムージングを追加することで、この効 果が部分的に保証されます。

注意🔗

MultiFocusImagemultiFocusImagemulti_focus_image が255チャンネル(フォーカスレベル)以上含む場合、 Depthdepthdepth は255でクリップされます。すなわち、255より大きい depth valuesは 無視されます。

Filterfilterfilter のフィルターマスクに偶数値が指定された場合、ルーチン はその値の代わりに、その値の次に大きい奇数値を使用します。(このように、フィルターの 中心は常に明示的に決定されます。)

Selectionselectionselection を 'local'"local" に設定し、Filterfilterfilter を 'highpass'"highpass" または ‘'bandpass'"bandpass" に設定すると、 OpenCL デバイスで depth_from_focusDepthFromFocus を実行することができます。 スムージングが有効な場合、mean_imageMeanImage と同じ制限と制約が適用されます。

フィルタのオペレータは入力画像としてドメインを絞り込んだ画像を用いた場合、期待しない結果と なる場合があります。章Filters を確認ください。

実行情報🔗

実行情報
  • OpenCL演算デバイスによる演算をサポート

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

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

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

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

パラメーター🔗

MultiFocusImagemultiFocusImagemulti_focus_image (input_object) multichannel-image(-array) → object (byte)HObject (byte)HImage (byte)HObject (byte)Hobject (byte)

複数のフォーカスレベルから成るマルチチャンネルの グレイ画像

Depthdepthdepth (output_object) singlechannelimage(-array) → object (byte)HObject (byte)HImage (byte)HObject (byte)Hobject * (byte)

深さ画像

Confidenceconfidenceconfidence (output_object) singlechannelimage(-array) → object (byte)HObject (byte)HImage (byte)HObject (byte)Hobject * (byte)

深さ評価の信頼性

Filterfilterfilter (input_control) string(-array) → (string / integer)HTuple (HString / Hlong)HTuple (string / int / long)MaybeSequence[Union[str, int]]Htuple (char* / Hlong)

鋭敏なピクセルを見つけるために使用するフィルター

初期値: 'highpass'"highpass"
推奨値: 'highpass', 'bandpass', 3, 5, 7, 9"highpass", "bandpass", 3, 5, 7, 9

Selectionselectionselection (input_control) string(-array) → (string)HTuple (HString)HTuple (string)MaybeSequence[str]Htuple (char*)

鋭敏なピクセルを見つけるために使用する方法

初期値: 'next_maximum'"next_maximum"
値のリスト: 'local', 'next_maximum'"local", "next_maximum"
値のリスト(計算デバイス用): 'local'"local"

例🔗

(C++)

compose3(Focus0,Focus1,Focus2,&MultiFocus)\;
depth_from_focus(MultiFocus,&Depth,&Confidence,'highpass','next_maximum')\;
mean_image(Depth,&Smooth,15,15)\;
select_grayvalues_from_channels(MultiChannel,Smooth,SharpImage)\;
threshold(Confidence,HighConfidence,10,255)\;
reduce_domain(SharpImage,HighConfidence,ConfidentSharp)\;

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

組み合わせ

前処理の候補

compose2Compose2, compose3Compose3, compose4Compose4, add_channelsAddChannels, read_imageReadImage, read_sequenceReadSequence

後処理の候補

select_grayvalues_from_channelsSelectGrayvaluesFromChannels, mean_imageMeanImage, binomial_filterBinomialFilter, gauss_filterGaussFilter, thresholdThreshold

関連項目

count_channelsCountChannels

モジュール🔗

3D Metrology