Skip to main content

SDK Integration Guide

The Vantor Raptor SDK matches camera imagery against high-resolution 3D reference maps (Vantor Vivid Terrain 3DSM and/or Vantor WorldView 3D). It provides two classes, each part of a Raptor product:

  • raptor::guide::PoseEstimator (Raptor Guide™) estimates the camera pose or position of each image independently.
  • raptor::sync::AttitudeTracker (Raptor Sync™) refines camera orientation across an image sequence.

The SDK also provides independent coordinate extraction. The rest of the documentation refers to the classes by name.

This guide covers what the whole SDK shares. Start with the common setup and inputs, then continue to the class you need:

  1. Common setup and inputs: installation, licensing, resources, Config/Context, images, calibration, poses, and threading.
  2. Map inspection and queries: rendering, coverage, and coordinate extraction.
  3. Feature density: inspect an image before estimation.

Each class has its own integration guide, which builds on the common setup:

Prior Pose Covariance describes the prior covariance and search region used by PoseEstimator.

The workflow code below consists of excerpts using application-provided inputs. Runnable examples ship with the SDK under examples/cpp/ (C++) and examples/python/ (Python); see SDK Usage Examples.

Common setup and inputs​

This section applies to both PoseEstimator and AttitudeTracker.

SDK Distribution and Dependencies​

The Raptor SDK is distributed as a shared library:

  • Library file: lib/libraptor.so (linker name; resolves to libraptor.so.<MAJOR> at runtime and libraptor.so.<VERSION> on disk)
  • Header files: Located in the include/ directory
  • Resources: Geo resources in resources/geo/ directory (shipped as a separate package but required for SDK functionality)
  • Dependency reference: docs/markdown/raptor_dependencies.md lists the required compiler/linker flags and the runtime shared-library dependencies (DT_NEEDED entries) of the shipped libraptor.so.

Python Bindings​

Python bindings are available as a wheel package. You can either install the pre-built wheel directly or build from source:

  • Pre-built wheel: See python/ in the release package for installation instructions
  • Build from source: See python/bindings/ in the release package for build instructions
  • Examples: See examples/python/ for the Python versions of the SDK examples
  • PoseEstimator usage: See the PoseEstimator Integration Guide
  • AttitudeTracker usage: See the AttitudeTracker Python sequence loop
  • CANV integration tool: See python/tools/ in the release package for refine_canv_poses.py, an adaptable end-to-end driver that runs every frame of a CANV v6 recording through PoseEstimator and writes a new CANV with the refined poses, covariances, and confidence values attached

GPU Requirements​

The SDK uses Vulkan for GPU acceleration for rendering and computations. See Vulkan for:

  • Vulkan version and feature requirements
  • How to verify GPU support
  • GPU selection on multi-GPU systems

Licensing Overview​

A valid license is required to use the Raptor SDK. The path to the license file must be set in the configuration.

For a detailed description of fingerprint generation, license installation, replacement, and error handling, see the License Management Guide.

Geo Resources​

The Raptor SDK requires geo resources for coordinate transformations, such as the geoid models used to convert heights between the ellipsoid and EGM2008 or EGM96.

The geo resources are distributed separately from the SDK, as the raptor-resources package with its own version number. The package is platform independent, so the same package serves every target platform. Each SDK release requires a specific resources version, and Context construction fails with a message naming the expected version if the resources found do not match. The resources are updated less often than the SDK, so an installed version can often be reused when upgrading the SDK.

Locating the geo resources​

The Context uses the first of these locations that is set:

  1. raptor::Config::geoResourcePath, if non-empty.
  2. The RAPTOR_GEO_RESOURCE_PATH environment variable, pointing to the geo resources directory.
  3. The RAPTOR_DATA_DIR environment variable, pointing to the data directory; the geo resources are expected at $RAPTOR_DATA_DIR/resources/geo.
  4. Otherwise, the default locations, searched in order until compatible resources are found:
    1. data/resources/geo
    2. /usr/local/share/raptor/data/resources/geo
    3. /usr/share/raptor/data/resources/geo
    4. /opt/raptor/share/raptor/data/resources/geo

