#include #include Slicer360ToPerspective::Slicer360ToPerspective() { } Image Slicer360ToPerspective::ComputeCoverage(int width, bool raw) { int height = width/2; Image coverage(width, height, 1); // Compute the coverage of the 360-degree image by the cameras added to the slicer. for(int i = 0; i < height; i++) { for(int j = 0; j < width; j++) { // Compute view vector in inertial frame from equirectangular coordinates Eigen::Vector3d ray_dir_sph = equirectangular2sph(i, j, width, height); Eigen::Vector3d ray_dir_cart = sph2cart(ray_dir_sph); int count = 0; for(Camera const& camera : cameras) { if(camera.IsPointVisibleInertialFrame(ray_dir_cart)) count++; } coverage.SetPixelValue(i, j, 0, count); } } if(raw) return coverage; else return coverage.Normalized().Colorized(Image::Colormap::PARULA); }