image_server package

class ImageStreamDeviceClass(camera_id=0, interval_sec=0.03, width=None, height=None, fps=None, backend=None, reconnect_interval_sec=1.0, logger=None)[source]

Bases: object

gRPCに依存しないOpenCVカメラ制御クラス。

_apply_capture_settings_unlocked()[source]
Return type:

None

_capture_loop()[source]
Return type:

None

_log(level, message)[source]
Parameters:
Return type:

None

_open_capture_unlocked()[source]
Return type:

bool

static _optional_positive_float(value)[source]
Parameters:

value (float | None)

Return type:

float | None

static _optional_positive_int(value)[source]
Parameters:

value (int | None)

Return type:

int | None

_read_frame()[source]
Return type:

Any

_release_capture_unlocked()[source]
Return type:

None

_set_error(message)[source]
Parameters:

message (str)

Return type:

None

static _time_ns()[source]
Return type:

int

clear_error()[source]

直近のエラー文字列を消去する。

Return type:

bool

connect()[source]

カメラを開き、ローカル画像取得ループを開始する。

Return type:

bool

disconnect()[source]

画像取得ループを停止し、カメラを解放する。

Return type:

bool

get_config()[source]

ローカルカメラ設定を返す。

Return type:

Dict[str, Any]

get_latest_frame(copy_frame=True)[source]

取得済みの最新画像を返す。

Parameters:

copy_frame (bool)

Return type:

Any

get_status()[source]

ローカル画像取得状態を返す。

Return type:

Dict[str, Any]

is_connected()[source]

カメラが開かれているかを返す。

Return type:

bool

read_once()[source]

カメラから画像を1枚同期取得する。

Return type:

Any

set_camera_config(width=None, height=None, fps=None)[source]

解像度およびFPSの要求値を更新する。

Parameters:
  • width (int | None)

  • height (int | None)

  • fps (float | None)

Return type:

Dict[str, Any]

set_camera_id(camera_id)[source]

カメラIDを変更して再接続する。

Parameters:

camera_id (int)

Return type:

bool

start_capture()[source]

ローカル画像取得スレッドを開始する。

Return type:

bool

stop_capture()[source]

ローカル画像取得スレッドを停止する。

Return type:

bool

Subpackages

Submodules

image_server.image_stream_ctrl module

OpenCVを使用したローカル画像取得制御。

class ImageStreamDeviceClass(camera_id=0, interval_sec=0.03, width=None, height=None, fps=None, backend=None, reconnect_interval_sec=1.0, logger=None)[source]

Bases: object

gRPCに依存しないOpenCVカメラ制御クラス。

_apply_capture_settings_unlocked()[source]
Return type:

None

_capture_loop()[source]
Return type:

None

_log(level, message)[source]
Parameters:
Return type:

None

_open_capture_unlocked()[source]
Return type:

bool

static _optional_positive_float(value)[source]
Parameters:

value (float | None)

Return type:

float | None

static _optional_positive_int(value)[source]
Parameters:

value (int | None)

Return type:

int | None

_read_frame()[source]
Return type:

Any

_release_capture_unlocked()[source]
Return type:

None

_set_error(message)[source]
Parameters:

message (str)

Return type:

None

static _time_ns()[source]
Return type:

int

clear_error()[source]

直近のエラー文字列を消去する。

Return type:

bool

connect()[source]

カメラを開き、ローカル画像取得ループを開始する。

Return type:

bool

disconnect()[source]

画像取得ループを停止し、カメラを解放する。

Return type:

bool

get_config()[source]

ローカルカメラ設定を返す。

Return type:

Dict[str, Any]

get_latest_frame(copy_frame=True)[source]

取得済みの最新画像を返す。

Parameters:

copy_frame (bool)

Return type:

Any

get_status()[source]

ローカル画像取得状態を返す。

Return type:

Dict[str, Any]

is_connected()[source]

カメラが開かれているかを返す。

Return type:

bool

read_once()[source]

カメラから画像を1枚同期取得する。

Return type:

Any

set_camera_config(width=None, height=None, fps=None)[source]

解像度およびFPSの要求値を更新する。

Parameters:
  • width (int | None)

  • height (int | None)

  • fps (float | None)

Return type:

Dict[str, Any]

set_camera_id(camera_id)[source]

カメラIDを変更して再接続する。

Parameters:

camera_id (int)

Return type:

bool

start_capture()[source]

ローカル画像取得スレッドを開始する。

Return type:

bool

stop_capture()[source]

ローカル画像取得スレッドを停止する。

Return type:

bool

main()[source]

ローカルカメラへ接続し、取得画像をOpenCVウィンドウへ表示する。