Go to the documentation of this file.
38 using namespace Eigen;
43 DiscreteFrustum::DiscreteFrustum(
int smoothing,
double bin_depth,
double max_dist) :
59 double mult = ground_truth / measurement;
99 double coeff0 = 1.0 - coeff1;
161 std::set<size_t> divisors;
162 for(
size_t i = 1;
i <= num;
i++)
174 std::set<size_t>::iterator low, prev;
175 low = divisors.lower_bound(
ref);
176 if(low == divisors.end())
178 return *(--divisors.end());
180 else if(low == divisors.begin())
188 if((
ref - *prev) <= (*low -
ref))
200 double ratio = width /
static_cast<double>(height);
202 double ref_bin_width = 8;
205 double ref_bin_height = ref_bin_width /
ratio;
235 int bin_width,
int bin_height,
241 bin_width_(bin_width),
242 bin_height_(bin_height),
243 bin_depth_(bin_depth)
281 UASSERT(depth.type() == CV_16UC1 || depth.type() == CV_32FC1);
282 int factor =
width_ / depth.cols;
283 if(depth.type() == CV_32FC1)
285 #pragma omp parallel for
286 for(
int v = 0;
v < depth.rows; ++
v) {
287 for(
int u = 0; u < depth.cols; ++u) {
288 float &
z = depth.at<
float>(
v, u);
299 #pragma omp parallel for
300 for(
int v = 0;
v < depth.rows; ++
v) {
301 for(
int u = 0; u < depth.cols; ++u) {
302 unsigned short &
z = depth.at<
unsigned short>(
v, u);
305 double zf =
z * 0.001;
319 const cv::Mat& measurement)
325 UASSERT(ground_truth.type() == CV_16UC1 || ground_truth.type() == CV_32FC1);
326 UASSERT(measurement.type() == CV_16UC1 || measurement.type() == CV_32FC1);
328 bool isGroundTruthInMM = ground_truth.type()==CV_16UC1;
329 bool isMeasurementInMM = measurement.type()==CV_16UC1;
331 size_t num_training_examples = 0;
333 for(
int u = 0; u <
width_; ++u) {
334 float gt = isGroundTruthInMM?
float(ground_truth.at<
unsigned short>(
v,u))*0.001:ground_truth.at<
float>(
v,u);
337 float meas = isMeasurementInMM?
float(measurement.at<
unsigned short>(
v,u))*0.001:measurement.at<
float>(
v,u);
343 ++num_training_examples;
349 return num_training_examples;
356 f.open(
path.c_str(), ascii ? ios::in : ios::in | ios::binary);
358 cerr <<
"Failed to open " <<
path << endl;
369 f.open(
path.c_str(), ascii?ios::out: ios::out | ios::binary);
371 cerr <<
"Failed to open " <<
path << endl;
380 out <<
"DiscreteDepthDistortionModel v01" << endl;
415 UDEBUG(
"buf=%s", buf.c_str());
416 assert(buf ==
"DiscreteDepthDistortionModel v01");
452 UDEBUG(
"Distortion Model: Frustum[%d][%d]",
y,
x);
void interpolatedUndistort(double *z) const
GLM_FUNC_DECL genType min(genType const &x, genType const &y)
Eigen::VectorXf multipliers_
size_t accumulate(const cv::Mat &ground_truth, const cv::Mat &measurement)
void deserializeScalar(std::istream &strm, T *val)
void load(const std::string &path)
std::vector< std::vector< DiscreteFrustum * > > frustums_
frustums_[y][x]
void addExample(int v, int u, double ground_truth, double measurement)
static size_t getClosestToRef(const std::set< size_t > &divisors, const double &ref)
void deserialize(std::istream &in, bool ascii)
GLM_FUNC_DECL genType floor(genType const &x)
void addExample(double ground_truth, double measurement)
Basic mathematics functions.
int bin_height_
Height of each bin in pixels.
bool uIsNan(const T &value)
DiscreteDepthDistortionModel()
int index(double z) const
void deserialize(std::istream &strm, Eigen::Matrix< S, T, U > *mat)
void serializeScalar(T val, std::ostream &strm)
DiscreteFrustum & frustum(int y, int x)
std::string getExtension()
GLM_FUNC_DECL genType ceil(genType const &x)
void save(const std::string &path) const
void serialize(const Eigen::Matrix< S, T, U > &mat, std::ostream &strm)
void undistort(cv::Mat &depth) const
#define UASSERT(condition)
void serializeScalarASCII(T val, std::ostream &strm)
std::ofstream out("Result.txt")
DiscreteDepthDistortionModel & operator=(const DiscreteDepthDistortionModel &other)
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
void deserialize(std::istream &in, bool ascii)
void serialize(std::ostream &out, bool ascii) const
ULogger class and convenient macros.
void deserializeASCII(std::istream &strm, Eigen::Matrix< S, T, U > *mat)
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy y set format x g set format y g set format x2 g set format y2 g set format z g set angles radians set nogrid set key title set key left top Right noreverse box linetype linewidth samplen spacing width set nolabel set noarrow set nologscale set logscale x set set pointsize set encoding default set nopolar set noparametric set set set set surface set nocontour set clabel set mapping cartesian set nohidden3d set cntrparam order set cntrparam linear set cntrparam levels auto set cntrparam points set size ratio
Array< int, Dynamic, 1 > v
Eigen::VectorXf total_denominators_
void deserializeScalarASCII(std::istream &strm, T *val)
void serialize(std::ostream &out, bool ascii) const
Eigen::VectorXf total_numerators_
void serializeASCII(const Eigen::Matrix< S, T, U > &mat, std::ostream &strm)
int bin_width_
Width of each bin in pixels.
static std::set< size_t > getDivisors(const size_t &num)
virtual ~DiscreteDepthDistortionModel()
void undistort(double *z) const
static void getBinSize(const size_t &width, const size_t &height, size_t &bin_width, size_t &bin_height)
double bin_depth_
Depth of each bin in meters.
rtabmap
Author(s): Mathieu Labbe
autogenerated on Thu Jul 25 2024 02:50:09