A path given in Config or an environment variable is used as is: if it does not contain compatible resources, Context construction fails rather than falling back to the default locations.

Configuration Parameters​

raptor::Config holds the options passed to the raptor::Context constructor. The Context copies them when it is constructed: changing a Config afterwards does not affect an existing Context, and each Context has its own options. PoseEstimator per-call tuning is described under Estimation Options.

raptor::Config​

raptor::Config config{
.licensePath = "/path/to/license.license",
.mapPaths = {"path/to/map.3dtiles.zip"},
// .coordinateEpoch = 2025.0f, // optional, tectonic-shift correction
};
FieldRequiredDefaultNotes
licensePathyes—See License Management
mapPathsyes—One or more .r3db / .3tz / .3dtiles.zip files; lower index = higher rendering priority, see Map Priority
detailStage1no8Initial search detail (7 = faster, 9 = more accurate)
detailStage2no9Refinement detail (8 = faster, 10 = more accurate)
coordinateEpochnounusedDecimal year for tectonic-plate correction; at most two decimal places recommended (e.g. 2025.83)
geoResourcePathnoauto-discoverSee Geo Resources
loggernoInfo → stdoutSee Logger
memoryBudgetno256 MiB GPU / 1 GiB hostSee Memory Budget
cpuBudgetnoall available CPUsSee CPU Budget
gpuPrioritynoMediumSee GPU Priority
Map Priority​

Rendering priority is given to maps with a lower index in mapPaths, so if the same area is covered by multiple maps, the first in the list will be drawn, regardless of which surface is higher. Put small, detailed or recent maps (e.g. an update patch) before the larger base map they overlap.

Maps with a higher index are still drawn wherever no lower-indexed map has data, including directly adjacent to it. A large base map listed after a small patch therefore surrounds the patch, and fills everything outside it.

config.mapPaths = {
"/maps/city.3dtiles.zip", // 1st: drawn wherever it has data
"/maps/region.3dtiles.zip", // 2nd: drawn where the 1st has no data
"/maps/country.3dtiles.zip", // 3rd: drawn where neither the 1st nor 2nd has data
};

Note: Where maps meet, differences in texture and geometry can produce visible seams or steps along the border. Where possible, use maps that are consistent with each other.

The same rule applies however the list is supplied: a mapPaths array in a JSON configuration keeps its array order.

Logger Configuration​

Each raptor::Context has its own logger, configured by the logger field of the Config it was constructed with. All log output from that Context, and from the objects and calls using it, goes through that logger. By default, messages at Info level and above are formatted and written to stdout.

config.logger = {
.name = "my-app", // surfaced as LogMessage::name
.level = raptor::LogLevel::Info, // minimum level (default: Info)
};

raptor::LogLevel is ordered Trace < Debug < Info < Warning < Error < Critical < Off. Setting level enables that level and all higher ones; Off disables logging entirely.

To route messages elsewhere, set logger.callback. The callback receives a raptor::LogMessage containing level, timestamps, formatted message and logger name.

config.logger.callback = [](const raptor::LogMessage& msg) {
std::cerr << "[" << msg.name << "] " << msg.message << '\n';
};

The callback may be invoked from any thread and must be thread-safe. Any state it captures must outlive the owning raptor::Context. A nullptr callback disables external log delivery.

Memory Budget Configuration​

raptor::Config::memoryBudget reserves memory headroom outside the SDK's map-data caches. These are reserve targets, not maximum cache sizes - the SDK derives cache capacity from the reported memory budget, these reserves, and memory used by other consumers; they do not bound the SDK's total memory use.

config.memoryBudget = {
.gpuReserveBytes = 256ull * 1024 * 1024, // default: 256 MiB
.hostReserveBytes = 1024ull * 1024 * 1024, // default: 1 GiB
};
FieldDefaultNotes
gpuReserveBytes256 MiBTarget GPU (device-local) memory kept available outside the map cache; capped at half the reported device-local budget
hostReserveBytes1 GiBTarget host memory kept available outside the map cache, under the machine's memory limit (or cgroup limit where one applies)

