Giter Site home page Giter Site logo

syntheticimagerenderer's Introduction

SyntheticImageRenderer

A synthetic image renderer made with Ogre

The code in main generates these files, without opening any windows:

To change the configuration for any image use:

std::default_random_engine generator(42);
ProcessConfigurator configurator;
configurator.imagesConfigurations.emplace_back(SingleImageConfiguration {
    .inputMesh = "../fish.mesh", //path to mesh
    .outputPath = "../rendered.png", //image name, if it is "" then no image is created
    .width = 250, //image width
    .height = 250, //image height
    .randomnessProviderPosition = [&generator] (const Ogre::Vector3& point) { 
        // Provides a random variation on a point
        // This is for moving the camera a bit
        std::normal_distribution<Ogre::Real> distributionX(point.x, 25.0);
        std::normal_distribution<Ogre::Real> distributionY(point.y, 5.0);
        std::normal_distribution<Ogre::Real> distributionZ(point.z, 5.0);
        return Ogre::Vector3(
            distributionX(generator),
            distributionY(generator),
            distributionZ(generator)
        );
    },
    .randomnessProviderRotation = [&generator] () {
        // Provides a random rotation for the camera
        std::normal_distribution<Ogre::Real> distributionAngle(0, 10);
        return Ogre::Degree(distributionAngle(generator));
    },
    .postProcessing = [] (cv::Mat& image) {
    	// Images have transparent backgrounds,
    	// and allow for little customization,
    	// use this if you want to change the result
        cv::Mat mask;
        inRange(image, cv::Scalar(0, 0, 0, 0), cv::Scalar(255, 255, 255, 0), mask);
        image.setTo(cv::Scalar(0, 0, 0, 255), mask);
        return image;
    },
});

syntheticimagerenderer's People

Contributors

emmanuelmess avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.