Program Listing for File ModelToImage.hpp
↰ Return to documentation for file (include/lvr2/reconstruction/ModelToImage.hpp)
/*
* ModelToImage.h
*
* Created on: Jan 25, 2017
* Author: Thomas Wiemann (twiemann@uos.de)
*/
#ifndef SRC_LIBLVR2_RECONSTRUCTION_MODELTOIMAGE_HPP_
#define SRC_LIBLVR2_RECONSTRUCTION_MODELTOIMAGE_HPP_
#include "lvr2/types/Model.hpp"
#include <opencv2/core.hpp>
#include <algorithm>
#include <vector>
#include <tuple>
using std::vector;
using std::tuple;
namespace lvr2
{
class Projection;
class ModelToImage {
public:
typedef struct
{
int i;
int j;
float depth;
} DepthPixel;
typedef struct PanoPoint
{
PanoPoint(size_t index_) : index(index_) {}
size_t index;
} PanoramaPoint;
typedef struct DI
{
vector<vector<float> > pixels;
float maxRange;
float minRange;
DI() :
maxRange(std::numeric_limits<float>::lowest()),
minRange(std::numeric_limits<float>::max()) {}
} DepthImage;
typedef struct PLI
{
vector<vector<vector<PanoramaPoint> > > pixels;
float maxRange;
float minRange;
PLI() :
maxRange(std::numeric_limits<float>::lowest()),
minRange(std::numeric_limits<float>::max()) {}
} DepthListMatrix;
enum ProjectionType {
CYLINDRICAL, CONICAL, EQUALAREACYLINDRICAL,
RECTILINEAR, PANNINI, STEREOGRAPHIC,
ZAXIS, AZIMUTHAL
};
enum ProjectionPolicy
{
FIRST, LAST, MINRANGE, MAXRANGE, AVERAGE, COLOR, INTENSITY
};
enum CoordinateSystem
{
NATIVE, SLAM6D, UOS
};
ModelToImage(
PointBufferPtr buffer,
ProjectionType projection,
int width, int height,
float minZ, float maxZ,
int minHorizontenAngle, int maxHorizontalAngle,
int mainVerticalAngle, int maxVerticalAngle,
bool imageOptimization = true,
CoordinateSystem system = NATIVE);
void writePGM(string filename, float cutoff);
virtual ~ModelToImage();
void getCVMatrix(cv::Mat& image);
void computeDepthImage(DepthImage& img, ProjectionPolicy policy = LAST);
void computeDepthListMatrix(DepthListMatrix& mat);
PointBufferPtr pointBuffer() { return m_points;}
private:
Projection* m_projection;
PointBufferPtr m_points;
int m_width;
int m_height;
int m_minHAngle;
int m_maxHAngle;
int m_minVAngle;
int m_maxVAngle;
bool m_optimize;
CoordinateSystem m_coordinateSystem;
float m_maxZ;
float m_minZ;
};
} /* namespace lvr2 */
#endif /* SRC_LIBLVR2_RECONSTRUCTION_MODELTOIMAGE_HPP_ */