28 #include "testing/testing.h"
32 TEST(PolynomialCameraIntrinsics2, ApplyOnFocalCenter) {
38 double distorted_x, distorted_y;
41 EXPECT_NEAR(640.0, distorted_x, 1
e-8);
42 EXPECT_NEAR(540.0, distorted_y, 1
e-8);
51 double normalized_x, normalized_y;
54 EXPECT_NEAR(0.0, normalized_x, 1
e-8);
55 EXPECT_NEAR(0.0, normalized_y, 1
e-8);
61 double expected[
N][
N][2] = {
62 {{75.312500, -24.687500},
63 {338.982239, -62.035522},
64 {640.000000, -72.929688},
65 {941.017761, -62.035522},
66 {1204.687500, -24.687500}},
68 {{37.964478, 238.982239},
69 {323.664551, 223.664551},
70 {640.000000, 219.193420},
71 {956.335449, 223.664551},
72 {1242.035522, 238.982239}},
74 {{27.070312, 540.000000},
75 {319.193420, 540.000000},
76 {640.000000, 540.000000},
77 {960.806580, 540.000000},
78 {1252.929688, 540.000000}},
80 {{37.964478, 841.017761},
81 {323.664551, 856.335449},
82 {640.000000, 860.806580},
83 {956.335449, 856.335449},
84 {1242.035522, 841.017761}},
86 {{75.312500, 1104.687500},
87 {338.982239, 1142.035522},
88 {640.000000, 1152.929688},
89 {941.017761, 1142.035522},
90 {1204.687500, 1104.687500}},
98 double step = 1.0 / (
N - 1);
100 for (
int i = 0; i <
N; i++) {
101 for (
int j = 0; j <
N; j++) {
102 double normalized_x = j * step - 0.5, normalized_y = i * step - 0.5;
104 double distorted_x, distorted_y;
106 normalized_x, normalized_y, &distorted_x, &distorted_y);
108 EXPECT_NEAR(expected[i][j][0], distorted_x, 1
e-6);
109 EXPECT_NEAR(expected[i][j][1], distorted_y, 1
e-6);
117 double expected[
N][
N][2] = {
118 {{-0.524482, -0.437069},
119 {-0.226237, -0.403994},
120 {0.031876, -0.398446},
121 {0.293917, -0.408218},
122 {0.632438, -0.465028}},
124 {{-0.493496, -0.189173},
125 {-0.219052, -0.179936},
126 {0.030975, -0.178107},
127 {0.283742, -0.181280},
128 {0.574557, -0.194335}},
130 {{-0.488013, 0.032534},
131 {-0.217537, 0.031077},
132 {0.030781, 0.030781},
133 {0.281635, 0.031293},
134 {0.566344, 0.033314}},
136 {{-0.498696, 0.257660},
137 {-0.220424, 0.244041},
138 {0.031150, 0.241409},
139 {0.285660, 0.245985},
140 {0.582670, 0.265629}},
142 {{-0.550617, 0.532263},
143 {-0.230399, 0.477255},
144 {0.032380, 0.469510},
145 {0.299986, 0.483311},
146 {0.684740, 0.584043}},
154 double step_x = 1280.0 / (
N - 1), step_y = 1080.0 / (
N - 1);
156 for (
int i = 0; i <
N; i++) {
157 for (
int j = 0; j <
N; j++) {
158 double distorted_x = j * step_x, distorted_y = i * step_y;
160 double normalized_x, normalized_y;
162 distorted_x, distorted_y, &normalized_x, &normalized_y);
164 EXPECT_NEAR(expected[i][j][0], normalized_x, 1
e-6);
165 EXPECT_NEAR(expected[i][j][1], normalized_y, 1
e-6);
178 for (
double y = 0;
y < 1000;
y += 100) {
179 for (
double x = 0;
x < 1000;
x += 100) {
180 double normalized_x, normalized_y;
186 EXPECT_NEAR(
x, xp, 1
e-8) <<
"y: " <<
y;
187 EXPECT_NEAR(
y, yp, 1
e-8) <<
"x: " <<
x;
188 LG <<
"Error x: " << (
x - xp);
189 LG <<
"Error y: " << (
y - yp);
195 const int w = 101, h = 101;
201 DrawLine(0.0, h / 4.0 * 3.0,
w - 1.0, h / 4.0 * 3.0, 1.0, &
image);
217 distorted_image.
Data());
219 for (
int x = 0;
x <
image.Width(); ++
x) {
220 for (
int y = 0;
y <
image.Height(); ++
y) {
227 const int w = 101, h = 101;
233 DrawLine(0.0, h / 4.0 * 3.0,
w - 1.0, h / 4.0 * 3.0, 1.0, &
image);
249 distorted_image.
Data());
251 for (
int x = 0;
x <
image.Width(); ++
x) {
252 for (
int y = 0;
y <
image.Height(); ++
y) {
EXPECT_EQ(BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_INVALID)
_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 y
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
3D array (row, column, channel).
T * Data()
Pointer to the first element of the array.
void DistortBuffer(const PixelType *input_buffer, int width, int height, double overscan, int channels, PixelType *output_buffer)
void SetPrincipalPoint(double cx, double cy)
void SetFocalLength(double focal_x, double focal_y)
void SetImageSize(int width, int height)
void UndistortBuffer(const PixelType *input_buffer, int width, int height, double overscan, int channels, PixelType *output_buffer)
void InvertIntrinsics(double image_x, double image_y, double *normalized_x, double *normalized_y) const override
void SetRadialDistortion(double k1, double k2, double k3)
void ApplyIntrinsics(double normalized_x, double normalized_y, double *image_x, double *image_y) const override
depth_tx normal_tx diffuse_light_tx specular_light_tx volume_light_tx environment_tx ambient_occlusion_tx aov_value_tx in_weight_img image(1, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D_ARRAY, "out_weight_img") .image(3
TEST(PolynomialCameraIntrinsics2, ApplyOnFocalCenter)
void DrawLine(int xa, int ya, int xb, int yb, const Color &col, Image *pim)