module Labcom
Authors-
IMAZU, Setsuo
Version-
25.2.0
Date-
2024-11-18
Comment-
Deprecated labcom module
[DEPRECATED]¶ ↑
This class is scheduled to be removed in the next version 26.0.0.
Constants
- VERSION
Public Instance Methods
is_module_init( )
click to toggle source
- 引 数
-
なし
- 返 値
-
true: 初期化済, false:未初期化
- 説 明
-
モジュール初期化処理がされたかどうか
# File lib/labcom/Labcom_m.rb, line 32 def is_module_init( ) return @@mInitialized end
set_module_init( )
click to toggle source
- 引 数
-
なし
- 返 値
-
なし
- 説 明
-
モジュール初期化処理
# File lib/labcom/Labcom_m.rb, line 44 def set_module_init( ) if not @@mInitialized then Labcom.set_retrieve_dir() @@mInitialized=true end end
to_bytes_per_sample( image_type )
click to toggle source
- 引 数
- image_type (string)
-
LABCOMデータ処理が扱うイメージタイプ
- 返 値
-
バイト長
- 例 外
-
TypeError
- 説 明
-
イメージタイプから、その1サンプルのバイト長を算出する。
# File lib/labcom/Labcom_m.rb, line 113 def to_bytes_per_sample( image_type ) return 2 if image_type == 'YUY2' pos = image_type.index('INT') pos = image_type.index('FLT') if nil == pos if nil != pos then val = image_type[3..-1].to_i else pos = image_type.index('GRAY') pos = image_type.index('GREY') if nil == pos if nil != pos then val = image_type[4..-1].to_i else if nil != image_type.index('YUV') then val = 16 end end end if nil == val then rgb_r = image_type.index('R') rgb_g = image_type.index('G') rgb_b = image_type.index('B') if nil != rgb_r and nil != rgb_g and nil != rgb_b then val = 32 end end if nil != val then return 1 if 9 > val return 2 if 17 > val return 4 if 33 > val return 8 if 65 > val end raise TypeError, 'Image type( ' + image_type + ' ) is unknown.' end
to_narray_type( image_type )
click to toggle source
- 引 数
- image_type (string)
-
LABCOMデータ処理が扱うイメージタイプ
- 返 値
-
NArrayクラスが扱うデータタイプ
- 例 外
-
TypeError
- 説 明
-
イメージタイプをNArrayクラスが扱うデータタイプに変換する。
INT64は未サポート(NArray)
# File lib/labcom/Labcom_m.rb, line 64 def to_narray_type( image_type ) return NArray::BYTE if image_type == 'INT8' return NArray::SINT if image_type == 'INT16' return NArray::LINT if image_type == 'INT32' # return NArray::LLINT if image_type == 'INT64' return NArray::SFLOAT if image_type == 'FLT32' return NArray::DFLOAT if image_type == 'FLT64' return NArray::SINT if image_type == 'YUY2' pos = image_type.index('GRAY') pos = image_type.index('GREY') if nil == pos if nil != pos then val = image_type[4..-1].to_i else if nil != image_type.index('YUV') then val = 16 end end if nil == val then rgb_r = image_type.index('R') rgb_g = image_type.index('G') rgb_b = image_type.index('B') if nil != rgb_r and nil != rgb_g and nil != rgb_b then val = 32 end end if nil != val then return NArray::BYTE if 9 > val return NArray::SINT if 17 > val return NArray::LINT if 33 > val # return NArray::LLINT if 65 > val end raise TypeError, 'Image type( ' + image_type + ' ) is unknown.' end