Rerun C++ SDK
Loading...
Searching...
No Matches
rerun::archetypes::Pinhole Struct Reference

Archetype: Camera perspective projection (a.k.a. More...

#include <rerun/archetypes/pinhole.hpp>

Public Types

using IndicatorComponent = components::IndicatorComponent< IndicatorComponentName >
 Indicator component, used to identify the archetype when converting to a list of components.
 

Public Member Functions

Pinhole with_resolution (float width, float height) &&
 Pixel resolution (usually integers) of child image space.
 
Pinhole with_resolution (int width, int height) &&
 Pixel resolution (usually integers) of child image space.
 
 Pinhole (Pinhole &&other)=default
 
 Pinhole (rerun::components::PinholeProjection _image_from_camera)
 
Pinhole with_resolution (rerun::components::Resolution _resolution) &&
 Pixel resolution (usually integers) of child image space.
 
Pinhole with_camera_xyz (rerun::components::ViewCoordinates _camera_xyz) &&
 Sets the view coordinates for the camera.
 
size_t num_instances () const
 Returns the number of primary instances of this archetype.
 

Static Public Member Functions

static Pinhole from_focal_length_and_resolution (const datatypes::Vec2D &focal_length, const datatypes::Vec2D &resolution)
 Creates a pinhole from the camera focal length and resolution, both specified in pixels.
 
static Pinhole from_focal_length_and_resolution (float focal_length, const datatypes::Vec2D &resolution)
 Creates a symmetric pinhole from the camera focal length and resolution, both specified in pixels.
 

Public Attributes

rerun::components::PinholeProjection image_from_camera
 Camera projection, from image coordinates to view coordinates.
 
std::optional< rerun::components::Resolutionresolution
 Pixel resolution (usually integers) of child image space.
 
std::optional< rerun::components::ViewCoordinatescamera_xyz
 Sets the view coordinates for the camera.
 

Static Public Attributes

static constexpr const char IndicatorComponentName [] = "rerun.components.PinholeIndicator"
 

Detailed Description

Archetype: Camera perspective projection (a.k.a.

intrinsics).

Example

Simple Pinhole Camera

image

#include <rerun.hpp>
#include <algorithm> // std::generate
#include <cstdlib> // std::rand
#include <vector>
int main() {
const auto rec = rerun::RecordingStream("rerun_example_line_strip3d");
rec.spawn().exit_on_failure();
rec.log("world/image", rerun::Pinhole::from_focal_length_and_resolution(3.0f, {3.0f, 3.0f}));
std::vector<uint8_t> random_data(3 * 3 * 3);
std::generate(random_data.begin(), random_data.end(), [] {
return static_cast<uint8_t>(std::rand());
});
const auto tensor = rerun::datatypes::TensorData({3, 3, 3}, random_data);
rec.log("world/image", rerun::Image(tensor));
}
A RecordingStream handles everything related to logging data into Rerun.
Definition recording_stream.hpp:57
Archetype: A monochrome or color image.
Definition image.hpp:66
Datatype: A multi-dimensional Tensor of data.
Definition tensor_data.hpp:29

Member Function Documentation

◆ from_focal_length_and_resolution() [1/2]

static Pinhole rerun::archetypes::Pinhole::from_focal_length_and_resolution ( const datatypes::Vec2D focal_length,
const datatypes::Vec2D resolution 
)
static

Creates a pinhole from the camera focal length and resolution, both specified in pixels.

The focal length is the diagonal of the projection matrix. Set the same value for x & y value for symmetric cameras, or two values for anamorphic cameras.

Assumes the principal point to be in the middle of the sensor.

◆ from_focal_length_and_resolution() [2/2]

static Pinhole rerun::archetypes::Pinhole::from_focal_length_and_resolution ( float  focal_length,
const datatypes::Vec2D resolution 
)
inlinestatic

Creates a symmetric pinhole from the camera focal length and resolution, both specified in pixels.

The focal length is the diagonal of the projection matrix.

Assumes the principal point to be in the middle of the sensor.

◆ with_resolution() [1/3]

Pinhole rerun::archetypes::Pinhole::with_resolution ( float  width,
float  height 
) &&
inline

Pixel resolution (usually integers) of child image space.

Width and height.

image_from_camera project onto the space spanned by (0,0) and resolution - 1.

◆ with_resolution() [2/3]

Pinhole rerun::archetypes::Pinhole::with_resolution ( int  width,
int  height 
) &&
inline

Pixel resolution (usually integers) of child image space.

Width and height.

image_from_camera project onto the space spanned by (0,0) and resolution - 1.

◆ with_resolution() [3/3]

Pinhole rerun::archetypes::Pinhole::with_resolution ( rerun::components::Resolution  _resolution) &&
inline

Pixel resolution (usually integers) of child image space.

Width and height.

Example:

[1920.0, 1440.0]

image_from_camera project onto the space spanned by (0,0) and resolution - 1.

◆ with_camera_xyz()

Pinhole rerun::archetypes::Pinhole::with_camera_xyz ( rerun::components::ViewCoordinates  _camera_xyz) &&
inline

Sets the view coordinates for the camera.

All common values are available as constants on the components.ViewCoordinates class.

The default is ViewCoordinates::RDF, i.e. X=Right, Y=Down, Z=Forward, and this is also the recommended setting. This means that the camera frustum will point along the positive Z axis of the parent space, and the cameras "up" direction will be along the negative Y axis of the parent space.

The camera frustum will point whichever axis is set to F (or the opposite of B). When logging a depth image under this entity, this is the direction the point cloud will be projected. With RDF, the default forward is +Z.

The frustum's "up" direction will be whichever axis is set to U (or the opposite of D). This will match the negative Y direction of pixel space (all images are assumed to have xyz=RDF). With RDF, the default is up is -Y.

The frustum's "right" direction will be whichever axis is set to R (or the opposite of L). This will match the positive X direction of pixel space (all images are assumed to have xyz=RDF). With RDF, the default right is +x.

Other common formats are RUB (X=Right, Y=Up, Z=Back) and FLU (X=Forward, Y=Left, Z=Up).

NOTE: setting this to something else than RDF (the default) will change the orientation of the camera frustum, and make the pinhole matrix not match up with the coordinate system of the pinhole entity.

The pinhole matrix (the image_from_camera argument) always project along the third (Z) axis, but will be re-oriented to project along the forward axis of the camera_xyz argument.

Member Data Documentation

◆ resolution

std::optional<rerun::components::Resolution> rerun::archetypes::Pinhole::resolution

Pixel resolution (usually integers) of child image space.

Width and height.

Example:

[1920.0, 1440.0]

image_from_camera project onto the space spanned by (0,0) and resolution - 1.

◆ camera_xyz

std::optional<rerun::components::ViewCoordinates> rerun::archetypes::Pinhole::camera_xyz

Sets the view coordinates for the camera.

All common values are available as constants on the components.ViewCoordinates class.

The default is ViewCoordinates::RDF, i.e. X=Right, Y=Down, Z=Forward, and this is also the recommended setting. This means that the camera frustum will point along the positive Z axis of the parent space, and the cameras "up" direction will be along the negative Y axis of the parent space.

The camera frustum will point whichever axis is set to F (or the opposite of B). When logging a depth image under this entity, this is the direction the point cloud will be projected. With RDF, the default forward is +Z.

The frustum's "up" direction will be whichever axis is set to U (or the opposite of D). This will match the negative Y direction of pixel space (all images are assumed to have xyz=RDF). With RDF, the default is up is -Y.

The frustum's "right" direction will be whichever axis is set to R (or the opposite of L). This will match the positive X direction of pixel space (all images are assumed to have xyz=RDF). With RDF, the default right is +x.

Other common formats are RUB (X=Right, Y=Up, Z=Back) and FLU (X=Forward, Y=Left, Z=Up).

NOTE: setting this to something else than RDF (the default) will change the orientation of the camera frustum, and make the pinhole matrix not match up with the coordinate system of the pinhole entity.

The pinhole matrix (the image_from_camera argument) always project along the third (Z) axis, but will be re-oriented to project along the forward axis of the camera_xyz argument.


The documentation for this struct was generated from the following file: