基本関数とクラス¶
一般的な関数¶
initialize¶
- stapipy.initialize()¶
StApiライブラリを初期化します。
他のStApi関数を呼び出す前に、この関数を呼び出してStApiライブラリを初期化してください。
terminate¶
- stapipy.terminate()¶
StApiライブラリの終了処理を行います。
この関数を呼び出すとStApiライブラリのリソースは解放されます。
get_version¶
create_system¶
- stapipy.create_system(system_vendor=EStSystemVendor.Default, interface_type=EStInterfaceType.All) PyStSystem ¶
GenTLシステムモジュールをオープンし、PyStSystemオブジェクトを取得します。
- パラメータ
system_vendor (EStSystemVendor) -- 使用するGenTLモジュールを指定します。
interface_type (EStInterfaceType) -- 使用するインターフェイスを指定します。複数のインターフェイスを使用する場合は論理和を指定します。
- 戻り値
GenTLシステムモジュール
- 戻り値の型
get_pixel_format_info¶
- stapipy.get_pixel_format_info(pixelformat) PyStPixelFormatInfo ¶
引数に対するピクセルフォーマット情報クラスを取得します。
- パラメータ
pixelformat (EStPixelFormatNamingConvention or str) -- ピクセルフォーマット値
- 戻り値
ピクセルフォーマット情報クラスのオブジェクト
- 戻り値の型
get_pixel_component_info¶
- stapipy.get_pixel_component_info(pixelcomponent) PyStPixelComponentInfo ¶
引数に対するピクセル構成要素クラスを取得します。
- パラメータ
pixelcomponent (EStPixelComponent) -- ピクセル構成要素値
- 戻り値
ピクセル構成要素情報クラスのオブジェクト
- 戻り値の型
create_featurebag¶
- stapipy.create_featurebag() PyStFeatureBag ¶
PyStFeatureBagオブジェクトを取得します。
- 戻り値
PyStFeatureBagクラスのオブジェクト
- 戻り値の型
Common Exception¶
PyStError¶
- class stapipy.PyStError(message)¶
ベースクラス:
Exception
このクラスはStApiとGenICamによって発生した例外を伝播します。
例:
try: # code except PyStError as st_error: print(st_error) except Exception as other_exception: print(other_exception)
Exception
のみをキャッチして例外の種類をチェックすることも可能です。例:
try: # code except Exception as exception: print(type(exception), exception)
Common Classes¶
PyStFeatureBag¶
- class stapipy.PyStFeatureBag¶
ベースクラス:
object
GenApiノード(設定情報)保持クラス
- load(self, PyNodeMap nodemap, bool verify=True)¶
メモリーへ保存された設定情報をノードマップへ反映します。
- release(self) void ¶
PyStFeatureBagリソースを解放します。
- store_file_to_bag(self, unicode filename)¶
ファイルへ保存された設定情報をメモリーへ登録します。
- パラメータ
filename (str) -- 設定ファイル名
- store_nodemap_to_bag(self, PyNodeMap nodemap, int max_num_persist=-1) int64_t ¶
指定したノードマップの設定情報をメモリーへ退避します。
PyStImage¶
stapipy.PyStImage
の中のいくつかのメソッドはStApi C/C++と異なります。詳細はメソッドの説明をお読みください。
- class stapipy.PyStImage¶
ベースクラス:
object
画像オブジェクト
- clear_component_data(self, pixelcomponent)¶
指定したコンポーネントのデータをクリアします。
- パラメータ
pixelcomponent (EStPixelComponent) -- クリアするコンポーネントを指定
- static create_buffer(width, height, pixel_format, initialize_memory=EStMemoryInitialization.DoNothing)¶
与えられたパラメータから画像バッファを生成するための静的メソッド。生成したバッファを持つ画像オブジェクトを返します。
- パラメータ
width (int) -- 幅
height (int) -- 高さ
pixel_format (EStPixelFormatNamingConvention) -- ピクセルフォーマット
initialize_memory (EStMemoryInitialization) -- バッファの初期化方法
- 戻り値
生成された画像オブジェクト
- 戻り値の型
- static create_from_data(image_width, image_height, image_pixel_format, image_data=None)¶
データ(bytearray型)から画像オブジェクトを生成するための静的メソッド。 画像データはコピーされます。
- パラメータ
image_width (int) -- 幅
image_height (int) -- 高さ
image_pixel_format (EStPixelFormatNamingConvention) -- ピクセルフォーマット
image_data (bytearray) -- 画像データ (サイズは必要なメモリサイズと一致する必要があります)
- 戻り値
生成された画像オブジェクト
- 戻り値の型
- export_component_data(self, pixelcomponent) PyStImage ¶
指定したコンポーネントのデータをモノクロ画像データとして取り出します。
- パラメータ
pixelcomponent (EStPixelComponent) -- 取り出し元コンポーネントを指定
- 戻り値
取り出されるモノクロ画像
- 戻り値の型
- get_image_data(self)¶
raw画像データを取得します。
- 戻り値
raw画像データ
- 戻り値の型
- get_pixel_component_value(self, size_t pos_x, size_t pos_y) PyStPixelComponentValue ¶
指定した位置のピクセル構成要素を取得します。
- パラメータ
- 戻り値
ピクセル構成要素
- 戻り値の型
- get_roi_image(self, size_t pos_x, size_t pos_y, size_t width, size_t height) PyStImage ¶
切り取った画像オブジェクトを取得します。画像データはコピーされます。
- import_component_data(self, pixelcomponent, PyStImage image)¶
モノクロ画像データを指定したコンポーネントのデータとして取り込みます。
- パラメータ
pixelcomponent (EStPixelComponent) -- 取り込み先コンポーネントを指定
image (PyStImage) -- 取り込まれるモノクロ画像を指定
- is_releasable¶
PyStImage.is_releasable: bool
プロパティー:使用中のリソースを解放できるかどうかを示すフラグ。コピーした画像の場合はTrueを返します。
- Getter
戻り値を返します。
- 戻り値の型
- pixel_format¶
PyStImage.pixel_format: EStPixelFormatNamingConvention
プロパティー:画像のピクセルフォーマット
- Getter
戻り値を返します。
- 戻り値の型
- release(self)¶
解放が可能な場合は、画像リソースを解放します。
- store_computed_image(self, operation_type, pixel_format, PyStImage image1, PyStImage image2)¶
演算した画像を格納します。
- パラメータ
operation_type (EStOperationType) -- 演算のタイプを指定します。
pixel_format (EStPixelFormatNamingConvention) -- 出力画像のピクセルフォーマットを指定します。
image1 (PyStImage) -- 入力画像1の画像オブジェクト
image2 (PyStImage) -- 入力画像2の画像オブジェクト
PyStPixelComponentInfo¶
PyStPixelComponentValue¶
PyStPixelFormatInfo¶
- class stapipy.PyStPixelFormatInfo¶
ベースクラス:
object
ピクセルフォーマット情報クラス
- each_component_total_bit_count¶
PyStPixelFormatInfo.each_component_total_bit_count: int
プロパティー:構成要素ごとの全体のビット数
- Getter
戻り値を返します。
- 戻り値の型
- each_component_valid_bit_count¶
PyStPixelFormatInfo.each_component_valid_bit_count: int
プロパティー:構成要素ごとの有効なビット数
- Getter
戻り値を返します。
- 戻り値の型
- each_pixel_total_bit_count¶
PyStPixelFormatInfo.each_pixel_total_bit_count: int
プロパティー:ピクセルごとの合計ビット数
- Getter
戻り値を返します。
- 戻り値の型
- each_pixel_total_component_count¶
PyStPixelFormatInfo.each_pixel_total_component_count: int
プロパティー:ピクセルごとの構成要素の数
- Getter
戻り値を返します。
- 戻り値の型
- get_pixel_color_filter(self, int pos_x=0, int pos_y=0)¶
指定した位置のカラーフィルターを取得します。(ベイヤー配列画像時のみ有効な値が取得されます)
- パラメータ
- 戻り値
カラーフィルター値
- 戻り値の型
- is_compressed¶
PyStPixelFormatInfo.is_compressed: bool
プロパティー:圧縮された画像かどうかを示すフラグ
- Getter
戻り値を返します。
- 戻り値の型
- is_polarization¶
PyStPixelFormatInfo.is_polarization: bool
プロパティー:偏光画像かどうかを示すフラグ
- Getter
戻り値を返します。
- 戻り値の型
- order_of_polarized_filters¶
PyStPixelFormatInfo.order_of_polarized_filters: EStOrderOfPolarizedFilters
プロパティー:偏光フィルターの順番
- Getter
戻り値を返します。
- 戻り値の型
- pixel_increment_x¶
PyStPixelFormatInfo.pixel_increment_x: int
プロパティー:横方向の画像の最小単位
- Getter
戻り値を返します。
- 戻り値の型
- pixel_increment_y¶
PyStPixelFormatInfo.pixel_increment_y: int
プロパティー:縦方向の画像の最小単位
- Getter
戻り値を返します。
- 戻り値の型
- value¶
PyStPixelFormatInfo.value: EStPixelFormatNamingConvention
プロパティー:ピクセルフォーマット値
- Getter
戻り値を返します。
- 戻り値の型
PyStRegisteredCallback¶
- class stapipy.PyStRegisteredCallback(callback_func=None, user_data=None)¶
ベースクラス:
object
登録されたコールバック情報クラス
- callback_type¶
PyStRegisteredCallback.callback_type: EStCallbackType
プロパティー:StApiからトリガーされたコールバックタイプ。GenApiからのトリガーの場合、Noneを返します。
- Getter
コールバックタイプを返します。
- 戻り値の型
- error¶
プロパティー:コールバックがトリガーされた原因はエラーの場合、tuple型のデータ(int型エラーコードとstr型説明文)が返されます。エラーが無ければ、(None, None)が返されます。
- is_released¶
PyStRegisteredCallback.is_released: bool
プロパティー:コールバックのリソースが解放されたかどうかを示すフラグ
- Getter
コールバックのリソースが解放された場合は、Trueを返します。
- 戻り値の型
- module¶
プロパティー:トリガーソースのStApiクラスオブジェクト。トリガーソースがGenApiノードである場合、Noneを返します。
- Getter
StApiクラスのオブジェクト またはNoneが返されます。
- 戻り値の型
PyStSystem or PyStInterface or PyStDevice or PyStDataStream or PyStStreamBuffer or PyStVideoFiler or None
- node¶
プロパティー:GenApiからのトリガーソースノード。StApiからのトリガーの場合、Noneを返します。
- Getter
トリガーソースノード、またはNoneが返されます。
- 戻り値の型
PyNode or None
- release(self)¶
コールバックのリソースを解放します。リソースを解放するとコールバックは機能しません。