Skip to content

add_imageAddImageAddImageadd_imageadd_image🔗

説明🔗

add_imageAddImageAddImageadd_imageadd_image — 2 つの画像の加算を行なう。

書式🔗

add_image( image Image1, image Image2, out image ImageResult, number Mult, number Add )void AddImage( const HObject& Image1, const HObject& Image2, HObject* ImageResult, const HTuple& Mult, const HTuple& Add )static void HOperatorSet.AddImage( HObject image1, HObject image2, out HObject imageResult, HTuple mult, HTuple add )def add_image( image_1: HObject, image_2: HObject, mult: Union[int, float], add: Union[int, float] ) -> HObject

Herror add_image( const Hobject Image1, const Hobject Image2, Hobject* ImageResult, double Mult, double Add )

Herror T_add_image( const Hobject Image1, const Hobject Image2, Hobject* ImageResult, const Htuple Mult, const Htuple Add )

HImage HImage::AddImage( const HImage& Image2, const HTuple& Mult, const HTuple& Add ) const

HImage HImage::AddImage( const HImage& Image2, double Mult, double Add ) const

HImage HImage.AddImage( HImage image2, HTuple mult, HTuple add )

HImage HImage.AddImage( HImage image2, double mult, double add )

説明🔗

オペレーター add_imageAddImage は、2つの画像を加算します。 入力画像 (Image1image1image_1 と Image2image2image_2) のグレイ値 (g1,g2) は、以下のように変換されます: g’ := (g1 + g2) * Mult + Add

オーバーフローまたはアンダーフローが生じれば、その値はクリッピングされます。 ただし、cyclic型画像を除きます。 結果の画像は ImageResultimageResultimage_result に格納されます。

* byte画像は int2、uint2、または int4 画像に、int4 は int2 または uint2 画像に追加することができます。この場合、結果はそれぞれ int2 または int4 型になります。

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

*

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

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

注意🔗

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

実行情報🔗

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

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

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

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

パラメーター🔗

Image1image1image_1 (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*) *計算デバイスに対して有効

画像 1

Image2image2image_2 (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*) *計算デバイスに対して有効

画像 2

ImageResultimageResultimage_result (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)

グレイ値の範囲調整のための係数

初期値: 0.50.5
推奨値: 0.2, 0.4, 0.6, 0.8, 1.0, 1.5, 2.0, 3.0, 5.00.2, 0.4, 0.6, 0.8, 1.0, 1.5, 2.0, 3.0, 5.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)

グレイ値の範囲調整のためのオフセット

初期値: 00
推奨値: 0, 64, 128, 255, 5120, 64, 128, 255, 512
値域: -512.0 ≤ Add ≤ 512.0
最小増分: 0.01
推奨増分: 1.0

例🔗

(HDevelop)


read_image(Image1,'fabrik')
dev_display (Image1)
read_image(Image2,'monkey')
dev_display (Image2)
add_image(Image1,Image2,Result,0.5,10.0)
dev_display (Result)
(C)
read_image(&Image1,"fabrik")\;
disp_image(Image1,WindowHandle)\;
read_image(&Image2,"monkey")\;
disp_image(Image2,WindowHandle)\;
add_image(Image1,Image2,&Result,0.5,10.0)\;
disp_image(Result,WindowHandle)\;

結果🔗

パラメーターが正しいならば、オペレーター add_imageAddImage は 値 2 (H_MSG_TRUE) を返します。空の入力(利用可能な入力画像がない)に対しては、 オペレーター set_system(::'no_object_result',<Result>:) を 通して動作します。必要であれば、例外処理が発生します。

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

組み合わせ

他の選択候補

sub_imageSubImage, mult_imageMultImage

関連項目

sub_imageSubImage, mult_imageMultImage

モジュール🔗

Foundation