Created
November 25, 2014 02:32
-
-
Save elliotwoods/feaae84c777f5cc77a85 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ofApp.h" | |
using namespace ofxAssets; | |
//-------------------------------------------------------------- | |
void ofApp::setup2(){ | |
ofSetWindowTitle("Digital Emulsion Toolkit v0.1"); | |
ofSetCircleResolution(120); | |
splashScreen.init("splashScreen.png"); | |
splashScreen.begin(0.0f); | |
auto automator = MAKE(Automator); | |
//-- | |
//Camera | |
//-- | |
// | |
auto cameraDevice = MAKE(ofxUeye::Device); | |
// auto cameraDevice = MAKE(ofxMachineVision::Device::VideoInputDevice); | |
auto camera = MAKE(Item::Camera); | |
camera->setDevice(cameraDevice, 0); | |
this->world.add(camera); | |
auto cameraActiveRegion = MAKE(CameraActiveRegion); | |
cameraActiveRegion->connect(camera); | |
this->world.add(cameraActiveRegion); | |
auto board = MAKE(Item::Board); | |
this->world.add(board); | |
auto cameraCalibrate = MAKE(Procedure::Calibrate::CameraIntrinsics); | |
cameraCalibrate->connect(camera); | |
cameraCalibrate->connect(board); | |
this->world.add(cameraCalibrate); | |
auto cameraToWorld = MAKE(CameraToWorld); | |
cameraToWorld->connect(camera); | |
cameraToWorld->connect(board); | |
this->world.add(cameraToWorld); | |
// | |
//-- | |
for (int i = 0; i < PROJECTOR_COUNT; i++) { | |
const auto projectorName = "P" + ofToString(i); | |
auto mirrorArrangement = MAKE(MirrorArrangement); | |
mirrorArrangement->setName(projectorName + " - Mirror Arrangement"); | |
this->world.add(mirrorArrangement); | |
auto projectorOutput = MAKE(ProjectorOutput); | |
projectorOutput->setName(projectorName + " - Projector Output"); | |
this->world.add(projectorOutput); | |
auto mirrorHomography = MAKE(MirrorHomography); | |
mirrorHomography->setName(projectorName + " - Mirror Homography"); | |
mirrorHomography->connect(mirrorArrangement); | |
mirrorHomography->connect(projectorOutput); | |
this->world.add(mirrorHomography); | |
auto worldSampleDatabase = MAKE(WorldSampleDatabase); | |
worldSampleDatabase->setName(projectorName + " - World Sample Database"); | |
worldSampleDatabase->connect(mirrorArrangement); | |
worldSampleDatabase->connect(mirrorHomography); | |
worldSampleDatabase->connect(projectorOutput); | |
this->world.add(worldSampleDatabase); | |
auto graycodePerMirror = MAKE(GraycodePerMirror); | |
graycodePerMirror->setName(projectorName + " - Graycode Per Mirror"); | |
graycodePerMirror->connect(camera); | |
graycodePerMirror->connect(cameraToWorld); | |
graycodePerMirror->connect(cameraActiveRegion); | |
graycodePerMirror->connect(mirrorArrangement); | |
graycodePerMirror->connect(projectorOutput); | |
graycodePerMirror->connect(mirrorHomography); | |
graycodePerMirror->connect(worldSampleDatabase); | |
this->world.add(graycodePerMirror); | |
auto fitRays = MAKE(FitRays); | |
fitRays->setName(projectorName + " - Fit Rays"); | |
fitRays->connect(worldSampleDatabase); | |
fitRays->connect(mirrorHomography); | |
fitRays->connect(mirrorArrangement); | |
// fitRays->connect(camera); | |
fitRays->connect(projectorOutput); | |
this->world.add(fitRays); | |
automator->add(graycodePerMirror); | |
automator->add(fitRays); | |
} | |
this->world.add(automator); | |
this->gui.init(); | |
this->world.init(this->gui.getController()); | |
this->world.loadAll(); | |
this->splashScreen.end(); | |
} | |
//-------------------------------------------------------------- | |
void ofApp::update(){ | |
this->world.update(); | |
} | |
//-------------------------------------------------------------- | |
void ofApp::draw(){ | |
if (ofGetFrameNum() == 2) { | |
this->setup2(); | |
} | |
} | |
//-------------------------------------------------------------- | |
void ofApp::keyPressed(int key){ | |
} | |
//-------------------------------------------------------------- | |
void ofApp::keyReleased(int key){ | |
} | |
//-------------------------------------------------------------- | |
void ofApp::mouseMoved(int x, int y ){ | |
} | |
//-------------------------------------------------------------- | |
void ofApp::mouseDragged(int x, int y, int button){ | |
} | |
//-------------------------------------------------------------- | |
void ofApp::mousePressed(int x, int y, int button){ | |
} | |
//-------------------------------------------------------------- | |
void ofApp::mouseReleased(int x, int y, int button){ | |
} | |
//-------------------------------------------------------------- | |
void ofApp::windowResized(int w, int h){ | |
} | |
//-------------------------------------------------------------- | |
void ofApp::gotMessage(ofMessage msg){ | |
} | |
//-------------------------------------------------------------- | |
void ofApp::dragEvent(ofDragInfo dragInfo){ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment