Commit 281b2e43 authored by Manuel Günther's avatar Manuel Günther

Switched to new rnadom number generators in bob.core.

parent 932dc223
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <bob.core/logging.h> #include <bob.core/logging.h>
#include <boost/random.hpp> #include <boost/random.hpp>
#include <bob.core/random.h>
namespace bob { namespace ip { namespace base { namespace bob { namespace ip { namespace base {
...@@ -552,11 +553,7 @@ namespace bob { namespace ip { namespace base { ...@@ -552,11 +553,7 @@ namespace bob { namespace ip { namespace base {
value = img(valid_y, valid_x); value = img(valid_y, valid_x);
} }
if (random_factor){ if (random_factor){
// The boost::normal_distribution seems to be unstable. value = static_cast<T>(bob::core::random::normal_distribution<double>(1., random_factor)(rng) * value);
//double factor = boost::variate_generator<boost::mt19937, boost::normal_distribution<double>>(rng,boost::normal_distribution<double>(1., random_factor))();
// so we use a uniform distribution
double factor = boost::uniform_real<double>(1.-2.*random_factor, 1.+2.*random_factor)(rng);
value = static_cast<T>(factor * value);
} }
img(current_pos_y, current_pos_x) = value; img(current_pos_y, current_pos_x) = value;
filled_mask(current_pos_y, current_pos_x) = true; filled_mask(current_pos_y, current_pos_x) = true;
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include <bob.blitz/cppapi.h> #include <bob.blitz/cppapi.h>
#include <bob.blitz/cleanup.h> #include <bob.blitz/cleanup.h>
#include <bob.core/random.h> #include <bob.core/random_api.h>
#include <bob.sp/api.h> #include <bob.sp/api.h>
#include <bob.io.base/api.h> #include <bob.io.base/api.h>
#include <bob.extension/documentation.h> #include <bob.extension/documentation.h>
......
...@@ -107,11 +107,11 @@ fill_src_image = numpy.array([ ...@@ -107,11 +107,11 @@ fill_src_image = numpy.array([
fill_src_mask = fill_src_image != 0 fill_src_mask = fill_src_image != 0
fill_ref_image = numpy.array([ fill_ref_image = numpy.array([
[ 125.57368423 , 117.00587265 , 260.69431128 , 229.86038173 , 230.67618385], [ 246.32156874 , 249.3017102 , 267.47367932 , 250.18328228 , 250.99448144],
[ 114.31978062 , 255. , 255. , 255. , 275.35599683], [ 130.81580817 , 255. , 255. , 255. , 252.49633169],
[ 277.36618842 , 127. , 127. , 270.12369219 , 252.23747063], [ 56.88830006 , 127. , 127. , 264.01868874 , 132.49000491],
[ 132.63876879 , 63. , 134.10415134 , 118.95924361 , 248.51244191], [ 139.74314545 , 63. , 131.18533899 , 130.85030597 , 123.67230802],
[ 59.14331103 , 64.90119476 , 124.52554278 , 129.64407822 , 246.48701023] [ 134.72139907 , 132.86194994 , 127.25849129 , 134.8082927 , 127.723664 ]
], numpy.float64) ], numpy.float64)
def test_extrapolate_random(): def test_extrapolate_random():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment