コード例 #1
0
ファイル: random_point.cpp プロジェクト: pmiddend/insula
insula::height_map::vec3 const
insula::height_map::random_point(
	object const &o,
	scalar const water_level,
	random_engine &engine,
	flatness_range const &f)
{
	// For now, generate just some random point
	std::uniform_real_distribution<scalar> 
		xdist(
			o.extents().left(),
			o.extents().right()),
		ydist(
			o.extents().front(),
			o.extents().back());

	vec2 result;

	unsigned long iterations = 0;

	do
	{
		result = 
			vec2(
				xdist(
					engine),
				ydist(
					engine));

		if (iterations++ > iteration_threshold)
		{
			fcppt::io::cerr 
				<< FCPPT_TEXT("I've tried my best to generate a point in the gradient range ") 
				<< f
				<< FCPPT_TEXT(" but it didn't work. Now I'll just take the next best point.\n");
			break;
		}
	} 
	while(
		o.project(result) < water_level ||
		!inside_range(
			o.gradient()[
				array::dim(
					static_cast<array::size_type>(
						result.x()/o.cell_size()),
					static_cast<array::size_type>(
						result.y()/o.cell_size()))],
			f.x(),
			f.y()));

	return 
		vec3(
			result.x(),
			o.project(
				result),
			result.y());
}
コード例 #2
0
ファイル: main.cpp プロジェクト: CVVisualPSETeam/CVVisual
std::vector<cv::KeyPoint> makeRandomKeys(size_t x, size_t y, size_t n)
{
	static std::mt19937_64 gen{ std::random_device{}() };
	std::uniform_real_distribution<float> xdist{ 0.0f,
		                                     static_cast<float>(x) };
	std::uniform_real_distribution<float> ydist{ 0.0f,
		                                     static_cast<float>(y) };
	std::uniform_real_distribution<float> sdist{ 0.0f, 3.0f };
	std::vector<cv::KeyPoint> keypoints;
	for (size_t i = 0; i < n; ++i)
	{
		keypoints.emplace_back(xdist(gen), ydist(gen), sdist(gen));
	}
	return keypoints;
}
コード例 #3
0
ファイル: gary.c プロジェクト: ombt/ombt
main(int argc, char **argv)
{
	/* create window display */
	XWindowDisplay *windisp = new XWindowDisplay((char *)0, 0);

	/* create a window */
	XWindow *win = new XWindow(argv[0], windisp, 50, 50, 800, 600,
	"-adobe-courier-bold-o-normal--18-180-75-75-m-110-iso8859-1");

	/* concatenate all strings together */
	char buf[BUFSIZ];
	*buf = 0;
	for (int arg = 1; arg < argc; arg++)
	{
		strcat(buf, " ");
		strcat(buf, argv[arg]);
	}

	/* create random number generators */
	Uniform xdist(1.0, 800.0);
	Uniform ydist(1.0, 600.0);

	/* set seed for random number generator */
	long seed = time((long *)0) | 1L;
	srand48(seed);

	/* write string on screen */
	win->display();
	while ( 1 )
	{
		int x = (int)xdist.randomSample();
		int y = (int)ydist.randomSample();
		win->putString(x, y, buf);
		win->display();
		sleep(1);
	}

	/* all done */
	delete win;
	delete windisp;

	/* all done */	
	return(0);
}
コード例 #4
0
ファイル: region.cpp プロジェクト: PetraOleum/AscentRL
Region::Region(int w, int h, RoomType type) {
	if (!initgen) { // Initialise probdist - but only once
		std::random_device rd;
		gen = std::mt19937(rd());
		probdist = std::uniform_real_distribution<double>(0, 1);
		initgen = true;
	}
	width = w;
	height = h;
	this->type = type;
	switch (type) {
		case RoomType::Room:
			for (int x = 0; x < w; x++) {
				for (int y = 0; y < h; y++) {
					Point tp = Point(x, y);
					points[tp] = Background::TiledFloor;
					if (probdist(gen) < GOLD_PROB)
						placeItem(tp, ItemType::Gold);
					if (probdist(gen) < STAFF_PROB)
						placeItem(tp, ItemType::Staff);
					if (probdist(gen) < CHEST_PROB)
						placeItem(tp, ItemType::Chest);
				}
				points[Point(x, -1)] = Background::StoneWall;
				points[Point(x, h)] = Background::StoneWall;
			}
			for (int y = -1; y <=h; y++) {
				points[Point(-1, y)] = Background::StoneWall;
				points[Point(w, y)] = Background::StoneWall;
			}
//			points[Point(5, 3)] = Background::DirtWall;
			{
				idist = std::uniform_int_distribution<int>(4, 4 + (w + h) / 2);
				int maxconnections = idist(gen);
				numConnections = 0;
				idist = std::uniform_int_distribution<int>(0, 4);
				for (uint8_t i = 0; i < 4; i++) {
					if (addrandomemptyconnection((Direction)(i)))
						numConnections++;
				}
				for (uint8_t i = 4; i < maxconnections; i++) {
					if (addrandomemptyconnection((Direction)(idist(gen))))
						numConnections++;
				}
//				printf("%d->%d\n", maxconnections, numConnections);
			}
			break;
		case RoomType::Corridor:
			for (int x = -1; x <= w; x++)
				for (int y = -1; y <= h; y++)
					points[Point(x, y)] = Background::StoneWall;
			{
				std::uniform_int_distribution<int> ydist(0, h - 1);
				int y = ydist(gen);
				for (int x = 0; x < w; x++)
					points[Point(x, y)] = Background::TiledFloor;
				addrandomemptyconnection(Direction::Left, Point(-1, y));
				addrandomemptyconnection(Direction::Right, Point(w, y));
			} 
			{
				std::uniform_int_distribution<int> xdist(0, w - 1);
				int x = xdist(gen);
				for (int y = 0; y < h; y++)
					points[Point(x, y)] = Background::TiledFloor;
				addrandomemptyconnection(Direction::Up, Point(x, -1));
				addrandomemptyconnection(Direction::Down, Point(x, h));
			}
			break;
		case RoomType::Spiral:
			for (int x = 0; x < w; x++) {
				for (int y = 0; y < h; y++) {
					Point tp = Point(x, y);
					points[tp] = Background::TiledFloor;
//					if (probdist(gen) < GOLD_PROB)
//						placeItem(tp, ItemType::Gold);
//					if (probdist(gen) < STAFF_PROB)
//						placeItem(tp, ItemType::Staff);
//					if (probdist(gen) < CHEST_PROB)
//						placeItem(tp, ItemType::Chest);
				}
				points[Point(x, -1)] = Background::StoneWall;
				points[Point(x, h)] = Background::StoneWall;
			}
			for (int y = -1; y <=h; y++) {
				points[Point(-1, y)] = Background::StoneWall;
				points[Point(w, y)] = Background::StoneWall;
			}
			if (h >= 3 && w >= 3){ // Draw spiral
				int layers = (MIN(w, h) - 2) / 4;
				int layercount = 0;
				Point currentlyDrawing = {1,0};
				Direction drawdir = Direction::Down;
				auto contLine = [layers, &layercount, w, h, &drawdir, this](Point pt) -> bool {
//					printf("%d\n", (layercount + 1) * 2);
					switch (drawdir) {
						case Direction::Down:
							return pt.second < h - (layercount + 1) * 2;
						case Direction::Up:
							return pt.second >= (layercount + 1) * 2;
						case Direction::Left:
							return pt.first >= (layercount + 2) * 2; // Because want to actually spiral
						case Direction::Right:
//							printf("%d\n", w - (layercount + 1) * 2);
							return pt.first < w - (layercount + 1) * 2;
						default:
							fprintf(stderr, "Direction weirdness here\n");
							return false;
					}
				};
				auto turnDir = [&layercount, &drawdir]() {
					switch (drawdir) {
						case Direction::Down:
							drawdir = Direction::Right;
							break;
						case Direction::Up:
							drawdir = Direction::Left;
							break;
						case Direction::Left:
							drawdir = Direction::Down;
							layercount++;
							break;
						case Direction::Right:
							drawdir = Direction::Up;
							break;
						default:
							fprintf(stderr, "Direction weirdness here\n");
							break;
					}
				};
				while (layercount < layers && currentlyDrawing.second >= 0 && currentlyDrawing.first >= 0) {
//					printf("Printing at %d:%d\n", currentlyDrawing.first, currentlyDrawing.second);
					points[currentlyDrawing] = Background::StoneWall;
					if (!contLine(currentlyDrawing)) {
						turnDir();
//						printf("Turning to direction %d; layercount = %d\n", (int)drawdir, layercount);
					}
					currentlyDrawing = PAIR_SUM(currentlyDrawing, DISPLACEMENT(drawdir));
				}
				points[Point(1, 3)] = Background::Door;
			}
			{
				addrandomemptyconnection(Direction::Up, {0, -1});
				idist = std::uniform_int_distribution<int>(4, 4 + (w + h) / 2);
				int maxconnections = idist(gen);
				numConnections = 0;
				idist = std::uniform_int_distribution<int>(0, 4);
				for (uint8_t i = 0; i < 4 && i < maxconnections; i++) {
					if (addrandomemptyconnection((Direction)(i)))
						numConnections++;
				}
				for (uint8_t i = 4; i < maxconnections; i++) {
					if (addrandomemptyconnection((Direction)(idist(gen))))
						numConnections++;
				}
			}
			break;
		default:
			fprintf(stderr, "Unimplemented RoomType\n");
			break;
	}
	
}
コード例 #5
0
ファイル: gendataset.cpp プロジェクト: FoxelSA/yafdb
/**
 * Program entry-point.
 *
 */
