28 , embedding(_embedding)
29 , has_target_level(false)
30 , minLevel(
std::numeric_limits<int>::
max())
34 throw std::invalid_argument(
"Null scene given");
35 if (view ==
nullptr || !view->is_camera_valid())
36 throw std::invalid_argument(
"Null view given");
37 if (embedding.empty())
38 throw std::invalid_argument(
"Empty embedding name");
48 throw std::invalid_argument(
"No color image found");
49 this->source_level = ImagePyramidLevel(cam, proxy->
width, proxy->
height);
52SingleView::~SingleView()
54 source_level.image.reset();
55 target_level.image.reset();
57 ImagePyramidCache::cleanup();
61SingleView::loadColorImage(
int _minLevel)
64 img_pyramid = ImagePyramidCache::get(this->scene, this->view, this->embedding, minLevel);
68SingleView::prepareMasterView(
int scale)
71 this->target_level = (*this->img_pyramid)[scale];
72 this->has_target_level =
true;
73 this->createFileName(scale);
76 int const scaled_width = this->target_level.width;
77 int const scaled_height = this->target_level.height;
85SingleView::viewRay(
int x,
int y,
int level)
const
87 return this->viewRay(
float(x),
float(y), level);
91SingleView::viewRay(
float x,
float y,
int level)
const
99SingleView::viewRayScaled(
int x,
int y)
const
101 assert(this->has_target_level);
116 float x = sp[0] / sp[2] - 0.5f;
117 float y = sp[1] / sp[2] - 0.5f;
118 return x >= 0 && x <= this->source_level.width - 1
119 && y >= 0 && y <= this->source_level.height - 1;
123SingleView::saveReconAsPly(std::string
const& path,
float scale)
const
126 throw std::invalid_argument(
"Empty path");
131 std::string name(this->createFileName(scale));
136 this->depthImg, this->confImg, this->target_level.image);
Matrix class for arbitrary dimensions and types.
Matrix< T, M, N > transposed(void) const
Returns a transposed copy of self by treating rows as columns.
Vector class for arbitrary dimensions and types.
static Ptr create(void)
Smart pointer image constructor.
std::shared_ptr< Scene > Ptr
std::shared_ptr< View > Ptr
#define MVS_NAMESPACE_BEGIN
#define MVS_NAMESPACE_END
T const & max(T const &a, T const &b, T const &c)
Returns the maximum value of three arguments.
math::Vec3f pixel_3dpos(int64_t x, int64_t y, float depth, math::Matrix3f const &invproj)
Function that calculates the pixel 3D position in camera coordinates for pixel (x,...
void save_ply_view(std::string const &filename, CameraInfo const &camera, FloatImage::ConstPtr depth_map, FloatImage::ConstPtr confidence_map, ByteImage::ConstPtr color_image)
Stores a scanalize-compatible PLY file from a depth map.
void save_xf_file(std::string const &filename, CameraInfo const &camera)
Stores a scanalyze compatible XF file with camera transformation from camera to world coordinates.
bool mkdir(char const *pathname)
Creates a new directory.
bool dir_exists(char const *pathname)
Determines if the given path is a directory.
std::string join_path(std::string const &path1, std::string const &path2)
Concatenate and canonicalize two paths.
Per-view camera information with various helper functions.
void fill_world_to_cam(float *mat) const
Stores world to camera 4x4 matrix in array pointed to by mat.
void fill_camera_pos(float *pos) const
Stores camera position 3-vector into array pointed to by pos.