Skip to content

sub_imageSubImageSubImagesub_imagesub_image🔗

説明🔗

sub_imageSubImageSubImagesub_imagesub_image — 2 つの画像の減算を行う。

書式🔗

sub_image( image ImageMinuend, image ImageSubtrahend, out image ImageSub, number Mult, number Add )void SubImage( const HObject& ImageMinuend, const HObject& ImageSubtrahend, HObject* ImageSub, const HTuple& Mult, const HTuple& Add )static void HOperatorSet.SubImage( HObject imageMinuend, HObject imageSubtrahend, out HObject imageSub, HTuple mult, HTuple add )def sub_image( image_minuend: HObject, image_subtrahend: HObject, mult: Union[int, float], add: Union[int, float] ) -> HObject

Herror sub_image( const Hobject ImageMinuend, const Hobject ImageSubtrahend, Hobject* ImageSub, double Mult, double Add )

Herror T_sub_image( const Hobject ImageMinuend, const Hobject ImageSubtrahend, Hobject* ImageSub, const Htuple Mult, const Htuple Add )

HImage HImage::SubImage( const HImage& ImageSubtrahend, const HTuple& Mult, const HTuple& Add ) const

HImage HImage::SubImage( const HImage& ImageSubtrahend, double Mult, double Add ) const

HImage HImage.SubImage( HImage imageSubtrahend, HTuple mult, HTuple add )

HImage HImage.SubImage( HImage imageSubtrahend, double mult, double add )

説明🔗

オペレーター sub_imageSubImage は 2 つの画像減算を行います。 入力画像 (ImageMinuendimageMinuendimage_minuend と ImageSubtrahendimageSubtrahendimage_subtrahend) の グレイ値 (g1,g2) は、次式のように変換されます: g’ := (g1 - g2) * Mult + Add オーバーフローまたはアンダーフローが発生した場合、値は クリッピングされます。ただし、cyclic型画像を除きます。

* 一度の呼び出しで複数の画像を処理することができます。 この場合、2つのパラメーターには処理を適用する組み合わせ順に同じ枚数の画像を入力する必要があります。 出力画像はすべてのペアに対して生成されます。

なお、オペレーターの実行時間は、制御パラメーターによって 異なります。よく使われる組み合わせの場合、最適化アルゴリズムが使用されます。 さらに、byte、int2、uint2 画像の場合、CPUの SIMD 命令セットを 使用した最適化アルゴリズムを適用します。これら特殊な最適化については、 システムパラメーター 'mmx_enable'"mmx_enable" (set_systemSetSystem を参照)に よって制御することができます。'mmx_enable'"mmx_enable" を 'true'"true" に セットすれば(また、SIMD 命令セットが使用可能であれば)、 内部計算は SIMD 技術を使用して行われます。

sub_imageSubImage はOpenCLに対応しており、byte、direction、cyclic、int1、int2、uint2、int4 および real 画像を処理できます。しかし、OpenCL 1.0 では単精度浮動小数点しかサポートされておらず、また小数部に対する丸め誤差についてもすべてはサポートされていません。そのため、OpenCLの出力では、 スカラー演算の出力とわずかに異なる結果が得られます。

注意🔗

SIMD は、大きく穴がない入力領域において力を発揮します。 入力領域やハードウェアの機能に依存しますが、SIMD を 使用した sub_imageSubImage の実行には、使用しない場合より大幅に 時間がかかることがあります。 この場合、set_system(::'mmx_enable','false':) によって SIMD 無効化することができます。

実行情報🔗

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

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

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

  • ドメインレベルで自動的に並列演算処理を実施

パラメーター🔗

ImageMinuendimageMinuendimage_minuend (input_object) (multichannel-)image(-array) → object (byte* / int1* / int2* / uint2* / int4* / int8 / real* / direction* / cyclic* / complex*)HObject (byte* / int1* / int2* / uint2* / int4* / int8 / real* / direction* / cyclic* / complex*)HImage (byte* / int1* / int2* / uint2* / int4* / int8 / real* / direction* / cyclic* / complex*)HObject (byte* / int1* / int2* / uint2* / int4* / int8 / real* / direction* / cyclic* / complex*)Hobject (byte* / int1* / int2* / uint2* / int4* / int8 / real* / direction* / cyclic* / complex*) *計算デバイスに対して有効

減じられる元画像

ImageSubtrahendimageSubtrahendimage_subtrahend (input_object) (multichannel-)image(-array) → object (byte* / int1* / int2* / uint2* / int4* / int8 / real* / direction* / cyclic* / complex*)HObject (byte* / int1* / int2* / uint2* / int4* / int8 / real* / direction* / cyclic* / complex*)HImage (byte* / int1* / int2* / uint2* / int4* / int8 / real* / direction* / cyclic* / complex*)HObject (byte* / int1* / int2* / uint2* / int4* / int8 / real* / direction* / cyclic* / complex*)Hobject (byte* / int1* / int2* / uint2* / int4* / int8 / real* / direction* / cyclic* / complex*) *計算デバイスに対して有効

減ずる画像

ImageSubimageSubimage_sub (output_object) (multichannel-)image(-array) → object (byte / int1 / int2 / uint2 / int4 / int8 / real / direction / cyclic / complex)HObject (byte / int1 / int2 / uint2 / int4 / int8 / real / direction / cyclic / complex)HImage (byte / int1 / int2 / uint2 / int4 / int8 / real / direction / cyclic / complex)HObject (byte / int1 / int2 / uint2 / int4 / int8 / real / direction / cyclic / complex)Hobject * (byte / int1 / int2 / uint2 / int4 / int8 / real / direction / cyclic / complex)

減算による結果の画像

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

差分値に対する乗算係数

初期値: 1.01.0
推奨値: 0.0, 1.0, 2.0, 3.0, 4.00.0, 1.0, 2.0, 3.0, 4.0
値域: -255.0 ≤ Mult ≤ 255.0
最小増分: 0.001
推奨増分: 0.1

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

オフセット

初期値: 128.0128.0
推奨値: 0.0, 128.0, 256.00.0, 128.0, 256.0
値域: -512.0 ≤ Add ≤ 512.0
最小増分: 0.01
推奨増分: 1.0

例🔗

(HDevelop)


read_image(Image1,'fabrik')
dev_display (Image1)
read_image(Image2,'monkey')
dev_display (Image2)
sub_image (Image1, Image2, Result, 1, 100)
dev_display (Result)
(C)
read_image(&Image1,"fabrik")\;
disp_image(Image1,WindowHandle)\;
read_image(&Image2,"monkey")\;
disp_image(Image2,WindowHandle)\;
sub_image(Image1,Image2,&Result,1.0,100.0)\;
disp_image(Result,WindowHandle)\;

結果🔗

パラメーターが正しいならば、オペレーター sub_imageSubImage は 値 2 (H_MSG_TRUE) を返します。空の入力(利用できる入力画像がない)の場合、 オペレーター set_system(::'no_object_result',<Result>:) を 通して動作します。必要ならば、例外が発生します。

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

組み合わせ

後処理の候補

dual_thresholdDualThreshold

他の選択候補

mult_imageMultImage, add_imageAddImage

関連項目

add_imageAddImage, mult_imageMultImage, dyn_thresholdDynThreshold, check_differenceCheckDifference

モジュール🔗

Foundation