PoseEstimator Integration Guide
raptor::guide::PoseEstimator, part of Raptor Guide™, estimates the camera pose or position of each image independently by matching it against licensed 3D reference maps.
It has no knowledge of previous frames or the camera's mounting relative to the aircraft.
The application supplies an approximate camera pose and matching calibration, and may supply covariance to search around the prior.
PoseEstimator can support GNSS-independent navigation when integrated and fused with other sensors.
It estimates the camera's pose, rather than aircraft heading or velocity, and is not a standalone navigation system.
The integrating application decides which results to accept and how to combine them with other sensors.
Quick Start
Complete the common setup and create a Context as described in Creating the Context, then construct one PoseEstimator and reuse it for your images.
1. Basic Integration
The following excerpt shows the PoseEstimator workflow with application-supplied image pixels, calibration, pose, and capture timestamp.
#include <raptor/Config.hpp>
#include <raptor/Context.hpp>
#include <raptor/guide/PoseEstimator.hpp>
#include <raptor/image.hpp>
#include <raptor/lens.hpp>
#include <raptor/geo.hpp>
// Reuse the Context created during common setup.
// Initialize the PoseEstimator with the context
raptor::guide::PoseEstimator estimator{context};
// Create image view, lens model, and pose
raptor::ImageView image{raptor::ImageType::Gray8, imageWidth, imageHeight, grayImageData};
auto lens = raptor::LensModel{
raptor::lens::Pinhole::fromFov(hFovRad, vFovRad, imageWidth, imageHeight)
};
// Create pose with geodetic position and attitude, using default CRS
// (degrees for lat/lon, meters for altitude, ellipsoid height system, ITRF2008)
raptor::pose::Geodetic initialPose{
.coords = {.lat = latDeg, .lon = lonDeg, .alt = altMeters},
.attitude = {.x = qx, .y = qy, .z = qz, .w = qw}
};
// Process image (per-call tuning lives on EstimationOptions)
auto result = estimator.updatePose(image, lens, initialPose, timestamp);
// Validate results
if (auto* output = std::get_if<raptor::guide::PoseOutput<raptor::pose::Geodetic>>(&result);
output && output->confidence >= 0.7) {
// Extract refined pose
auto refinedPose = output->pose;
// Use refinedPose.coords (position) and refinedPose.attitude (quaternion)
}
Alternative: Position-only estimation
auto result = estimator.updatePosition(image, lens, initialPose, timestamp);
// Returns PositionOutput with refined position only (no updated attitude)
2. Complete Examples
Complete examples ship with the SDK as examples/cpp/pose_estimator.cpp (C++) and examples/python/pose_estimator.py (Python). They refine deliberately inaccurate poses and have options for the prior covariance, time limits, position-only estimation, and geodetic or ECEF coordinates; see SDK Usage Examples.
See also Conventions for detailed coordinate system and attitude representation guide.
Input Requirements
Use the SDK's image storage, pose, and CRS conventions. Supply calibration matching the image: a pinhole model, or the matching radial model for distorted imagery. See the common lens-model support.
Image Timestamp
Each updatePose() / updatePosition() call takes a mandatory capture
timestamp; follow the common timestamp rules.
PoseEstimator processes images independently and imposes no sequence-order requirement.
While Debug Capture is active, a timestamp must also not
precede the timestamp of the first frame captured since startDebug().
Frames violating this or the positivity rule are dropped from the debug
archive (an error is logged) while the updatePose() / updatePosition()
call itself still runs and returns normally.
Prior covariance
Supplying a 6×6 prior covariance to updatePose() / updatePosition() lets
the SDK search a region around the prior instead of refining a single
hypothesis. Without covariance, only that single hypothesis is tested — fast,
but only suitable when the prior pose is already close to the true pose.
Prior Pose Covariance describes how to build the matrix, its layout,
how to rotate it from other frames, and how it determines the search region.
Pass the same confidence interval to poseCovarianceFromSearchRanges() and
EstimationOptions::confidenceInterval. The output covariance on
PoseOutput::covariance / PositionOutput::covariance uses the same camera frame.
Estimation Options
Pass raptor::guide::EstimationOptions to each updatePose() or updatePosition() call.
Options that apply to the whole Context, such as maps and detail levels, are set on its
Config instead.
raptor::guide::EstimationOptions options{
.confidenceInterval = 0.95,
.featureDensityCheck = true,
.maxTime = std::chrono::milliseconds(1000),
};
auto result = estimator.updatePose(image, lens, pose, timestamp, covariance, options);
| Field | Default | Notes |
|---|---|---|
confidenceInterval | 0.90 | Search-region coverage (0.68 ≈ 1σ, 0.95 ≈ 2σ); see Search Range |
featureDensityCheck | false | Reject visually ambiguous frames early (see below) |
exhaustiveRangeSearch | false | More thorough search within the same region; see Exhaustive Range Search |
maxTime | unbounded | Wall-clock limit; the best result found so far is returned. Estimation time varies with the platform and the size of the search region, so set it for real-time use. |
Feature Density Pre-check
With featureDensityCheck = true, the estimator computes feature density
before running the range search and returns
PoseEstimationError::PoorFeatureDensity for inputs that look visually
ambiguous (e.g. uniform surfaces). This avoids spending time on frames
that are unlikely to yield a reliable pose.
See computeFeatureDensity to inspect feature density before calling the estimator.
Exhaustive Range Search
EstimationOptions::exhaustiveRangeSearch = true performs a more thorough
search within the same search region (it does not enlarge it). It can
improve accuracy in difficult scenes at a significant runtime cost; pair
with EstimationOptions::maxTime to bound the call.
raptor::guide::EstimationOptions options{
.exhaustiveRangeSearch = true,
.maxTime = std::chrono::milliseconds(2000),
};
auto result = estimator.updatePose(image, lens, pose, timestamp, covariance, options);
Error Handling
PoseEstimator construction can throw; use the same exception handling as for Context initialization.
Per-call results
updatePose() and updatePosition() do not throw. Each returns a
std::variant that holds either a PoseOutput / PositionOutput on
success or a PoseEstimationError on failure. Always check both the
variant alternative and the confidence field before using the
refined pose (see Quality Assessment).
for (const auto& frame : frames) {
auto result = estimator.updatePose(frame.image, frame.lens, frame.pose, frame.timestamp);
auto* output = std::get_if<raptor::guide::PoseOutput<raptor::Pose>>(&result);
if (output == nullptr) {
auto error = std::get<raptor::guide::PoseEstimationError>(result);
// log and skip frame
continue;
}
if (output->confidence < 0.7) {
// unreliable result; skip frame
continue;
}
auto refinedPose = output->pose;
}
Quality Assessment
PoseOutput::confidence / PositionOutput::confidence is the SDK's
quality score, combining reprojection error with the match quality between
the input image and the rendered map texture. See
Uncertainty for the underlying interpretation.
Recommended thresholds:
| Confidence | Interpretation |
|---|---|
| > 0.95 | Excellent — high accuracy |
| 0.85–0.95 | Good — reliable for most applications |
| 0.7–0.85 | Moderate — use with caution, monitor consistency |
| < 0.7 | Poor — reject; no robust match found |
Approximating the confidence of a pose
PoseEstimator::approximateConfidence() scores a camera pose without refining
it, for example to check a pose from another source against the map. It
matches the image against the map at the given pose and returns an
approximation of the confidence updatePose() would report for that pose, not
an exact reproduction of it. It accepts the same
lens models as updatePose().
auto confidence = estimator.approximateConfidence(image, lens, pose);
if (auto* value = std::get_if<raptor::guide::Confidence>(&confidence)) {
// *value uses the same scale as PoseOutput::confidence
} else {
// std::get<raptor::OperationError>(confidence) describes the failure
}
In Python, estimator.approximate_confidence(image, lens, pose) returns the
confidence or an OperationError.
Map coverage
PoseOutput::mapCoverage / PositionOutput::mapCoverage (range [0, 1])
reports the fraction of the rendered view backed by 3D map data. Low
values mean parts of the camera view fall outside the loaded map (sky,
terrain beyond map boundary) and typically correlate with lower
confidence.
Use map coverage rendering to inspect a viewpoint independently of estimation.
Performance and Threading
Construct a PoseEstimator from the shared Context and reuse it across images.
Resources independent of image size are allocated at construction; image-dependent resources are allocated when needed on a call.
raptor::guide::PoseEstimator estimator{context};
for (const auto& [image, timestamp] : images) {
auto result = estimator.updatePose(image, lens, pose, timestamp);
// handle result...
}
A single PoseEstimator may be called concurrently from multiple threads; each estimation call is
independent of other calls. Concurrent calls share the GPU, so a call bounded by maxTime may stop
earlier in its search than it would alone.
See the common thread-safety guidance for resource sharing, image lifetime, and callbacks.
Debug Capture
For analysis of pose estimation behavior, the SDK can record
updatePose() and updatePosition() calls into a CanV archive. Only calls
with a pinhole lens are recorded; calls with a distorted lens model are
skipped with a warning, and pose estimation is unaffected.
Usage
#include <raptor/guide/PoseEstimator.hpp>
raptor::guide::PoseEstimator estimator{context};
// Start capture. Returns DebugResult::Ok on success.
if (estimator.startDebug("/tmp/session.canv", /*overwrite=*/true) !=
raptor::guide::DebugResult::Ok) {
// Handle DebugResult::{ExpiredLicense, InvalidLicense, FileExists, InvalidPath, ...}
}
// updatePose()/updatePosition() calls with a pinhole lens between start
// and stop are recorded as frames in the archive.
estimator.updatePose(image, lens, pose, timestamp);
// Finalize the archive. Returns DebugResult::NotActive if no capture was
// running, or DebugResult::Failed on a finalization error.
estimator.stopDebug();
See Image Timestamp for the requirements on captured frames.
Debug capture may be started and stopped while other threads are running
updatePose() / updatePosition() on the same estimator. Frames from
concurrent calls are recorded in the order the calls complete. A call that
is already running when capture starts may be recorded with incomplete
debug data.
Debug capture belongs to the estimator instance. To record separate
archives, for example one per camera, use one PoseEstimator per archive on
the same Context. Apart from debug capture, instances share all resources
through the Context, so additional instances add no other capability.
Further reference
- SDK Integration Guide: common setup, inputs, configuration, and map operations
- PoseEstimator uncertainty
- Prior Pose Covariance
- Coordinate and camera conventions
- Troubleshooting: poor-quality results, covariance
configuration, performance, and inspecting CANV recordings from Debug Capture and
refine_canv_poses.pyin Vantor 3D Explorer - API reference:
include/raptor/guide/PoseEstimator.hppandinclude/raptor/covariance.hpp