CPU Budget Configuration​

raptor::Config::cpuBudget restricts the threads the SDK starts to a set of logical CPUs, chosen from those available to the thread creating the Context. Application threads are not affected.

config.cpuBudget = {
.maxCount = 4, // default: 0 (all available)
// .allowed = {4, 5, 6, 7}, // default: empty (all available)
};
FieldDefaultNotes
maxCount0 (all)Use at most this many CPUs, preferring separate physical cores and faster cores
allowedempty (all)Use only these logical CPU indices; Context construction throws if any is not available

Depending on the system, threads started by the GPU driver may not be restricted.

GPU Priority Configuration​

raptor::Config::gpuPriority sets the priority of the SDK's GPU work relative to other processes using the same GPU.

config.gpuPriority = raptor::GpuPriority::High; // default: GpuPriority::Medium

See GPU priority for the levels, the required Vulkan support and how to check that a level was applied.

Loading Configuration from JSON​

raptor::parseConfigFromJson() populates a raptor::Config from a JSON file, useful for deploying or switching configurations without recompiling. PoseEstimator per-call Estimation Options are set programmatically.

Schema​

The JSON keys mirror the field names on raptor::Config:

{
"licensePath": "/path/to/license.license",
"mapPaths": ["/path/to/map1.3dtiles.zip", "/path/to/map2.3dtiles.zip"],
"detailStage1": 8,
"detailStage2": 9,
"coordinateEpoch": 2025.0,
"memoryBudget": {
"gpuReserveBytes": 268435456,
"hostReserveBytes": 1073741824
},
"cpuBudget": {
"maxCount": 4,
"allowed": [0, 1, 2, 3]
},
"gpuPriority": "High"
}

licensePath and mapPaths are required on the resulting raptor::Config before Context construction, but they may be left empty ("" or []) in the JSON and supplied at runtime. The parser only fails if these keys are missing altogether. All remaining keys are optional; see Configuration Parameters for defaults and meaning.

Usage​

auto parsed = raptor::parseConfigFromJson("config.json");
if (auto* failure = std::get_if<raptor::ConfigParseFailure>(&parsed)) {
// failure->error / failure->field / failure->detail describe the issue
return;
}
auto config = std::get<raptor::Config>(parsed);

// Fill in anything left empty in the JSON
if (config.licensePath.empty()) config.licensePath = "/path/to/license.license";
if (config.mapPaths.empty()) config.mapPaths = {"/path/to/map.3dtiles.zip"};

raptor::Context context{config};

The config_from_json example reads a configuration file this way and prints the error for a file that cannot be used.

Creating the Context​

Construct a raptor::Context from a raptor::Config. Construction resolves the geo resources, verifies the license, loads the maps, and prepares the GPU. Do not destroy a Context while an object created from it still exists or a call using it is running.

#include <raptor/Config.hpp>
#include <raptor/Context.hpp>

raptor::Config config{};
config.licensePath = licensePath;
config.mapPaths = {mapPath};
raptor::Context context{config};

The equivalent Python setup is:

import raptor

config = raptor.Config()
config.license_path = license_path
config.map_paths = [map_path]
context = raptor.Context(config)

The workflow excerpts in this and the component guides reuse this context and application-provided image data, calibration, poses, and capture timestamps.

Use a single Context per process. Creating more than one is possible, but each instance loads its own maps and GPU state, so they compete for GPU and host memory without adding any capability. Construction loads maps and initializes GPU resources, so create the Context once and reuse it rather than creating one per frame. To process several images at once, share the single Context between threads (see Thread safety).

The maps of a Context cannot be changed or replaced after it is created. To switch maps, finish all calls, destroy the objects created from the Context and the Context itself, then create a new Context and new objects.

Initialization errors​

raptor::Context construction throws on failure. Wrap construction in try/catch; std::runtime_error covers missing resources and other initialization failures, and std::invalid_argument covers malformed configuration.

