Birds Eye View - Minimal Application Integration

From RidgeRun Developer Wiki



⇦ User Guide/Building and Installation Home Calibration Guide ⇨




This page will help you integrate libpanorama/Birds Eye View into your own application. The example provided here is minimal, please consult the examples in order to see more intricate code bases.

Skeleton

In its simplest from, a Birds Eye View application looks like the following:

#include "lp/libpanorama.hpp"
#include "lp/engines/bev_rectilinear.hpp"
#include "lp/image.hpp"
#include "lp/io/gstreamer.hpp"

#include <string>
#include <vector>

// Create a new BEV engine:
//  - RGBA
//  - 8 bit per component
lp::engines::BevRectilinear<lp::RGBA<uint8_t>> engine;

// Load the calibration parameters from a file
const std::string calibration_file = "examples/birds_eye_view.json";
std::vector <lp::engines::BevParams> params = lp::engines::LoadParametersFromFile (calibration_file);
engine.SetParameters (params);

// Grab the number of input cameras
const int num_inputs = params.size();

// Define an image loader for each input camera and load the media
std::vector<lp::io::GStreamer<lp::RGBA<uint8_t>>> loaders(num_inputs);
for (int i=0; i < num_inputs; i++) {
  loader.Open(params[i].pipeline);
}

// Allocate the input images. The amount of images must match the parameters
std::vector<lp::image<lp::RGBA<uint8_t>>> input_images(num_inputs);
for (int i=0; i < num_inputs; i++) {
  input_images[i] = loaders[I].ReadImage()

  // The size if the ith image must match its corresponding "denormalize" parameter
  assert(input_images[i].GetSize() == params[input_num].denormalize.size);
}


⇦ User Guide/Building and Installation Home Calibration Guide ⇨