[][src]Module city2ba::generate

Functions to generate camera and point locations on a 3D model.

Example usage:

extern crate tobj;
use city2ba::*;
use city2ba::generate::*;
use std::path::Path;

// load the model from disk
let (models, _) = tobj::load_obj(Path::new("tests/box.obj")).expect("Could not load .obj");
// convert the model into a form used for fast intersection tests
let dev = embree_rs::Device::new();
let mut scene = embree_rs::Scene::new(&dev);
for model in models.iter() {
    let mesh = model_to_geometry(model, &dev);
    scene.attach_geometry(mesh);
}
let cscene = scene.commit();
// generate cameras
let cameras = generate_cameras_poisson::<SnavelyCamera>(&cscene, 100, 1., 0.);
// generate points
let points = generate_world_points_uniform(&models, &cameras, 200, 10.);
// compute camera-point visibility graph
let vis_graph = visibility_graph(&cscene, &cameras, &points, 10., false);
// create BA problem
let ba = BAProblem::from_visibility(cameras, points, vis_graph);
// drop all but the largest connected component and drop cameras that do no see enough points
let ba = ba.cull();

Functions

generate_cameras_path

Generate cameras along a path. Cameras will be pointed along the direction of movement of the path.

generate_cameras_path_step

Generate camera positions along a path by starting at the beginning of the path and taking fixed sized steps between each camera.

generate_cameras_poisson

Generate camera locations using a Poisson disk distribution of cameras in the x-y plane. Cameras are placed height above the tallest surface at their x-y location.

generate_world_points_uniform

Generate points uniformly in the world. Points are culled if they are more than max_dist from all cameras. Gives at most num_points.

model_to_geometry

Convert a 3D model into geometry for fast intersection tests.

modify_intrinsics

Modify camera intrinsics so they are all in the range [intrinsic_start, intrinsic_end).

move_to_origin

Move models so that the top right corner of the bounding box is at the origin.

visibility_graph

Compute the camera-point visibility graph. Points not visible max_dist from any camera are dropped.