67 int fx,
int fy,
int cx,
int cy,
double distance,
double jitter_amount) {
86 d.x_ids.resize(nviews);
88 d.X.resize(3, npoints);
92 Vecu all_point_ids(npoints);
93 for (
size_t j = 0; j < npoints; ++j)
96 for (
size_t i = 0; i < nviews; ++i) {
97 Vec3 camera_center,
t, jitter, lookdir;
99 double theta = i * 2 *
M_PI / nviews;
100 camera_center <<
sin(theta), 0.0,
cos(theta);
101 camera_center *= config.
_dist;
102 d.C[i] = camera_center;
106 lookdir = -camera_center + jitter;
109 d.K[i] << config.
_fx, 0, config.
_cx,
110 0, config.
_fy, config.
_cy,
114 d.t[i] = -d.R[i] * camera_center;
116 d.x_ids[i] = all_point_ids;
124 unsigned min_projections,
126 assert(view_ratio <= 1.0);
127 assert(view_ratio > 0.0);
128 assert(min_projections <= npoints);
136 d.x_ids.resize(nviews);
138 d.X.resize(3, npoints);
142 Mat visibility(nviews, npoints);
143 visibility.setZero();
144 Mat randoms(nviews, npoints);
146 randoms = (randoms.array() + 1) / 2.0;
147 unsigned num_visibles = 0;
148 for (
size_t i = 0; i < nviews; ++i) {
150 for (
size_t j = 0; j < npoints; j++) {
151 if (randoms(i, j) <= view_ratio) {
152 visibility(i, j) =
true;
156 if (num_visibles < min_projections) {
157 unsigned num_projections_to_add = min_projections - num_visibles;
158 for (
size_t j = 0; j < npoints && num_projections_to_add > 0; ++j) {
159 if (!visibility(i, j)) {
160 num_projections_to_add--;
163 num_visibles += num_projections_to_add;
165 d.x_ids[i].resize(num_visibles);
166 d.x[i].resize(2, num_visibles);
169 size_t j_visible = 0;
171 for (
size_t i = 0; i < nviews; ++i) {
172 Vec3 camera_center,
t, jitter, lookdir;
174 double theta = i * 2 *
M_PI / nviews;
175 camera_center <<
sin(theta), 0.0,
cos(theta);
176 camera_center *= config.
_dist;
177 d.C[i] = camera_center;
181 lookdir = -camera_center + jitter;
184 d.K[i] << config.
_fx, 0, config.
_cx,
185 0, config.
_fy, config.
_cy,
189 d.t[i] = -d.R[i] * camera_center;
191 for (
size_t j = 0; j < npoints; j++) {
192 if (visibility(i, j)) {
194 d.x[i].col(j_visible) =
Project(d.P(i),
X);
195 d.x_ids[i][j_visible] = j;
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble t
INLINE Rall1d< T, V, S > cos(const Rall1d< T, V, S > &arg)
INLINE Rall1d< T, V, S > sin(const Rall1d< T, V, S > &arg)
T distance(const T &a, const T &b)
NViewDataSet NRealisticCamerasSparse(int nviews, int npoints, float view_ratio, unsigned min_projections, const nViewDatasetConfigator config)
void FundamentalFromProjections(const Mat34 &P1, const Mat34 &P2, Mat3 *F)
TwoViewDataSet TwoRealisticCameras(bool same_K)
Mat3 RotationAroundX(double angle)
Vec2 Project(const Mat34 &P, const Vec3 &X)
Eigen::Matrix< unsigned int, Eigen::Dynamic, 1 > Vecu
Mat3 RotationAroundZ(double angle)
NViewDataSet NRealisticCamerasFull(int nviews, int npoints, const nViewDatasetConfigator config)
void P_From_KRt(const Mat3 &K, const Mat3 &R, const Vec3 &t, Mat34 *P)
double _dist
Camera random position parameters.
int _fx
Internal camera parameters.
nViewDatasetConfigator(int fx=1000, int fy=1000, int cx=500, int cy=500, double distance=1.5, double jitter_amount=0.01)