try {
raptor::Context context{config};
} catch (const std::runtime_error& e) {
std::cerr << "SDK initialization failed: " << e.what() << std::endl;
} catch (const std::invalid_argument& e) {
std::cerr << "Invalid configuration: " << e.what() << std::endl;
}

For operation-specific result handling, see PoseEstimator errors, AttitudeTracker errors, or map operations.

Input Requirements​

Images are passed using the raptor::ImageView or raptor::Image type:

  • Supported Formats:
    • raptor::ImageType::Gray8 - Grayscale, 8-bit, single channel (1 byte/pixel)
    • raptor::ImageType::Rgb8 - RGB, 8-bit per channel, interleaved (3 bytes/pixel)
    • raptor::ImageType::Rgba8 - RGBA, 8-bit per channel, interleaved (4 bytes/pixel)
  • Layout: Row-major, top-to-bottom, left-to-right, channels interleaved
  • Size: Width and height are carried by each image. They must be positive, match its pixel storage, and not exceed the GPU's maximum image dimension (Vulkan maxImageDimension2D); larger images are rejected with InvalidInput.
  • Memory: Contiguous array of width × height × bytesPerPixel bytes
  • Preprocessing: Supply a supported lens model matching the actual image geometry and distortion; see the operation-specific requirements below.

Lens Model​

Camera parameters are passed using the raptor::LensModel type.

All SDK classes and functions that take a LensModel accept Pinhole, VantorPolynomialRadial, and RationalRadialTangential. The exception is map rendering: renderMap() and renderMapCoverage() accept Pinhole only and return OperationError::InvalidInput for other models.

The Python bindings follow the same rule.

The radial models' equations and parameter units are documented in include/raptor/lens.hpp. RationalRadialTangential matches OpenCV's rational model; VantorPolynomialRadial coefficients are not interchangeable with OpenCV radial coefficients.

Supply distorted imagery with the matching radial model. The image does not need to be undistorted outside the SDK; the SDK handles the undistortion itself. Where only Pinhole is accepted, rectify distorted imagery externally and provide the calibration of the resulting pinhole image. After crop, resize, zoom, or rectification, update calibration and selected pixel coordinates to describe the supplied image grid. The SDK does not provide a general-purpose public undistortion function.

Construct the LensModel from your camera calibration. Explicit parameters are the recommended form.

Pinhole — undistorted or rectified imagery:

auto lens = raptor::LensModel{
raptor::lens::Pinhole{.fx = focalX, .fy = focalY,
.cx = centerX, .cy = centerY}
};

RationalRadialTangential — distorted imagery, OpenCV rational calibration:

auto lens = raptor::LensModel{
raptor::lens::RationalRadialTangential{.fx = focalX, .fy = focalY,
.cx = centerX, .cy = centerY,
.k1 = k1, .k2 = k2, .k3 = k3,
.k4 = k4, .k5 = k5, .k6 = k6,
.p1 = p1, .p2 = p2}
};

Use the coefficients exactly as produced by an OpenCV calibration with the rational model (k1, k2, p1, p2, k3, k4, k5, k6); leave unused coefficients at zero.

Alternative — pinhole from field of view:

auto lens = raptor::LensModel{
raptor::lens::Pinhole::fromFov(hFovRad, vFovRad, imageWidth, imageHeight)
};

Pinhole::fromFov(...) is a convenience for cases where only the horizontal and vertical field of view are known. It assumes the principal point is at the image center and derives focal lengths from the FOV; if your calibrated principal point is offset from the center, prefer the explicit form above for best accuracy.

  • Field of View: Must match actual camera calibration. Fisheye models are not supported by these operations.
  • Units: Radians for FOV, pixels for pinhole parameters

Pose​

Poses are passed using the pose types (raptor::pose::Ecef or raptor::pose::Geodetic). A pose contains the position coordinates and the attitude.

// Geodetic pose (default CRS: ITRF2008, degrees, meters, ellipsoid height)
raptor::pose::Geodetic geodPose{
.coords = {.lat = latDeg, .lon = lonDeg, .alt = altMeters},
.attitude = {.x = qx, .y = qy, .z = qz, .w = qw},
};

