virtual void close() { yInfo() << "Bye bye"; }
virtual void endPacket() { yInfo() << "Packet ends"; }
virtual void reset() { inputCache = outputCache = ""; yInfo() << "Stream reset"; }
virtual void beginPacket() { yInfo() << "Packet begins"; inputCache = ""; outputCache = ""; }
bool vPreProcessModule::configure(yarp::os::ResourceFinder &rf) { bool pepper = rf.check("pepper") && rf.check("pepper", yarp::os::Value(true)).asBool(); bool rectify = rf.check("rectify") && rf.check("rectify", yarp::os::Value(true)).asBool(); bool undistort = rf.check("undistort") && rf.check("undistort", yarp::os::Value(true)).asBool(); bool truncate = rf.check("truncate") && rf.check("truncate", yarp::os::Value(true)).asBool(); bool flipx = rf.check("flipx") && rf.check("flipx", yarp::os::Value(true)).asBool(); bool flipy = rf.check("flipy") && rf.check("flipy", yarp::os::Value(true)).asBool(); bool precheck = rf.check("precheck") && rf.check("precheck", yarp::os::Value(true)).asBool(); bool split = rf.check("split") && rf.check("split", yarp::os::Value(true)).asBool(); bool local_stamp = rf.check("local_stamp") && rf.check("local_stamp", yarp::os::Value(true)).asBool(); if(precheck) yInfo() << "Performing precheck for event corruption"; if(flipx) yInfo() << "Flipping vision horizontally"; if(flipy) yInfo() << "Flipping vision vertically"; if(pepper) yInfo() << "Applying salt and pepper filter"; if(rectify) yInfo() << "Rectifying image pairs using extrinsic parameters"; if(undistort && truncate) yInfo() << "Applying camera undistortion - truncating to sensor size"; if(undistort && !truncate) yInfo() << "Applying camera undistortion - without truncation"; if(split) yInfo() << "Splitting into left/right streams"; eventManager.initBasic(rf.check("name", yarp::os::Value("/vPreProcess")).asString(), rf.check("height", yarp::os::Value(240)).asInt(), rf.check("width", yarp::os::Value(304)).asInt(), precheck, flipx, flipy, pepper, rectify, undistort, split, local_stamp); if(pepper) { eventManager.initPepper(rf.check("spatialSize", yarp::os::Value(1)).asDouble(), rf.check("temporalSize", yarp::os::Value(0.1)).asDouble() * vtsHelper::vtsscaler); } if(undistort) { yarp::os::ResourceFinder calibfinder; calibfinder.setVerbose(); calibfinder.setDefaultContext(rf.check("calibContext", yarp::os::Value("cameraCalib")).asString().c_str()); calibfinder.setDefaultConfigFile(rf.check("calibFile", yarp::os::Value("iCubEyes-ATIS.ini")).asString().c_str()); calibfinder.configure(0, 0); yarp::os::Bottle &leftParams = calibfinder.findGroup("CAMERA_CALIBRATION_LEFT"); yarp::os::Bottle &rightParams = calibfinder.findGroup("CAMERA_CALIBRATION_RIGHT"); yarp::os::Bottle &stereoParams = calibfinder.findGroup("STEREO_DISPARITY"); if(leftParams.isNull() || rightParams.isNull()) { yError() << "Could not load intrinsic camera parameters"; return false; } if (rectify && stereoParams.isNull()) { yError() << "Could not load extrinsic camera parameters"; return false; } std::cout << leftParams.toString() << std::endl; std::cout << rightParams.toString() << std::endl; std::cout << stereoParams.toString() << std::endl; eventManager.initUndistortion(leftParams, rightParams, stereoParams, truncate); } return eventManager.start(); }