Skip to content

gen_image_constGenImageConstGenImageConstgen_image_constgen_image_const🔗

説明🔗

gen_image_constGenImageConstGenImageConstgen_image_constgen_image_const — 一定のグレイ値をもつ画像を生成する。

書式🔗

gen_image_const( out image Image, string Type, extent.x Width, extent.y Height )void GenImageConst( HObject* Image, const HTuple& Type, const HTuple& Width, const HTuple& Height )static void HOperatorSet.GenImageConst( out HObject image, HTuple type, HTuple width, HTuple height )def gen_image_const( type: str, width: int, height: int ) -> HObject

Herror gen_image_const( Hobject* Image, const char* Type, const Hlong Width, const Hlong Height )

Herror T_gen_image_const( Hobject* Image, const Htuple Type, const Htuple Width, const Htuple Height )

void HImage::HImage( const HString& Type, Hlong Width, Hlong Height )

void HImage::HImage( const char* Type, Hlong Width, Hlong Height )

void HImage::HImage( const wchar_t* Type, Hlong Width, Hlong Height ) (Windows only)

public HImage( string type, int width, int height )

void HImage::GenImageConst( const HString& Type, Hlong Width, Hlong Height )

void HImage::GenImageConst( const char* Type, Hlong Width, Hlong Height )

void HImage::GenImageConst( const wchar_t* Type, Hlong Width, Hlong Height ) (Windows only)

void HImage.GenImageConst( string type, int width, int height )

説明🔗

オペレーター gen_image_constGenImageConst は、指定されたサイズの画像を 生成します。画像の高さと幅は、Heightheightheight と Widthwidthwidth に よって決まります。 HALCON は、以下に示す画像型をサポートしています。

  • 'byte'"byte" 1Byte画像、unsigned

    値域: (0..255)

  • 'int1'"int1" 1Byte画像、signed

    値域: (-128..127)

  • 'uint2'"uint2" 2Byte画像、unsigned

    値域: (0..65535)

  • 'int2'"int2" 2Byte画像、signed

    値域: (-32768..32767)

  • 'int4'"int4" 4Byte画像、signed

    (-2147483648..2147483647)

  • 'int8'"int8" 8Byte画像、signed (64 ビットシステムのみで利用可能)

    値域: (-9223372036854775808..9223372036854775807)、

  • 'real'"real" 浮動小数点型4Byte画像

    小数点以下 6桁

    値域: (-3.4e38..3.4e38)

  • 'complex'"complex" 'real'"real" 型の配列

  • 'vector_field_relative'"vector_field_relative" 'real'"real" 型の配列

    解釈: Vectors

  • 'vector_field_absolute'"vector_field_absolute" 'real'"real" 型の配列

    解釈: 絶対座標

  • 'direction'"direction" 1Byte画像、unsigned

    解釈: 角度を 2 で 割ったもの

    値域: (0..179)

    注意: 180..254 の範囲の値は、未定義の角度として解釈され、自動的に 255 に設定されます

  • 'cyclic'"cyclic" 1 Byte画像、周期的計算

    値域: (0..255)

デフォルト値 0 は、オペレーター set_system('init_new_image',<'true'/'false'>) を使用して設 定します。

実行情報🔗

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

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

  • 並列演算処理には未対応

パラメーター🔗

Imageimageimage (output_object) image → object (byte / direction / cyclic / int1 / int2 / uint2 / int4 / int8 / real / complex / vector_field)HObject (byte / direction / cyclic / int1 / int2 / uint2 / int4 / int8 / real / complex / vector_field)HImage (byte / direction / cyclic / int1 / int2 / uint2 / int4 / int8 / real / complex / vector_field)HObject (byte / direction / cyclic / int1 / int2 / uint2 / int4 / int8 / real / complex / vector_field)Hobject * (byte / direction / cyclic / int1 / int2 / uint2 / int4 / int8 / real / complex / vector_field)

新しい画像行列をもつ生成された画像

Typetypetype (input_control) string → (string)HTuple (HString)HTuple (string)strHtuple (char*)

ピクセルタイプ

初期値: 'byte'"byte"
値のリスト: 'byte', 'complex', 'cyclic', 'direction', 'int1', 'int2', 'int4', 'int8', 'real', 'uint2', 'vector_field_absolute', 'vector_field_relative'"byte", "complex", "cyclic", "direction", "int1", "int2", "int4", "int8", "real", "uint2", "vector_field_absolute", "vector_field_relative"

Widthwidthwidth (input_control) extent.x → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

画像の幅

初期値: 512512
推奨値: 128, 256, 512, 1024128, 256, 512, 1024
値域: 1 ≤ Width (lin)
最小増分: 1
推奨増分: 10

Heightheightheight (input_control) extent.y → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

画像の高さ

初期値: 512512
推奨値: 128, 256, 512, 1024128, 256, 512, 1024
値域: 1 ≤ Height (lin)
最小増分: 1
推奨増分: 10

例🔗

(C)

gen_image_const(&New,"byte",width,height)\;
get_image_pointer1(New,(Hlong*)&pointer,type,&width,&height)\;
for (row=0\; row<height-1\; row++)
{
  for (col=0\; col<width-1\; col++)
  {
    pointer[row*width+col] = (row + col) % 256\;
  }
}

結果🔗

パラメーター値が正しいならば、オペレーター gen_image_constGenImageConst は値 2 (H_MSG_TRUE) を返します。それ以外の場合には例 外処理が発生します。

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

組み合わせ

後処理の候補

paint_regionPaintRegion, reduce_domainReduceDomain, get_image_pointer1GetImagePointer1, copy_objCopyObj

他の選択候補

gen_image1GenImage1, gen_image3GenImage3

関連項目

reduce_domainReduceDomain, paint_grayPaintGray, paint_regionPaintRegion, set_grayvalSetGrayval, get_image_pointer1GetImagePointer1

モジュール🔗

Foundation