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 @@
#include <bob.core/logging.h>
#include <boost/random.hpp>
#include <bob.core/random.h>
namespace bob { namespace ip { namespace base {
......@@ -552,11 +553,7 @@ namespace bob { namespace ip { namespace base {
value = img(valid_y, valid_x);
}
if (random_factor){
// The boost::normal_distribution seems to be unstable.
//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);
value = static_cast<T>(bob::core::random::normal_distribution<double>(1., random_factor)(rng) * value);
}
img(current_pos_y, current_pos_x) = value;
filled_mask(current_pos_y, current_pos_x) = true;
......
......@@ -10,7 +10,7 @@
#include <bob.blitz/cppapi.h>
#include <bob.blitz/cleanup.h>
#include <bob.core/random.h>
#include <bob.core/random_api.h>
#include <bob.sp/api.h>
#include <bob.io.base/api.h>
#include <bob.extension/documentation.h>
......
......@@ -107,11 +107,11 @@ fill_src_image = numpy.array([
fill_src_mask = fill_src_image != 0
fill_ref_image = numpy.array([
[ 125.57368423 , 117.00587265 , 260.69431128 , 229.86038173 , 230.67618385],
[ 114.31978062 , 255. , 255. , 255. , 275.35599683],
[ 277.36618842 , 127. , 127. , 270.12369219 , 252.23747063],
[ 132.63876879 , 63. , 134.10415134 , 118.95924361 , 248.51244191],
[ 59.14331103 , 64.90119476 , 124.52554278 , 129.64407822 , 246.48701023]
[ 246.32156874 , 249.3017102 , 267.47367932 , 250.18328228 , 250.99448144],
[ 130.81580817 , 255. , 255. , 255. , 252.49633169],
[ 56.88830006 , 127. , 127. , 264.01868874 , 132.49000491],
[ 139.74314545 , 63. , 131.18533899 , 130.85030597 , 123.67230802],
[ 134.72139907 , 132.86194994 , 127.25849129 , 134.8082927 , 127.723664 ]
], numpy.float64)
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