SDK Lite
The NcamSDK Lite is provided as a solution for integrations into new or custom render engines. It is a more streamlined and straightforward protocol to implement than the full NcamSDK protocol yet provides more information than a basic FreeD implementation.
Camera telemetry data is streamed on a per frame basis for the following types:
- Camera Pose : Position and Orientation,
- Packet number and frame TimeCode,
- Normalized and Mapped values for Focus, Iris and Zoom (as per the values displayed on the barrel),
- Nodal Shift in meters,
- Lens parametric model, including Focal length, optical center and distortion coefficients.
In it's current implementation, the Lite protocol can be streamed via UDP and Serial.
The UDP data stream can be configured to either broadcast or unicast and the destination IP and port are fully configurable via the Ncam Reality Full UI preferences. By default, SDK lite packets will be sent on port 3004.
The Serial device could be configured as well. The serial parameters are configured according to the table below
Parameter | Value |
---|---|
Baud Rate | 115200 |
Data Bits | 8 |
Parity | None |
Stop Bits | 1 |
Flow Control | None |
The total size of each packet provided by the SDK Lite is smaller that the typical 1500 Bytes used in UDP communication and its format will conform to the specification described by the version of the SDK Lite Protocol.
After a 2 characters control flag (0x0A, 0x0D), the next 8 bytes will always be fixed whatever the version of the SDK Lite protocol. They define the version of the protocol that is streamed and the length of the dynamic section in bytes.
The packets must be checked against their checksum at arrival. This is achieved by computing the sum of all bytes as int8_t starting with the checksum and ending with the last byte of the dynamic section which length is given by #3. A valid packet would sum to zero. Total size of a packet is 134 Bytes. For a 1080p60 video signal, the required bandwidth is 60x134 = 8040 Bytes/sec so under 8KB/sec.
A counter of sent packets since the SDK Lite began streaming.
The SDI source’s timecode.
The translation vector[3] in meters.
Using Eigen, a cross-platform header-only C++ library, we can apply the transformation as follows:
The rotation uses a compact vector[3] Rodrigues representation: - The angle of rotation is given by the module of the input vector. - The axis of rotation is given by the normalized input vector. OpenCV provides a convenient method to convert to and from a 3x3 rotation matrix: void Rodrigues(InputArray src, OutputArray dst, OutputArray jacobian=noArray())
Alternatively the Sophus library provides similar implementation to instantiate rotation matrix from the vector[3] representation.
Eigen, a cross-platform header-only C++ library can handle this vector and produce a rotation matrix and euler angles via the following:
Focus, Iris and Zoom encoder values normalized between 0.0 and 1.0.
World scale values for Focus (in meters), Iris (in T-stops) and Zoom (in mm) from the values engraved on the lens barrels.
The offset in meters from the camera sensor’s image plane to the nodal point of the lens.
This is a vector[15] with 3 distinct sections:
We currently support the following simplified Brown Conrady model:
x = x * (1+k1 x r^2 + k2 r^4);
y = y * (1+k1 x r^2 + k2 r^4);
where r^2 = x^2 + y^2;
The distortion parameters are taking place on a normalized space such that a radius of 1 of r means half diagonal of the image.
- LensParameters[0] is the horizontal focal length, normalized by the image width;
- LensParameters[1] is the vertical focal length, normalized by the image height;
- LensParameters[2] is the horizontal optical center, normalized by the image width, origin is left;
- LensParameters[3] is the vertical optical center, normalized by the image height, origin is top;
- LensParameters[4] is distortion parameter K1;
- LensParameters[5] is distortion parameter K2;
- LensParameters[6] is undistortion parameter K1;
- LensParameters[7] is undistortion parameter K2;