C#

説明

C# SDKでは、呼び出しを容易にするために3つのユーティリティライブラリを使用します。

  1. RestSharp - HTTPリクエストを送信するために使用

  2. Newtonsoft.Json - JSON文字列を解析するために使用

  3. SixLabors.ImageSharp - 画像データを保存するために使用

インターフェース定義

関数名 機能説明 パラメータと戻り値

public static string GetSDKVersion()

SDKバージョン番号を取得

戻り値: string型、SDKバージョン番号

public static string? GetHeader(string ip, string frameId, int timeout=2000)

カメラ写真情報を取得

パラメータ:

ip: カメラのIPアドレス

frameId: カメラのフレームID

timeout: タイムアウト時間、デフォルトは2000 ms

戻り値: string型、幅と高さを含むカメラの写真情報

public static EpicEyeInfo? GetInfo(string ip, int timeout=2000)

カメラ情報を取得

パラメータ:

ip: カメラのIPアドレス

timeout: タイムアウト時間、デフォルトは2000 ms

戻り値: EpicEyeInfo型、詳細なカメラ情報

public static string? TriggerCapture(string? ip, bool withPointCloud = true, int timeout=2000)

フレームキャプチャをトリガー

パラメータ:

ip: カメラのIPアドレス

withPointCloud: 点群データを要求するかどうか

timeout: タイムアウト時間、デフォルトは2000 ms

戻り値: string型、後続のデータ取得に使用するフレームIDを返す

public static byte[]? GetPointCloud(string ip, string frameId, int timeout=15000)

点群データを取得

パラメータ:

ip: カメラのIPアドレス

frameId: 取得するデータのフレームID

timeout: タイムアウト時間、デフォルトは15000 ms

戻り値: byte[]型、点群データ

public static byte[]? GetDepth(string ip, string frameId, int timeout=15000)

深度マップデータを取得

パラメータ:

ip: カメラのIPアドレス

frameId: 取得するデータのフレームID

timeout: タイムアウト時間、デフォルトは15000 ms

戻り値: byte[]型、深度マップデータ

public static byte[]? GetImage(string ip, string frameId, int timeout=15000)

2D画像データを取得

パラメータ:

ip: カメラのIPアドレス

frameId: 取得するデータのフレームID

timeout: タイムアウト時間、デフォルトは15000 ms

戻り値: byte[]型、画像データ

public static Hashtable? GetConfig(string ip, string frameId = "", int timeout=2000)

カメラ設定パラメータを取得

パラメータ:

ip: カメラのIPアドレス

frameId: 取得するデータのフレームID、空文字列は最新設定を取得

timeout: タイムアウト時間、デフォルトは2000 ms

戻り値: Hashtable型、カメラ設定データ

public static bool SetConfig(string ip, Hashtable config, int timeout=2000)

カメラ設定パラメータを設定

パラメータ:

ip: カメラのIPアドレス

config: 設定するカメラパラメータ

timeout: タイムアウト時間、デフォルトは2000 ms

戻り値: bool型、設定成功を示す

public static float[]? GetCameraMatrix(string ip, int timeout=2000)

カメラ内部行列を取得

パラメータ:

ip: カメラのIPアドレス

timeout: タイムアウト時間、デフォルトは2000 ms

戻り値: float[]型、3x3カメラ行列

public static float[]? GetDistortion(string ip, int timeout=2000)

カメラの歪みパラメータを取得

パラメータ:

ip: カメラのIPアドレス

timeout: タイムアウト時間、デフォルトは2000 ms

戻り値: float[]型、カメラ歪みパラメータ

public static (byte[]? imageBytes, byte[]? pointCloudBytes) GetPointCloudAndImageWithTimeStats(string ip, string frameId, ref double networkTransmitTimeMs, ref double networkSpeedMbps, int timeout = 15000)

転送統計付き点群と画像データを取得

パラメータ:

ip: カメラのIPアドレス

frameId: 取得するデータのフレームID

networkTransmitTimeMs: ネットワーク転送時間 (ms)

networkSpeedMbps: ネットワーク速度 (Mbps)

timeout: タイムアウト時間、デフォルトは15000 ms

戻り値: (byte[], byte[])型、画像データと点群データ

public static byte[]? GetPointCloudInPly(string ip, string frameId, int timeout=15000)

PLY形式の点群データを取得

パラメータ:

ip: カメラのIPアドレス

frameId: 取得するデータのフレームID

timeout: タイムアウト時間、デフォルトは15000 ms

戻り値: byte[]型、PLY形式の点群データ

public static List<EpicEyeInfo> SearchCamera()

カメラを検索

戻り値: List<EpicEyeInfo>型、検出されたカメラリスト

Linuxでの実行

Linux環境でDotnetを設定するには、.NET and Ubuntu overview - .NET を参照してください。サンプルディレクトリに移動し、以下を実行します。

dotnet run

Windowsでの実行

  1. Windows環境でDotnetを設定するには、Install .NET on Windows - .NET を参照してください。

    コマンドラインでサンプルディレクトリに移動し、以下を実行します。

    dotnet run
  2. Visual Studioを使用する場合、対応するソリューションファイル(.sln)を直接開き、ソリューションをビルドします。

    csharp 1

    対応するプロジェクトを選択して実行

    csharp 2