int main(int argc, char **argv) {
    // parse arguments
    while (true) {
        int index = -1;

        getopt_long(argc, argv, "", options, &index);
        if (index == -1) {
            if (argc != optind + 2) {
                usage();
                return 1;
            }

            input_file = argv[optind++];
            if (access(input_file, R_OK)) {
                fprintf(stderr, "Error: input file not readable: %s\n", input_file);
                return 2;
            }

            output_file = argv[optind++];
            if (access(output_file, W_OK) && errno == EACCES) {
                fprintf(stderr, "Error: output file not writable: %s\n", output_file);
                return 2;
            }
            break;
        }

        switch (index) {
        case OPTION_WIDTH:
            sample_width = atoi(optarg);
            break;
        case OPTION_HEIGHT:
            sample_height = atoi(optarg);
            break;
        case OPTION_COUNT:
            sample_count = atoi(optarg);
            break;

        case OPTION_ROTATE_STDDEV_X:
            rotate_stddev_x = atof(optarg) / 180.0 * M_PI;
            break;
        case OPTION_ROTATE_STDDEV_Y:
            rotate_stddev_y = atof(optarg) / 180.0 * M_PI;
            break;
        case OPTION_ROTATE_STDDEV_Z:
            rotate_stddev_z = atof(optarg) / 180.0 * M_PI;
            break;

        case OPTION_LUMINOSITY_STDDEV:
            luminosity_stddev = atof(optarg);
            break;

        case OPTION_BACKGROUNDS:
            backgrounds_file = optarg;
            if (access(backgrounds_file, R_OK)) {
                fprintf(stderr, "Error: backgrounds file not readable: %s\n", backgrounds_file);
                return 2;
            }
            break;

        default:
            usage();
            return 1;
        }
    }

    // read input files
    std::vector<std::string> samples;

    if (!parseFiles(input_file, samples)) {
        fprintf(stderr, "Error: cannot parse file listing: %s\n", input_file);
        return 2;
    }

    // read background files
    std::vector<std::string> backgrounds;

    if (backgrounds_file != NULL && !parseFiles(backgrounds_file, backgrounds)) {
        fprintf(stderr, "Error: cannot parse file listing: %s\n", backgrounds_file);
        return 2;
    }

    // create output file
    FILE *fp = fopen(output_file, "wb");

    if (fp == NULL) {
        fprintf(stderr, "Error: cannot open output file for writing: %s\n", output_file);
        return 2;
    }
    icvWriteVecHeader(fp, sample_count, sample_width, sample_height);

    // generate distortions
    std::default_random_engine generator(time(NULL));
    std::normal_distribution<double> xdist(0.0, rotate_stddev_x / 3.0);
    std::normal_distribution<double> ydist(0.0, rotate_stddev_y / 3.0);
    std::normal_distribution<double> zdist(0.0, rotate_stddev_z / 3.0);
    std::normal_distribution<double> ldist(0.0, luminosity_stddev / 3.0);
    cv::Mat el = cv::getStructuringElement(cv::MORPH_ELLIPSE, cv::Size(5, 5));
    int variations = MAX(1, (int)floor((double)sample_count / (double)samples.size()));
    int idx = 0;
    int i = 0;

    while (i < sample_count) {
        // suffle the input lists
        if (idx % samples.size() == 0) {
            std::shuffle(samples.begin(), samples.end(), generator);
            std::shuffle(backgrounds.begin(), backgrounds.end(), generator);
        }

        // read sample image
        auto const &sample_file(samples[idx % samples.size()]);
        cv::Mat sample = cv::imread(sample_file);
        double sampleRatio = (double)sample.cols / (double)sample.rows;
        double outputRatio = (double)sample_width / (double)sample_height;

        // normalize sample
        cv::Mat greySample = sample;
        double min, max;

        if (sample.channels() != 1) {
            cv::cvtColor(sample, greySample, cv::COLOR_RGB2GRAY);
        }
        cv::minMaxIdx(greySample, &min, &max);
        greySample -= min;
        greySample /= (max - min) / 255.0;

        // generate mask
        cv::Mat mask(cv::Mat::ones(greySample.rows, greySample.cols, greySample.type()));

        // enlarge canvas to fit output ratio
        cv::Mat resizedSample, resizedMask;

        if (backgrounds.size() > 0 && sampleRatio < outputRatio) {
            int width = (int)((double)greySample.rows * outputRatio);
            cv::Rect area(
                (width - greySample.cols) / 2,
                0,
                greySample.cols,
                greySample.rows
            );

            resizedSample = cv::Mat::zeros(greySample.rows, width, greySample.type());
            resizedMask = cv::Mat::zeros(greySample.rows, width, greySample.type());
            greySample.copyTo(resizedSample(area));
            mask.copyTo(resizedMask(area));
        } else if (backgrounds.size() > 0 && sampleRatio > outputRatio) {
            int height = (int)((double)greySample.cols / outputRatio);
            cv::Rect area(
                0,
                (height - greySample.rows) / 2,
                greySample.cols,
                greySample.rows
            );

            resizedSample = cv::Mat::zeros(height, greySample.cols, greySample.type());
            resizedMask = cv::Mat::zeros(height, greySample.cols, greySample.type());
            greySample.copyTo(resizedSample(area));
            mask.copyTo(resizedMask(area));
        } else {
            resizedSample = greySample;
            resizedMask = mask;
        }

        // apply distortions
        cv::Mat target(resizedSample.rows, resizedSample.cols, resizedSample.type());
        cv::Mat targetMask(resizedSample.rows, resizedSample.cols, resizedSample.type());
        double halfWidth = resizedSample.cols / 2.0;
        double halfHeight = resizedSample.rows / 2.0;
        cv::Mat rotationVector(3, 1, CV_64FC1);
        cv::Mat rotation4(cv::Mat::eye(4, 4, CV_64FC1));
        cv::Mat translate4(cv::Mat::eye(4, 4, CV_64FC1));
        cv::Mat translate3(cv::Mat::eye(3, 3, CV_64FC1));
        cv::Mat scale3(cv::Mat::eye(3, 3, CV_64FC1));
        int dx = (resizedSample.cols - greySample.cols) / 2;
        int dy = (resizedSample.rows - greySample.rows) / 2;
        cv::Point2f points1[4] = {
            cv::Point2f(dx,              dy),
            cv::Point2f(dx,              greySample.rows),
            cv::Point2f(greySample.cols, greySample.rows),
            cv::Point2f(greySample.cols, dy)
        };
        cv::Point2f points2[4];

        translate4.at<double>(0, 3) = -halfWidth;
        translate4.at<double>(1, 3) = -halfHeight;
        for (int k = 0; k < variations; k++) {
            double rx = k > 0 && rotate_stddev_x > 0.0 ? xdist(generator) : 0.0;
            double ry = k > 0 && rotate_stddev_y > 0.0 ? ydist(generator) : 0.0;
            double rz = k > 0 && rotate_stddev_z > 0.0 ? zdist(generator) : 0.0;
            double rl = k > 0 && luminosity_stddev > 0.0 ? ldist(generator) : 0.0;

            // compute rotation in 3d
            rotationVector.at<double>(0) = rx;
            rotationVector.at<double>(1) = ry;
            rotationVector.at<double>(2) = rz;
            cv::Rodrigues(rotationVector, cv::Mat(rotation4, cv::Rect(0, 0, 3, 3)));

            // compute transformation in 3d
            cv::Mat transform4(rotation4 * translate4);
            double minx = DBL_MAX, miny = DBL_MAX;
            double maxx = DBL_MIN, maxy = DBL_MIN;

            for (int j = 0; j < 4; j++) {
                cv::Mat point(4, 1, CV_64FC1);

                point.at<double>(0) = points1[j].x;
                point.at<double>(1) = points1[j].y;
                point.at<double>(2) = 0.0;
                point.at<double>(3) = 1.0;
                point = transform4 * point;
                points2[j].x = point.at<double>(0);
                points2[j].y = point.at<double>(1);

                if (points2[j].x < minx) {
                    minx = points2[j].x;
                }
                if (points2[j].x > maxx) {
                    maxx = points2[j].x;
                }
                if (points2[j].y < miny) {
                    miny = points2[j].y;
                }
                if (points2[j].y > maxy) {
                    maxy = points2[j].y;
                }
            }

            // compute transformation in 2d
            cv::Mat projection3(cv::getPerspectiveTransform(points1, points2));
            double scalex = (resizedSample.cols - dx) / (maxx - minx);
            double scaley = (resizedSample.rows - dy) / (maxy - miny);

            translate3.at<double>(0, 2) = halfWidth;
            translate3.at<double>(1, 2) = halfHeight;

            scale3.at<double>(0, 0) = scalex; //MIN(scalex, scaley);
            scale3.at<double>(1, 1) = scaley; //MIN(scalex, scaley);

            // transform sample and mask in 2d
            cv::Mat transform3(translate3 * scale3 * projection3);

            cv::warpPerspective(resizedSample, target, transform3, target.size());
            cv::warpPerspective(resizedMask, targetMask, transform3, targetMask.size());

            // apply luminosity change
            if (rl != 0.0) {
                rl += 1.0;
                target *= rl;
            }

            // read background image
            cv::Mat greyBackground;

            if (backgrounds.size() > 0) {
                auto const &background_file(backgrounds[i % backgrounds.size()]);
                cv::Mat background = cv::imread(background_file);

                // normalize background image
                if (background.channels() != 1) {
                    cv::cvtColor(background, greyBackground, cv::COLOR_RGB2GRAY);
                } else {
                    greyBackground = background;
                }
                cv::minMaxIdx(greyBackground, &min, &max);
                greyBackground -= min;
                greyBackground /= (max - min) / 255.0;

                // reshape background to fit output ratio
                double backgroundRatio = (double)greyBackground.cols / (double)greyBackground.rows;
                cv::Mat tmp;

                if (backgroundRatio < outputRatio) {
                    int height = (int)((double)greyBackground.cols / outputRatio);
                    std::uniform_int_distribution<int> hdist(0, greyBackground.rows - height);

                    tmp = greyBackground(
                        cv::Rect(
                            0,
                            hdist(generator),
                            greyBackground.cols,
                            height
                        )
                    );
                } else if (backgroundRatio > outputRatio) {
                    int width = (int)((double)greyBackground.rows * outputRatio);
                    std::uniform_int_distribution<int> wdist(0, greyBackground.cols - width);

                    tmp = greyBackground(
                        cv::Rect(
                            wdist(generator),
                            0,
                            width,
                            greyBackground.rows
                        )
                    );
                } else {
                    tmp = greyBackground;
                }
                cv::resize(tmp, greyBackground, resizedSample.size(), 0, 0, cv::INTER_CUBIC);
            } else {
                // random noise background
                greyBackground = cv::Mat(target.rows, target.cols, CV_8UC1);
                cv::randn(greyBackground, 255.0 / 2, 255.0 / 2 / 3);
                cv::GaussianBlur(greyBackground, greyBackground, cv::Size(5, 5), 10);
            }

            // blend background
            cv::Mat sampleMask, backgroundMask, tmp;

            cv::threshold(targetMask, sampleMask, 0.1, 255.0, cv::THRESH_BINARY);
            cv::erode(sampleMask, tmp, el);
            cv::blur(tmp, sampleMask, cv::Size(5, 5));

            cv::threshold(targetMask, backgroundMask, 0.1, 255.0, cv::THRESH_BINARY_INV);
            cv::dilate(backgroundMask, tmp, el);
            cv::blur(tmp, backgroundMask, cv::Size(5, 5));

            cv::multiply(target, sampleMask, target, 1.0 / 255.0);
            cv::multiply(greyBackground, backgroundMask, greyBackground, 1.0 / 255.0);

            target += greyBackground;

            // cv::namedWindow("preview", cv::WINDOW_NORMAL);
            // cv::imshow("preview", target);
            // while ((cv::waitKey(0) & 0xff) != '\n');

            // cv::namedWindow("preview", cv::WINDOW_NORMAL);
            // cv::imshow("preview", greyBackground);
            // while ((cv::waitKey(0) & 0xff) != '\n');

            // sample resize
            cv::Mat finalSample;

            cv::resize(target, finalSample, cv::Size(sample_width, sample_height), 0, 0, cv::INTER_CUBIC);

            // cv::namedWindow("preview", cv::WINDOW_NORMAL);
            // cv::imshow("preview", finalSample);
            // while ((cv::waitKey(0) & 0xff) != '\n');

            // sample save
            CvMat targetfinal_ = finalSample;

            icvWriteVecSample(fp, &targetfinal_);

            i++;
            if (i % 100 == 0) {
                fprintf(stdout, "processed %d images, %d samples\n", idx, i);
                fflush(stdout);
            }
        }
        idx++;
    }

    // close output file
    fclose(fp);
    return 0;
}
コード例 #6
0
ファイル: DistanceFieldFont.cpp プロジェクト: biddyweb/ewol
void ewol::resource::DistanceFieldFont::generateDistanceField(const egami::ImageMono& _input, egami::Image& _output) {
	std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
	int32_t size = _input.getSize().x() * _input.getSize().y();
	std::vector<short> xdist(size);
	std::vector<short> ydist(size);
	std::vector<double> gx(size);
	std::vector<double> gy(size);
	std::vector<double> data(size);
	std::vector<double> outside(size);
	std::vector<double> inside(size);
	// Convert img into double (data)
	double img_min = 255, img_max = -255;
	for (int32_t yyy = 0; yyy < _input.getSize().y(); ++yyy) {
		for (int32_t xxx = 0; xxx < _input.getSize().x(); ++xxx) {
			int32_t iii = yyy * _input.getSize().x() + xxx;
			double v = _input.get(ivec2(xxx, yyy));
			data[iii] = v;
			if (v > img_max) {
				img_max = v;
			}
			if (v < img_min) {
				img_min = v;
			}
		}
	}
	// Rescale image levels between 0 and 1
	for (int32_t yyy = 0; yyy < _input.getSize().y(); ++yyy) {
		for (int32_t xxx = 0; xxx < _input.getSize().x(); ++xxx) {
			int32_t iii = yyy * _input.getSize().x() + xxx;
			data[iii] = (_input.get(ivec2(xxx, yyy))-img_min)/img_max;
		}
	}
	
	// Compute outside = edtaa3(bitmap); % Transform background (0's)
	computegradient(&data[0], _input.getSize().x(), _input.getSize().y(), &gx[0], &gy[0]);
	edtaa3(&data[0], &gx[0], &gy[0], _input.getSize().x(), _input.getSize().y(), &xdist[0], &ydist[0], &outside[0]);
	for(size_t iii = 0; iii < outside.size(); ++iii) {
		if( outside[iii] < 0 ) {
			outside[iii] = 0.0;
		}
	}
	
	// Compute inside = edtaa3(1-bitmap); % Transform foreground (1's)
	for(size_t iii = 0; iii < gx.size(); ++iii) {
		gx[iii] = 0;
	}
	for(size_t iii = 0; iii < gy.size(); ++iii) {
		gy[iii] = 0;
	}
	for(size_t iii = 0; iii < data.size(); ++iii) {
		data[iii] = 1 - data[iii];
	}
	computegradient( &data[0], _input.getSize().x(), _input.getSize().y(), &gx[0], &gy[0]);
	edtaa3(&data[0], &gx[0], &gy[0], _input.getSize().x(), _input.getSize().y(), &xdist[0], &ydist[0], &inside[0]);
	for(size_t iii = 0; iii < inside.size(); ++iii) {
		if( inside[iii] < 0 ) {
			inside[iii] = 0.0;
		}
	}
	
	_output.resize(_input.getSize(), etk::Color<>(0));
	_output.clear(etk::Color<>(0));
	for (int32_t xxx = 0; xxx < _output.getSize().x(); ++xxx) {
		for (int32_t yyy = 0; yyy < _output.getSize().y(); ++yyy) {
			int32_t iii = yyy * _output.getSize().x() + xxx;
			outside[iii] -= inside[iii];
			outside[iii] = 128+outside[iii]*16;
			if( outside[iii] < 0 ) {
				outside[iii] = 0;
			}
			if( outside[iii] > 255 ) {
				outside[iii] = 255;
			}
			uint8_t val = 255 - (unsigned char) outside[iii];
			// TODO : Remove multiple size of the map ...
			_output.set(ivec2(xxx, yyy), etk::Color<>((int32_t)val,(int32_t)val,(int32_t)val,255));
		}
	}
}