예제 #1
0
 void VideoCapture::setup(kerberos::StringMap &settings)
 {
     int width = std::atoi(settings.at("captures.VideoCapture.frameWidth").c_str());
     int height = std::atoi(settings.at("captures.VideoCapture.frameHeight").c_str());
     std::string path = settings.at("captures.VideoCapture.path");
     int angle = std::atoi(settings.at("captures.VideoCapture.angle").c_str());
     int delay = std::atoi(settings.at("captures.VideoCapture.delay").c_str());
     
     // Save width and height in settings
     Capture::setup(settings, width, height);
     setImageSize(width, height);
     setRotation(angle);
     setDelay(delay);
     setPath(path);
     
     // Initialize video
     open();
 }
예제 #2
0
    void USBCamera::setup(kerberos::StringMap &settings)
    {
        int width = std::atoi(settings.at("captures.USBCamera.frameWidth").c_str());
        int height = std::atoi(settings.at("captures.USBCamera.frameHeight").c_str());
        int deviceNumber = std::atoi(settings.at("captures.USBCamera.deviceNumber").c_str());
        int angle = std::atoi(settings.at("captures.USBCamera.angle").c_str());
        int delay = std::atoi(settings.at("captures.USBCamera.delay").c_str());
        std::string fourcc = settings.at("captures.USBCamera.fourcc");

        // Initialize executor (update the usb camera at specific times).
        tryToUpdateCapture.setAction(this, &USBCamera::update);
        tryToUpdateCapture.setInterval("thrice in 10 functions calls");

        // Save width and height in settings
        Capture::setup(settings, width, height, angle);
        setImageSize(width, height);
        setRotation(angle);
        setDelay(delay);
        setDeviceNumber(deviceNumber);
        setFourcc(fourcc);

        // Initialize USB Camera
        open();
    }
예제 #3
0
    void Machinery::setup(const kerberos::StringMap & settings)
    {
        // -----------------------------------------------------------
        // Creates condition, algorithms, expositors, heuristics and io handlers.
        
        LINFO << "Starting conditions: " + settings.at("condition");
        std::vector<Condition *> conditions = Factory<Condition>::getInstance()->createMultiple(settings.at("condition"));
        for(int i = 0; i < conditions.size(); i++)
        {
            conditions[i]->setup(settings);
        }
        setCondition(conditions);

        LINFO << "Starting algorithm: " + settings.at("algorithm");
        Algorithm * algorithm = Factory<Algorithm>::getInstance()->create(settings.at("algorithm"));
        algorithm->setup(settings);
        setAlgorithm(algorithm);

        LINFO << "Starting expositor: " + settings.at("expositor");
        Expositor * expositor = Factory<Expositor>::getInstance()->create(settings.at("expositor"));
        expositor->setup(settings);
        setExpositor(expositor);

        LINFO << "Starting heuristic: " + settings.at("heuristic");
        Heuristic * heuristic = Factory<Heuristic>::getInstance()->create(settings.at("heuristic"));
        heuristic->setup(settings);
        setHeuristic(heuristic);  

        LINFO << "Starting io devices: " + settings.at("io");
        std::vector<Io *> ios = Factory<Io>::getInstance()->createMultiple(settings.at("io"));
        for(int i = 0; i < ios.size(); i++)
        {
            ios[i]->setup(settings);
        }
        setIo(ios);
    }