// Or ECEF
raptor::pose::Ecef ecefPose{
.coords = {.x = x, .y = y, .z = z},
.attitude = {.x = qx, .y = qy, .z = qz, .w = qw},
};

See Coordinate Reference Systems for how to override the CRS on a pose, and Conventions for the attitude and NED conventions.

Image Timestamp​

Every image is passed with a timestamp identifying when it was captured:

  • The timestamp must reflect the image capture time, not the time of the SDK call.
  • It must be positive. The epoch is application-defined and must be consistent across calls within your application.
  • C++ takes std::chrono::nanoseconds. Python takes datetime.timedelta, which has microsecond resolution; avoid floating-point conversion of large epoch timestamps.
  • Successful results carry the supplied timestamp unchanged, so they can be correlated with the source frame.

PoseEstimator processes images independently; see its debug-capture rules. AttitudeTracker requires strictly increasing timestamps on each tracker; see AttitudeTracker inputs.

Coordinate Reference Systems​

The SDK supports two coordinate systems on inputs and outputs:

  • raptor::pose::Ecef — Cartesian [X, Y, Z] in meters from Earth's center.
  • raptor::pose::Geodetic — [lat, lon, alt] with attitude relative to local NED.

For the underlying geodetic, NED and attitude conventions see Conventions. This section only documents how to configure the CRS on a pose.

Each pose carries its own CRS in a .crs field; the defaults are:

CRS fieldDefaultOther values
referenceFrameItrf2008Wgs84g1674
horizontalUnit (Geodetic)DegreesRadians
verticalUnit (Geodetic)MeterFoot (= 0.3048 m)
heightSystem (Geodetic)Ellipsoid (HAE)Egm2008, Egm96 (geoids / HAMSL)

Example​

// Default CRS: ITRF2008, degrees, meters, ellipsoid height
raptor::pose::Geodetic pose{
.coords = {.lat = 39.5, .lon = -77.5, .alt = 1542},
.attitude = {.x = 0, .y = 0, .z = 0, .w = 1},
};

// Override individual CRS fields as needed
raptor::pose::Geodetic poseRadFeetGeoid{
.coords = {.lat = 0.6894, .lon = -1.352, .alt = 5059},
.attitude = {.x = 0, .y = 0, .z = 0, .w = 1},
.crs = {
.horizontalUnit = raptor::crs::HorizontalUnit::Radians,
.verticalUnit = raptor::crs::VerticalUnit::Foot,
.heightSystem = raptor::crs::HeightSystem::Egm2008,
},
};

The examples shipped with the SDK pass the same poses in the coordinate reference system chosen with their --crs and --height-system options, and the query_map_intersection example also in the units chosen with --angle-unit and --height-unit.

Thread safety​

A raptor::Context can be shared by any number of threads. All core SDK functions and objects that use it may be called concurrently, in any combination, without external locking. The exception is the stateful raptor::sync::AttitudeTracker: call one tracker's update() one call at a time, in capture order. Different trackers may be used concurrently.

Things to keep in mind:

  • Concurrent calls share the Context's GPU and worker threads, so each call may take longer than it would alone.
  • Images passed to concurrent calls are only read, so the same image may be passed to several calls at once. It must stay valid until every call using it has returned.
  • The Context and its dependent SDK objects must not be destroyed while another thread is still calling into them.
  • The log callback may be called from several threads at once (see Logger Configuration).

Map Inspection and Queries​

These are independent SDK operations and do not require a preceding PoseEstimator or AttitudeTracker call. The render_map and query_map_intersection examples show them. For pose-based operations, supply a full pose and calibration matching the image/pixels being interpreted; the pose can come from PoseEstimator, AttitudeTracker, or another source. Position-only PoseEstimator output must be combined with a suitable orientation before a pixel query.

The top-level map functions use the maps and resources owned by raptor::Context. They do not require an estimator or tracker instance. Rendering, coverage rendering, and pixel-based intersection queries take a positive image width and height, describing the image grid used by the calibration and pixel coordinates.

Rendering the map from a viewpoint​

