26 const uint32_t height,
float *
data) {
27 if (data ==
nullptr) {
31 float f = 0.5f * (width / tanf(h_fov / 2.0f));
32 float multiplier = (subpixel_err) / (f * baseline * 1e6f);
33 Eigen::Map<Eigen::VectorXf> data_vector_map(data, width * height);
38 Eigen::VectorXf rms_noise = (data_vector_map * 1000.0).array().square() * multiplier;
39 Eigen::VectorXf
noise = rms_noise.array().square();
42 for (
int i = 0; i < width * height; ++i) {
43 if (
InRange(data_vector_map[i])) {
45 this->
dist(this->
gen) * std::min(((
float)noise(i)), max_stdev);
53 const uint32_t height,
float *
data) {
54 if (data ==
nullptr) {
62 Eigen::Map<Eigen::VectorXf> data_vector_map(data, width * height);
63 Eigen::VectorXf var_noise = 0.0012f + 0.0019f * (data_vector_map.array() - 0.4f).array().square();
66 for (
int i = 0; i < width * height; ++i) {
67 if (
InRange(data_vector_map[i])) {
68 data_vector_map[i] += this->
dist(this->
gen) * var_noise(i);
78 const uint32_t height,
float *
data) {
79 if (data ==
nullptr) {
84 Eigen::Map<Eigen::VectorXf> data_vector_map(data, width * height);
85 Eigen::VectorXf var_noise = data_vector_map.array() * 0.01;
88 for (
int i = 0; i < width * height; ++i) {
89 if (
InRange(data_vector_map[i])) {
90 data_vector_map[i] += this->
dist(this->
gen) * var_noise(i);
void ApplyNoise(uint32_t width, uint32_t height, float *data)
void ApplyNoise(uint32_t width, uint32_t height, float *data)
bool InRange(float depth) const
std::normal_distribution< float > dist
void ApplyNoise(uint32_t width, uint32_t height, float *data)