//======= Copyright (c) Stereolabs Corporation, All rights reserved. =============== using System.Runtime.InteropServices; using UnityEngine; /// /// This file holds classes built to be exchanged between the ZED wrapper DLL (sl_unitywrapper.dll) /// and C# scripts within Unity. Most have parity with a structure within the ZED C++ SDK. /// Find more info at https://www.stereolabs.com/developers/documentation/API/latest/. /// namespace sl { public class ZEDCommon { public const string NameDLL = "sl_unitywrapper"; } public enum ZED_CAMERA_ID { CAMERA_ID_01, CAMERA_ID_02, CAMERA_ID_03, CAMERA_ID_04, }; public enum INPUT_TYPE { INPUT_TYPE_USB, INPUT_TYPE_SVO, INPUT_TYPE_STREAM }; /// /// Constant for plugin. Should not be changed /// public enum Constant { MAX_CAMERA_PLUGIN = 4, PLANE_DISTANCE = 10 }; /// /// Holds a 3x3 matrix that can be marshaled between the ZED /// Unity wrapper and C# scripts. /// public struct Matrix3x3 { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 9)] public float[] m; //3x3 matrix. }; /// /// Holds a camera resolution as two pointers (for height and width) for easy /// passing back and forth to the ZED Unity wrapper. /// public struct Resolution { /// /// /// /// /// public Resolution(uint width, uint height) { this.width = (System.UIntPtr)width; this.height = (System.UIntPtr)height; } public System.UIntPtr width; public System.UIntPtr height; }; /// /// Pose structure with data on timing and validity in addition to /// position and rotation. /// [StructLayout(LayoutKind.Sequential)] public struct Pose { public bool valid; public ulong timestap; public Quaternion rotation; public Vector3 translation; public int pose_confidence; }; /// /// Full IMU data structure. /// [StructLayout(LayoutKind.Sequential)] public struct IMUData { /// /// Gyroscope raw data in degrees/second. /// public Vector3 angularVelocity; /// /// Accelerometer raw data in m/s². /// public Vector3 linearAcceleration; /// /// Orientation from gyro/accelerator fusion. /// public Quaternion fusedOrientation; /// /// Covariance matrix of the quaternion. /// public Matrix3x3 orientationCovariance; /// /// Gyroscope raw data covariance matrix. /// public Matrix3x3 angularVelocityCovariance; /// /// Accelerometer raw data covariance matrix. /// public Matrix3x3 linearAccelerationCovariance; /// /// RFU. /// public int imu_image_sync_val; }; /// /// Calibration information for an individual sensor on the ZED (left or right). /// For more information, see: /// https://www.stereolabs.com/developers/documentation/API/v2.5.1/structsl_1_1CameraParameters.html [StructLayout(LayoutKind.Sequential)] public struct CameraParameters { /// /// Focal X. /// public float fx; /// /// Focal Y. /// public float fy; /// /// Optical center X. /// public float cx; /// /// Optical center Y. /// public float cy; /// /// Distortion coefficients. /// [MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.U8, SizeConst = 5)] public double[] disto; /// /// Vertical field of view after stereo rectification. /// public float vFOV; /// /// Horizontal field of view after stereo rectification. /// public float hFOV; /// /// Diagonal field of view after stereo rectification. /// public float dFOV; /// /// Camera's current resolution. /// public Resolution resolution; }; /// /// Holds calibration information about the current ZED's hardware, including per-sensor /// calibration and offsets between the two sensors. /// For more info, see: /// https://www.stereolabs.com/developers/documentation/API/v2.5.1/structsl_1_1CalibrationParameters.html [StructLayout(LayoutKind.Sequential)] public struct CalibrationParameters { /// /// Rotation (using Rodrigues' transformation) between the two sensors. Defined as 'tilt', 'convergence' and 'roll'. /// public Vector3 Rot; /// /// Translation between the two sensors. T[0] is the distance between the two cameras in meters. /// public Vector3 Trans; /// /// Parameters of the left sensor. /// public CameraParameters leftCam; /// /// Parameters of the right sensor. /// public CameraParameters rightCam; }; /// /// Container for information about the current SVO recording process. /// /// Mirrors sl.RecordingState in the ZED C++ SDK. For more info, visit: /// https://www.stereolabs.com/developers/documentation/API/v2.5.1/structsl_1_1RecordingState.html /// [StructLayout(LayoutKind.Sequential)] public struct Recording_state { /// /// Status of the current frame. True if recording was successful, false if frame could not be written. /// public bool status; /// /// Compression time for the current frame in milliseconds. /// public double current_compression_time; /// /// Compression ratio (% of raw size) for the current frame. /// public double current_compression_ratio; /// /// Average compression time in millisecond since beginning of recording. /// public double average_compression_time; /// /// Compression ratio (% of raw size) since recording was started. /// public double average_compression_ratio; } /// /// Status of the ZED's self-calibration. Since v0.9.3, self-calibration is done in the background and /// starts in the sl.ZEDCamera.Init or Reset functions. /// /// Mirrors SELF_CALIBRATION_STATE in the ZED C++ SDK. For more info, see: /// https://www.stereolabs.com/developers/documentation/API/v2.5.1/group__Video__group.html#gacce19db438a07075b7e5e22ee5845c95 /// public enum ZED_SELF_CALIBRATION_STATE { /// /// Self-calibration has not yet been called (no Init() called). /// SELF_CALIBRATION_NOT_CALLED, /// /// Self-calibration is currently running. /// SELF_CALIBRATION_RUNNING, /// /// Self-calibration has finished running but did not manage to get coherent values. Old Parameters are used instead. /// SELF_CALIBRATION_FAILED, /// /// Self Calibration has finished running and successfully produces coherent values. /// SELF_CALIBRATION_SUCCESS }; /// /// Lists available depth computation modes. Each mode offers better accuracy than the /// mode before it, but at a performance cost. /// /// Mirrors DEPTH_MODE in the ZED C++ SDK. For more info, see: /// https://www.stereolabs.com/developers/documentation/API/v2.5.1/group__Depth__group.html#ga8d542017c9b012a19a15d46be9b7fa43 /// public enum DEPTH_MODE { /// /// Does not compute any depth map. Only rectified stereo images will be available. /// NONE, /// /// Fastest mode for depth computation. /// PERFORMANCE, /// /// Balanced quality mode. Depth map is robust in most environment and requires medium compute power. /// MEDIUM, /// /// Favors accuracy over performance. Requires more compute power. /// QUALITY, /// /// Native depth. Very accurate, but at a large performance cost. /// ULTRA }; /// /// Types of Image view modes, for creating human-viewable textures. /// Used only in ZEDRenderingPlane as a simplified version of sl.VIEW, which has more detailed options. /// public enum VIEW_MODE { /// /// Dsplays regular color images. /// VIEW_IMAGE, /// /// Displays a greyscale depth map. /// VIEW_DEPTH, /// /// Displays a normal map. /// VIEW_NORMALS }; /// /// List of error codes in the ZED SDK. /// /// Mirrors ERROR_CODE in the ZED C++ SDK. For more info, read: /// https://www.stereolabs.com/developers/documentation/API/v2.5.1/group__Camera__group.html#ga4db9ee29f2ff83c71567c12f6bfbf28c /// public enum ERROR_CODE { /// /// Operation was successful. /// SUCCESS, /// /// Standard, generic code for unsuccessful behavior when no other code is more appropriate. /// FAILURE, /// /// No GPU found, or CUDA capability of the device is not supported. /// NO_GPU_COMPATIBLE, /// /// Not enough GPU memory for this depth mode. Try a different mode (such as PERFORMANCE). /// NOT_ENOUGH_GPUMEM, /// /// The ZED camera is not plugged in or detected. /// CAMERA_NOT_DETECTED, /// /// a ZED Mini is detected but the inertial sensor cannot be opened. (Never called for original ZED) /// SENSOR_NOT_DETECTED, /// /// For Nvidia Jetson X1 only - resolution not yet supported (USB3.0 bandwidth). /// INVALID_RESOLUTION, /// /// USB communication issues. Occurs when the camera FPS cannot be reached, due to a lot of corrupted frames. /// Try changing the USB port. /// LOW_USB_BANDWIDTH, /// /// ZED calibration file is not found on the host machine. Use ZED Explorer or ZED Calibration to get one. /// CALIBRATION_FILE_NOT_AVAILABLE, /// /// ZED calibration file is not valid. Try downloading the factory one or recalibrating using the ZED Calibration tool. /// INVALID_CALIBRATION_FILE, /// /// The provided SVO file is not valid. /// INVALID_SVO_FILE, /// /// An SVO recorder-related error occurred (such as not enough free storage or an invalid file path). /// SVO_RECORDING_ERROR, /// /// An SVO related error when NVIDIA based compression cannot be loaded /// SVO_UNSUPPORTED_COMPRESSION, /// /// The requested coordinate system is not available. /// INVALID_COORDINATE_SYSTEM, /// /// The firmware of the ZED is out of date. Update to the latest version. /// INVALID_FIRMWARE, /// /// An invalid parameter has been set for the function. /// INVALID_FUNCTION_PARAMETERS, /// /// In grab() only, the current call return the same frame as last call. Not a new frame. /// NOT_A_NEW_FRAME, /// /// In grab() only, a CUDA error has been detected in the process. Activate wrapperVerbose in ZEDManager.cs for more info. /// CUDA_ERROR, /// /// In grab() only, ZED SDK is not initialized. Probably a missing call to sl::Camera::open. /// CAMERA_NOT_INITIALIZED, /// /// Your NVIDIA driver is too old and not compatible with your current CUDA version. /// NVIDIA_DRIVER_OUT_OF_DATE, /// /// The function call is not valid in the current context. Could be a missing a call to sl::Camera::open. /// INVALID_FUNCTION_CALL, /// /// The SDK wasn't able to load its dependencies, the installer should be launched. /// CORRUPTED_SDK_INSTALLATION, /// /// The installed SDK is not the SDK used to compile the program. /// INCOMPATIBLE_SDK_VERSION, /// /// The given area file does not exist. Check the file path. /// INVALID_AREA_FILE, /// /// The area file does not contain enough data to be used ,or the sl::DEPTH_MODE used during the creation of the /// area file is different from the one currently set. /// INCOMPATIBLE_AREA_FILE, /// /// Camera failed to set up. /// CAMERA_FAILED_TO_SETUP, /// /// Your ZED cannot be opened. Try replugging it to another USB port or flipping the USB-C connector (if using ZED Mini). /// CAMERA_DETECTION_ISSUE, /// /// The Camera is already in use by another process. /// CAMERA_ALREADY_IN_USE, /// /// No GPU found or CUDA is unable to list it. Can be a driver/reboot issue. /// NO_GPU_DETECTED, /// /// Plane not found. Either no plane is detected in the scene, at the location or corresponding to the floor, /// or the floor plane doesn't match the prior given. /// PLANE_NOT_FOUND, /// /// Missing or corrupted AI module ressources. /// Please reinstall the ZED SDK with the AI (object detection) module to fix this issue /// AI_MODULE_NOT_AVAILABLE, /// /// The cuDNN library cannot be loaded, or is not compatible with this version of the ZED SDK /// INCOMPATIBLE_CUDNN_VERSION, /// /// End of error code. Used before init has been called. /// ERROR_CODE_LAST }; /// /// Represents the available resolution options. /// public enum RESOLUTION { /// /// 2208*1242. Supported frame rate: 15 FPS. /// HD2K, /// /// 1920*1080. Supported frame rates: 15, 30 FPS. /// HD1080, /// /// 1280*720. Supported frame rates: 15, 30, 60 FPS. /// HD720, /// /// 672*376. Supported frame rates: 15, 30, 60, 100 FPS. /// VGA }; /// /// Types of compatible ZED cameras. /// public enum MODEL { /// /// Original ZED camera. /// ZED, /// /// ZED Mini. /// ZED_M }; /// /// Lists available sensing modes - whether to produce the original depth map (STANDARD) or one with /// smoothing and other effects added to fill gaps and roughness (FILL). /// public enum SENSING_MODE { /// /// This mode outputs the standard ZED depth map that preserves edges and depth accuracy. /// However, there will be missing data where a depth measurement couldn't be taken, such as from /// a surface being occluded from one sensor but not the other. /// Better for: Obstacle detection, autonomous navigation, people detection, 3D reconstruction. /// STANDARD, /// /// This mode outputs a smooth and fully dense depth map. It doesn't have gaps in the data /// like STANDARD where depth can't be calculated directly, but the values it fills them with /// is less accurate than a real measurement. /// Better for: AR/VR, mixed-reality capture, image post-processing. /// FILL }; /// /// Lists available view types retrieved from the camera, used for creating human-viewable (Image-type) textures. /// /// Based on the VIEW enum in the ZED C++ SDK. For more info, see: /// https://www.stereolabs.com/developers/documentation/API/v2.5.1/group__Video__group.html#ga77fc7bfc159040a1e2ffb074a8ad248c /// public enum VIEW { /// /// Left RGBA image. As a ZEDMat, MAT_TYPE is set to MAT_TYPE_8U_C4. /// LEFT, /// /// Right RGBA image. As a ZEDMat, MAT_TYPE is set to sl::MAT_TYPE_8U_C4. /// RIGHT, /// /// Left GRAY image. As a ZEDMat, MAT_TYPE is set to sl::MAT_TYPE_8U_C1. /// LEFT_GREY, /// /// Right GRAY image. As a ZEDMat, MAT_TYPE is set to sl::MAT_TYPE_8U_C1. /// RIGHT_GREY, /// /// Left RGBA unrectified image. As a ZEDMat, MAT_TYPE is set to sl::MAT_TYPE_8U_C4. /// LEFT_UNRECTIFIED, /// /// Right RGBA unrectified image. As a ZEDMat, MAT_TYPE is set to sl::MAT_TYPE_8U_C4. /// RIGHT_UNRECTIFIED, /// /// Left GRAY unrectified image. As a ZEDMat, MAT_TYPE is set to sl::MAT_TYPE_8U_C1. /// LEFT_UNRECTIFIED_GREY, /// /// Right GRAY unrectified image. As a ZEDMat, MAT_TYPE is set to sl::MAT_TYPE_8U_C1. /// RIGHT_UNRECTIFIED_GREY, /// /// Left and right image. Will be double the width to hold both. As a ZEDMat, MAT_TYPE is set to MAT_8U_C4. /// SIDE_BY_SIDE, /// /// Normalized depth image. As a ZEDMat, MAT_TYPE is set to sl::MAT_TYPE_8U_C4. /// Use an Image texture for viewing only. For measurements, use a Measure type instead /// (ZEDCamera.RetrieveMeasure()) to preserve accuracy. /// DEPTH, /// /// Normalized confidence image. As a ZEDMat, MAT_TYPE is set to MAT_8U_C4. /// Use an Image texture for viewing only. For measurements, use a Measure type instead /// (ZEDCamera.RetrieveMeasure()) to preserve accuracy. /// CONFIDENCE, /// /// Color rendering of the normals. As a ZEDMat, MAT_TYPE is set to MAT_8U_C4. /// Use an Image texture for viewing only. For measurements, use a Measure type instead /// (ZEDCamera.RetrieveMeasure()) to preserve accuracy. /// NORMALS, /// /// Color rendering of the right depth mapped on right sensor. As a ZEDMat, MAT_TYPE is set to MAT_8U_C4. /// Use an Image texture for viewing only. For measurements, use a Measure type instead /// (ZEDCamera.RetrieveMeasure()) to preserve accuracy. /// DEPTH_RIGHT, /// /// Color rendering of the normals mapped on right sensor. As a ZEDMat, MAT_TYPE is set to MAT_8U_C4. /// Use an Image texture for viewing only. For measurements, use a Measure type instead /// (ZEDCamera.RetrieveMeasure()) to preserve accuracy. /// NORMALS_RIGHT }; /// /// Lists available camera settings for the ZED camera (contrast, hue, saturation, gain, etc.) /// public enum CAMERA_SETTINGS { /// /// Brightness control. Value should be between 0 and 8. /// BRIGHTNESS, /// /// Contrast control. Value should be between 0 and 8. /// CONTRAST, /// /// Hue control. Value should be between 0 and 11. /// HUE, /// /// Saturation control. Value should be between 0 and 8 /// SATURATION, /// /// Gain control. Value should be between 0 and 100 for manual control. /// If ZED_EXPOSURE is set to -1 (automatic mode), then gain will be automatic as well. /// GAIN, /// /// Exposure control. Value can be between 0 and 100. /// Setting to -1 enables auto exposure and auto gain. /// Setting to 0 disables auto exposure but doesn't change the last applied automatic values. /// Setting to 1-100 disables auto mode and sets exposure to the chosen value. /// EXPOSURE, /// /// Color temperature control. Value should be between 2800 and 6500 with a step of 100. /// WHITEBALANCE, /// /// Defines if the white balance is in automatic mode or not. /// AUTO_WHITEBALANCE, /// /// front LED status (1==enable, 0 == disable) /// LED_STATUS }; /// /// Lists available measure types retrieved from the camera, used for creating precise measurement maps /// (Measure-type textures). /// Based on the MEASURE enum in the ZED C++ SDK. For more info, see: /// https://www.stereolabs.com/developers/documentation/API/v2.5.1/group__Depth__group.html#ga798a8eed10c573d759ef7e5a5bcd545d /// public enum MEASURE { /// /// Disparity map. As a ZEDMat, MAT_TYPE is set to MAT_32F_C1. /// DISPARITY, /// /// Depth map. As a ZEDMat, MAT_TYPE is set to MAT_32F_C1. /// DEPTH, /// /// Certainty/confidence of the disparity map. As a ZEDMat, MAT_TYPE is set to MAT_32F_C1. /// CONFIDENCE, /// /// 3D coordinates of the image points. Used for point clouds in ZEDPointCloudManager. /// As a ZEDMat, MAT_TYPE is set to MAT_32F_C4. The 4th channel may contain the colors. /// XYZ, /// /// 3D coordinates and color of the image. As a ZEDMat, MAT_TYPE is set to MAT_32F_C4. /// The 4th channel encodes 4 UCHARs for colors in R-G-B-A order. /// XYZRGBA, /// /// 3D coordinates and color of the image. As a ZEDMat, MAT_TYPE is set to MAT_32F_C4. /// The 4th channel encode 4 UCHARs for colors in B-G-R-A order. /// XYZBGRA, /// /// 3D coordinates and color of the image. As a ZEDMat, MAT_TYPE is set to MAT_32F_C4. /// The 4th channel encodes 4 UCHARs for color in A-R-G-B order. /// XYZARGB, /// /// 3D coordinates and color of the image. As a ZEDMat, MAT_TYPE is set to MAT_32F_C4. /// Channel 4 contains color in A-B-G-R order. /// XYZABGR, /// /// 3D coordinates and color of the image. As a ZEDMat, MAT_TYPE is set to MAT_32F_C4. /// The 4th channel encode 4 UCHARs for color in A-B-G-R order. /// NORMALS, /// /// Disparity map for the right sensor. As a ZEDMat, MAT_TYPE is set to MAT_32F_C1. /// DISPARITY_RIGHT, /// /// Depth map for right sensor. As a ZEDMat, MAT_TYPE is set to MAT_32F_C1. /// DEPTH_RIGHT, /// /// Point cloud for right sensor. As a ZEDMat, MAT_TYPE is set to MAT_32F_C4. Channel 4 is empty. /// XYZ_RIGHT, /// /// Colored point cloud for right sensor. As a ZEDMat, MAT_TYPE is set to MAT_32F_C4. /// Channel 4 contains colors in R-G-B-A order. /// XYZRGBA_RIGHT, /// /// Colored point cloud for right sensor. As a ZEDMat, MAT_TYPE is set to MAT_32F_C4. /// Channel 4 contains colors in B-G-R-A order. /// XYZBGRA_RIGHT, /// /// Colored point cloud for right sensor. As a ZEDMat, MAT_TYPE is set to MAT_32F_C4. /// Channel 4 contains colors in A-R-G-B order. /// XYZARGB_RIGHT, /// /// Colored point cloud for right sensor. As a ZEDMat, MAT_TYPE is set to MAT_32F_C4. /// Channel 4 contains colors in A-B-G-R order. /// XYZABGR_RIGHT, /// /// Normals vector for right view. As a ZEDMat, MAT_TYPE is set to MAT_32F_C4. /// Channel 4 is empty (set to 0). /// NORMALS_RIGHT }; /// /// Categories indicating when a timestamp is captured. /// public enum TIME_REFERENCE { /// /// Timestamp from when the image was received over USB from the camera, defined /// by when the entire image was available in memory. /// IMAGE, /// /// Timestamp from when the relevant function was called. /// CURRENT }; /// /// Reference frame (world or camera) for tracking and depth sensing. /// public enum REFERENCE_FRAME { /// /// Matrix contains the total displacement from the world origin/the first tracked point. /// WORLD, /// /// Matrix contains the displacement from the previous camera position to the current one. /// CAMERA }; /// /// Possible states of the ZED's Tracking system. /// public enum TRACKING_STATE { /// /// Tracking is searching for a match from the database to relocate to a previously known position. /// TRACKING_SEARCH, /// /// Tracking is operating normally; tracking data should be correct. /// TRACKING_OK, /// /// Tracking is not enabled. /// TRACKING_OFF } /// /// SVO compression modes. /// public enum SVO_COMPRESSION_MODE { /// /// RAW images; no compression. This option can lead to extremely large file sizes. /// RAW_BASED, /// /// Lossless compression based on png/zstd. Average size = 42% of RAW. /// LOSSLESS_BASED, /// /// Lossy compression based on jpeg. Average size = 22% of RAW. /// LOSSY_BASED, /// /// AVCHD Based compression (H264). Available since ZED SDK 2.7 /// AVCHD_BASED, /// /// HEVC Based compression (H265). Available since ZED SDK 2.7 /// HEVC_BASED, } /// /// Streaming codecs /// public enum STREAMING_CODEC { /// /// AVCHD Based compression (H264) /// AVCHD_BASED, /// /// HEVC Based compression (H265) /// HEVC_BASED } /// /// Mesh formats that can be saved/loaded with spatial mapping. /// public enum MESH_FILE_FORMAT { /// /// Contains only vertices and faces. /// PLY, /// /// Contains only vertices and faces, encoded in binary. /// BIN, /// /// Contains vertices, normals, faces, and texture information (if possible). /// OBJ } /// /// Presets for filtering meshes scannedw ith spatial mapping. Higher values reduce total face count by more. /// public enum FILTER { /// /// Soft decimation and smoothing. /// LOW, /// /// Decimate the number of faces and apply a soft smooth. /// MEDIUM, /// /// Drastically reduce the number of faces. /// HIGH, } /// /// Possible states of the ZED's Spatial Mapping system. /// public enum SPATIAL_MAPPING_STATE { /// /// Spatial mapping is initializing. /// SPATIAL_MAPPING_STATE_INITIALIZING, /// /// Depth and tracking data were correctly integrated into the fusion algorithm. /// SPATIAL_MAPPING_STATE_OK, /// /// Maximum memory dedicated to scanning has been reached; the mesh will no longer be updated. /// SPATIAL_MAPPING_STATE_NOT_ENOUGH_MEMORY, /// /// EnableSpatialMapping() wasn't called (or the scanning was stopped and not relaunched). /// SPATIAL_MAPPING_STATE_NOT_ENABLED, /// /// Effective FPS is too low to give proper results for spatial mapping. /// Consider using performance-friendly parameters (DEPTH_MODE_PERFORMANCE, VGA or HD720 camera resolution, /// and LOW spatial mapping resolution). /// SPATIAL_MAPPING_STATE_FPS_TOO_LOW } /// /// Units used by the SDK for measurements and tracking. METER is best to stay consistent with Unity. /// public enum UNIT { /// /// International System, 1/1000 meters. /// MILLIMETER, /// /// International System, 1/100 meters. /// CENTIMETER, /// /// International System, 1/1 meters. /// METER, /// /// Imperial Unit, 1/12 feet. /// INCH, /// /// Imperial Unit, 1/1 feet. /// FOOT } /// /// Struct containing all parameters passed to the SDK when initializing the ZED. /// These parameters will be fixed for the whole execution life time of the camera. /// For more details, see the InitParameters class in the SDK API documentation: /// https://www.stereolabs.com/developers/documentation/API/v2.5.1/structsl_1_1InitParameters.html /// public class InitParameters { public sl.INPUT_TYPE inputType; /// /// Resolution the ZED will be set to. /// public sl.RESOLUTION resolution; /// /// Requested FPS for this resolution. Setting it to 0 will choose the default FPS for this resolution. /// public int cameraFPS; /// /// ID for identifying which of multiple connected ZEDs to use. /// public int cameraID; /// /// Path to a recorded SVO file to play, including filename. /// public string pathSVO = ""; /// /// In SVO playback, this mode simulates a live camera and consequently skipped frames if the computation framerate is too slow. /// public bool svoRealTimeMode; /// /// Define a unit for all metric values (depth, point clouds, tracking, meshes, etc.) Meters are recommended for Unity. /// public UNIT coordinateUnit; /// /// This defines the order and the direction of the axis of the coordinate system. /// LEFT_HANDED_Y_UP is recommended to match Unity's coordinates. /// public COORDINATE_SYSTEM coordinateSystem; /// /// Quality level of depth calculations. Higher settings improve accuracy but cost performance. /// public sl.DEPTH_MODE depthMode; /// /// Minimum distance from the camera from which depth will be computed, in the defined coordinateUnit. /// public float depthMinimumDistance; /// /// Defines if images are horizontally flipped. /// public bool cameraImageFlip; /// /// Defines if measures relative to the right sensor should be computed (needed for MEASURE__RIGHT). /// public bool enableRightSideMeasure; /// /// True to disable self-calibration and use the optional calibration parameters without optimizing them. /// False is recommended, so that calibration parameters can be optimized. /// public bool cameraDisableSelfCalib; /// /// Set the number of buffers for the internal buffer process. LINUX ONLY - NOT CURRENTLY USED IN UNITY PLUGIN. /// public int cameraBufferCountLinux; /// /// True for the SDK to provide text feedback. /// public bool sdkVerbose; /// /// ID of the graphics card on which the ZED's computations will be performed. /// public int sdkGPUId; /// /// If set to verbose, the filename of the log file into which the SDK will store its text output. /// public string sdkVerboseLogFile = ""; /// /// True to stabilize the depth map. Recommended. /// public bool depthStabilization; /// /// Optional path for searching configuration (calibration) file SNxxxx.conf. (introduced in ZED SDK 2.6) /// public string optionalSettingsPath = ""; /// /// True to stabilize the depth map. Recommended. /// public bool cameraDisableIMU; /// /// Path to a recorded SVO file to play, including filename. /// public string ipStream = ""; /// /// Path to a recorded SVO file to play, including filename. /// public ushort portStream = 30000; /// /// Constructor. Sets default initialization parameters recommended for Unity. /// public InitParameters() { this.inputType = sl.INPUT_TYPE.INPUT_TYPE_USB; this.resolution = RESOLUTION.HD720; this.cameraFPS = 60; this.cameraID = 0; this.pathSVO = ""; this.svoRealTimeMode = false; this.coordinateUnit = UNIT.METER; this.coordinateSystem = COORDINATE_SYSTEM.IMAGE; this.depthMode = DEPTH_MODE.PERFORMANCE; this.depthMinimumDistance = -1; this.cameraImageFlip = false; this.cameraDisableSelfCalib = false; this.cameraBufferCountLinux = 4; this.sdkVerbose = false; this.sdkGPUId = -1; this.sdkVerboseLogFile = ""; this.enableRightSideMeasure = false; this.depthStabilization = true; this.optionalSettingsPath = ""; this.cameraDisableIMU = false; this.ipStream = ""; this.portStream = 30000; } } /// /// List of available coordinate systems. Left-Handed, Y Up is recommended to stay consistent with Unity. /// consistent with Unity. /// public enum COORDINATE_SYSTEM { /// /// Standard coordinates system used in computer vision. /// Used in OpenCV. See: http://docs.opencv.org/2.4/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html /// IMAGE, /// /// Left-Handed with Y up and Z forward. Recommended. Used in Unity with DirectX. /// LEFT_HANDED_Y_UP, /// /// Right-Handed with Y pointing up and Z backward. Used in OpenGL. /// RIGHT_HANDED_Y_UP, /// /// Right-Handed with Z pointing up and Y forward. Used in 3DSMax. /// RIGHT_HANDED_Z_UP, /// /// Left-Handed with Z axis pointing up and X forward. Used in Unreal Engine. /// LEFT_HANDED_Z_UP } /// /// Possible states of the ZED's spatial memory area export, for saving 3D features used /// by the tracking system to relocalize the camera. This is used when saving a mesh generated /// by spatial mapping when Save Mesh is enabled - a .area file is saved as well. /// public enum AREA_EXPORT_STATE { /// /// Spatial memory file has been successfully created. /// AREA_EXPORT_STATE_SUCCESS, /// /// Spatial memory file is currently being written to. /// AREA_EXPORT_STATE_RUNNING, /// /// Spatial memory file export has not been called. /// AREA_EXPORT_STATE_NOT_STARTED, /// /// Spatial memory contains no data; the file is empty. /// AREA_EXPORT_STATE_FILE_EMPTY, /// /// Spatial memory file has not been written to because of a bad file name. /// AREA_EXPORT_STATE_FILE_ERROR, /// /// Spatial memory has been disabled, so no file can be created. /// AREA_EXPORT_STATE_SPATIAL_MEMORY_DISABLED }; /// /// Runtime parameters used by the ZEDCamera.Grab() function, and its Camera::grab() counterpart in the SDK. /// [StructLayout(LayoutKind.Explicit)] public struct RuntimeParameters { /// /// Defines the algorithm used for depth map computation, more info : \ref SENSING_MODE definition. /// [FieldOffset(12)] //In 2.2, the runtime parameters need 3 int of offset. public sl.SENSING_MODE sensingMode; /// /// Provides 3D measures (point cloud and normals) in the desired reference frame (default is REFERENCE_FRAME_CAMERA). /// [FieldOffset(16)] public sl.REFERENCE_FRAME measure3DReferenceFrame; /// /// Defines whether the depth map should be computed. /// [MarshalAs(UnmanagedType.U1)] [FieldOffset(20)] public bool enableDepth; /// /// Defines whether the point cloud should be computed (including XYZRGBA). /// [MarshalAs(UnmanagedType.U1)] [FieldOffset(21)] public bool enablePointCloud; } /// /// Part of the ZED (left/right sensor, center) that's considered its center for tracking purposes. /// public enum TRACKING_FRAME { /// /// Camera's center is at the left sensor. /// LEFT_EYE, /// /// Camera's center is in the camera's physical center, between the sensors. /// CENTER_EYE, /// /// Camera's center is at the right sensor. /// RIGHT_EYE }; /// /// Types of USB device brands. /// public enum USB_DEVICE { /// /// Oculus device, eg. Oculus Rift VR Headset. /// USB_DEVICE_OCULUS, /// /// HTC device, eg. HTC Vive. /// USB_DEVICE_HTC, /// /// Stereolabs device, eg. ZED/ZED Mini. /// USB_DEVICE_STEREOLABS }; }// end namespace sl