raptor::renderMap() renders the loaded 3D map from a given camera viewpoint as a grayscale image. It is useful for manually validating that a prior pose lines up with the map, or for inspecting the input the estimator would see during refinement. It requires pinhole calibration.

#include <raptor/render.hpp>

auto result = raptor::renderMap(context, lens, pose, width, height);
if (auto* image = std::get_if<raptor::Image>(&result)) {
// image holds the rendered map view at the given pose
} else {
// std::get<raptor::OperationError>(result) describes the failure
}

See Map coverage for the related raptor::renderMapCoverage(), which renders an 8-bit coverage mask for the same viewpoint.

Map coverage​

To inspect coverage from a camera viewpoint, call raptor::renderMapCoverage() with the same inputs as renderMap(). It returns an 8-bit mask of the same dimensions as the rendered map view (0xFF = covered, 0x00 = no map).

auto result = raptor::renderMapCoverage(context, lens, pose, width, height);
if (auto* image = std::get_if<raptor::Image>(&result)) {
// pixels: 0xFF where the map covers the view, 0x00 otherwise
} else {
// std::get<raptor::OperationError>(result) describes the failure
}

Map intersection queries​

The position, ray, and pixel overloads have different inputs; see lens-model support for the pixel overload. Check each returned point for its own MapQueryError before using it: non-finite or out-of-bounds pixel coordinates, and pixels without a finite forward ray through the lens model, return MapQueryError::InvalidInput in their entry.

raptor::queryMapIntersection() returns the 3D point on the map surface hit by a given input. Three forms are provided in <raptor/query.hpp>:

  • From a horizontal location — casts straight down from the supplied position and returns the surface hit. Useful for looking up the map surface height at a (lat, lon) or (x, y, z).
  • From a Ray — casts the supplied origin + direction and returns the first surface hit.
  • Per-pixel — given a LensModel, Pose, and image width and height, casts a ray through each supplied pixel coordinate and returns one hit per pixel.
#include <raptor/query.hpp>

// 1. Lookup the map surface point directly below a geodetic location.
raptor::position::Geodetic above{
.coords = {.lat = 39.5, .lon = -77.5, .alt = 1500.0},
};
auto hit = raptor::queryMapIntersection(context, above);
if (auto* surface = std::get_if<raptor::position::Geodetic>(&hit)) {
// surface->coords.alt is the map-surface height at (lat, lon)
} else {
// std::get<raptor::MapQueryError>(hit) describes the failure
}

// 2. Cast a ray and return the first map-surface hit.
raptor::ray::Geodetic ray{
.origin = {.coords = {.lat = 39.5, .lon = -77.5, .alt = 1500.0}},
.direction = {.north = 0.0, .east = 0.0, .down = 1.0},
};
auto rayHit = raptor::queryMapIntersection(context, ray);

// 3. Per-pixel intersection for an image grid.
std::vector<raptor::PixelCoordinates> pixels{ {320, 240}, {640, 480} };
auto perPixel = raptor::queryMapIntersection(context, lens, pose, width, height, pixels);
for (auto& entry : perPixel) {
if (auto* p = std::get_if<raptor::position::Geodetic>(&entry)) {
// p->coords holds the surface hit for this pixel
}
}

PixelCoordinates use fractional pixel coordinates with [0, 0] at the upper-left corner of the upper-left pixel and [width, height] at the lower-right corner of the lower-right pixel. Overloads taking position::Geodetic / position::Ecef (and the equivalent ray::* / pose::* forms) return the matching concrete type directly; the generic Position / Ray / Pose overloads return a Position variant.

Note: queryMapIntersection() returns the map-surface hit, not the bare ground. If the map contains buildings or trees at the query location, the rooftop or canopy is returned.

Feature density: computeFeatureDensity​

The feature-density check is exposed as a standalone helper for filtering frames before calling the estimator:

#include <raptor/analyze.hpp>

auto density = raptor::computeFeatureDensity(context, image);
if (auto* value = std::get_if<float>(&density)) {
// Apply an application-specific frame acceptance policy to *value.
} else {
// std::get<raptor::OperationError>(density) describes the failure.
}

Further reference​