Skip to content
Snippets Groups Projects
Commit 5a709f7f authored by Sebastian Hahta's avatar Sebastian Hahta
Browse files

middlebury: noise

parent ad02b72b
No related branches found
No related tags found
No related merge requests found
Pipeline #24363 failed
...@@ -169,3 +169,13 @@ MiddEvalResult evaluate(const cv::Mat &disp, const cv::Mat &gt, const cv::Mat &m ...@@ -169,3 +169,13 @@ MiddEvalResult evaluate(const cv::Mat &disp, const cv::Mat &gt, const cv::Mat &m
result.rms_bad_nonoccl = sqrt(err2_bad/n); result.rms_bad_nonoccl = sqrt(err2_bad/n);
return result; return result;
} }
void add_noise(cv::Mat &im, double stddev, double mean) {
cv::Mat noise = cv::Mat(im.size(),CV_64FC3);
cv::randn(noise, mean, stddev);
cv::Mat tmp;
im.convertTo(tmp, CV_64FC3, 1.0/255.0);
tmp += noise;
cv::normalize(tmp, im, 0, 255, cv::NORM_MINMAX, CV_8UC3);
}
...@@ -32,3 +32,12 @@ MiddEvalCalib read_calibration(const std::string &filename); ...@@ -32,3 +32,12 @@ MiddEvalCalib read_calibration(const std::string &filename);
MiddEvalResult evaluate(const cv::Mat &disp, const cv::Mat &gt, const cv::Mat &mask, float threshold=1.0f); MiddEvalResult evaluate(const cv::Mat &disp, const cv::Mat &gt, const cv::Mat &mask, float threshold=1.0f);
cv::Mat read_pfm(const std::string &filename); cv::Mat read_pfm(const std::string &filename);
/**
* Add gaussian noise to image.
*
* @param im CV_8UC3
* @param stddev standar deviation
* @param mean mean for noise
*/
void add_noise(cv::Mat &im, double stddev, double mean=0.0);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment