Compare commits
No commits in common. "master" and "tom" have entirely different histories.
10
README
Normal file
10
README
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
WARNING: WORK IN PROGRESS...
|
||||||
|
|
||||||
|
configuring OpenFrameworks
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
these files are configured according to OpenFrameworks addons - http://ofxaddons.com/howto
|
||||||
|
|
||||||
|
(1) drag-drop "ReflectiveIndex" folder into your OpenFrameworks project
|
||||||
|
(2) Install depedencies: {ofxDirList, ofxControlPanel, ofxXmlSettings};
|
||||||
|
(3) Press Play!
|
||||||
@ -1,2 +0,0 @@
|
|||||||
<img src="https://davidgauthier.info/rfi/img-resize/rfi3.jpg" width="100%">
|
|
||||||
<img src="https://davidgauthier.info/rfi/img-resize/rfi4.jpg" width="100%">
|
|
||||||
@ -97,29 +97,29 @@ void RefractiveIndex::setup()
|
|||||||
|
|
||||||
//TODO: whichever one of these is first - it always runs twice ?
|
//TODO: whichever one of these is first - it always runs twice ?
|
||||||
|
|
||||||
//_analysisVector.push_back(new ShadowScapesAnalysis(V));
|
// _analysisVector.push_back(new ShadowScapesAnalysis(V));
|
||||||
//_analysisVector.push_back(new ShadowScapesAnalysis(H));
|
// _analysisVector.push_back(new ShadowScapesAnalysis(H));
|
||||||
//_analysisVector.push_back(new ShadowScapesAnalysis(D));
|
// _analysisVector.push_back(new ShadowScapesAnalysis(D));
|
||||||
|
|
||||||
_analysisVector.push_back(new RelaxRateAnalysis());
|
_analysisVector.push_back(new RelaxRateAnalysis());
|
||||||
|
|
||||||
//_analysisVector.push_back(new IResponseAnalysis());
|
_analysisVector.push_back(new IResponseAnalysis());
|
||||||
|
|
||||||
//_analysisVector.push_back(new ShapeFromShadingAnalysis());
|
_analysisVector.push_back(new ShapeFromShadingAnalysis());
|
||||||
|
|
||||||
//_analysisVector.push_back(new StrobeAnalysis());
|
// _analysisVector.push_back(new StrobeAnalysis());
|
||||||
|
|
||||||
//_analysisVector.push_back(new CamNoiseAnalysis());
|
_analysisVector.push_back(new CamNoiseAnalysis());
|
||||||
|
|
||||||
//_analysisVector.push_back(new ColorSingleAnalysis());
|
_analysisVector.push_back(new ColorSingleAnalysis());
|
||||||
|
|
||||||
//_analysisVector.push_back(new ColorMultiAnalysis());
|
_analysisVector.push_back(new ColorMultiAnalysis());
|
||||||
|
|
||||||
//_analysisVector.push_back(new DiffNoiseAnalysis());
|
_analysisVector.push_back(new DiffNoiseAnalysis());
|
||||||
|
|
||||||
|
|
||||||
_currentAnalysisIndx = 0;
|
_currentAnalysisIndx = 0;
|
||||||
_currentAnalysis = _analysisVector.at(_currentAnalysisIndx++);
|
_currentAnalysis = _analysisVector.at(_currentAnalysisIndx);
|
||||||
|
|
||||||
_state = ISTATE_START;
|
_state = ISTATE_START;
|
||||||
|
|
||||||
@ -209,7 +209,6 @@ void RefractiveIndex::setup_camera()
|
|||||||
ofLog(OF_LOG_ERROR) << "RefractiveIndex::setup_camera - could not initialise grabber";
|
ofLog(OF_LOG_ERROR) << "RefractiveIndex::setup_camera - could not initialise grabber";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_vidGrabber.setUseTexture(false);
|
|
||||||
_vidGrabber.listDevices();
|
_vidGrabber.listDevices();
|
||||||
_vidGrabber.setVerbose(true);
|
_vidGrabber.setVerbose(true);
|
||||||
_vid_stream_open = true;
|
_vid_stream_open = true;
|
||||||
|
|||||||
@ -4,14 +4,6 @@
|
|||||||
|
|
||||||
#define SCREEN_WIDTH 800
|
#define SCREEN_WIDTH 800
|
||||||
#define SCREEN_HEIGHT 600
|
#define SCREEN_HEIGHT 600
|
||||||
/////////////////////////dis is the new shit///////////
|
|
||||||
|
|
||||||
/////////////////////////dis is the new shit///////////
|
|
||||||
|
|
||||||
/////////////////////////dis is the new shit///////////
|
|
||||||
|
|
||||||
/////////////////////////dis is the new shit///////////
|
|
||||||
|
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
ofAppGlutWindow window;
|
ofAppGlutWindow window;
|
||||||
|
|||||||
@ -72,8 +72,8 @@ void AbstractAnalysis::create_dir()
|
|||||||
}
|
}
|
||||||
|
|
||||||
ofxFileHelper fileHelper;
|
ofxFileHelper fileHelper;
|
||||||
_whole_file_path = ofToDataPath("") + ANALYSIS_PATH + RefractiveIndex::_location + "/" + _name + "/"+replaceTime ;
|
_whole_file_path = ANALYSIS_PATH + RefractiveIndex::_location + "/" + _name + "/"+replaceTime ;
|
||||||
cout << "_whole_file_path = " << _whole_file_path << endl;
|
//cout << "_whole_file_path = " << _whole_file_path << endl;
|
||||||
|
|
||||||
if(!fileHelper.doesDirectoryExist(_whole_file_path)){
|
if(!fileHelper.doesDirectoryExist(_whole_file_path)){
|
||||||
fileHelper.makeDirectory(ANALYSIS_PATH);
|
fileHelper.makeDirectory(ANALYSIS_PATH);
|
||||||
@ -163,8 +163,7 @@ ofPixels AbstractAnalysis::calculateListOfZValues(ofImage image1, ofImage image2
|
|||||||
int y=0;
|
int y=0;
|
||||||
|
|
||||||
//for each pixel...
|
//for each pixel...
|
||||||
//for(int i=0;i<imagePixels1.size();i+=3){
|
for(int i=0;i<imagePixels1.size();i+=3){
|
||||||
for(int i=0;i<20;i+=3){
|
|
||||||
|
|
||||||
//get the colour of each image at this x y location - we will use these colours for comparison according to the below criteria
|
//get the colour of each image at this x y location - we will use these colours for comparison according to the below criteria
|
||||||
ofColor colourImage1 = imagePixels1.getColor(x, y);
|
ofColor colourImage1 = imagePixels1.getColor(x, y);
|
||||||
@ -317,20 +316,3 @@ int AbstractAnalysis::getRecordedValueFromFileName(string str){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AbstractAnalysis::saveimage(string filename)
|
|
||||||
{
|
|
||||||
if(RefractiveIndex::_pixels.isAllocated()) {
|
|
||||||
|
|
||||||
string fname = _whole_file_path + "/" + filename;
|
|
||||||
|
|
||||||
cout << "saving - " << fname << endl;
|
|
||||||
|
|
||||||
ofSaveImage(RefractiveIndex::_pixels, fname, OF_IMAGE_QUALITY_BEST);
|
|
||||||
|
|
||||||
_saved_filenames.push_back(fname);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
ofLog(OF_LOG_ERROR) << "RefractiveIndex::_pixels NOT allocated...";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
@ -39,7 +39,6 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual void create_dir();
|
virtual void create_dir();
|
||||||
virtual void saveimage(string filename);
|
|
||||||
|
|
||||||
// acquire images - all the children (see - do_synthesize)
|
// acquire images - all the children (see - do_synthesize)
|
||||||
virtual void acquire() = 0;
|
virtual void acquire() = 0;
|
||||||
|
|||||||
@ -133,57 +133,49 @@ void CamNoiseAnalysis::draw()
|
|||||||
// still need to deal with latency frames here - i.e.: there are frames
|
// still need to deal with latency frames here - i.e.: there are frames
|
||||||
/// *** TODO *** ///
|
/// *** TODO *** ///
|
||||||
|
|
||||||
if (_frame_cnt < _frame_cnt_max)
|
ofEnableAlphaBlending();
|
||||||
{
|
ofColor aColour;
|
||||||
|
|
||||||
ofEnableAlphaBlending();
|
int _fade_in_frames = _frame_cnt_max/10;
|
||||||
ofColor aColour;
|
float _number_of_grey_levels=10;
|
||||||
|
|
||||||
int _fade_in_frames = _frame_cnt_max/10;
|
float _frames_per_level = _frame_cnt_max / _number_of_grey_levels;
|
||||||
float _number_of_grey_levels=10;
|
ofColor someColor;
|
||||||
|
|
||||||
float _frames_per_level = _frame_cnt_max / _number_of_grey_levels;
|
if (_frame_cnt < _fade_in_frames) {
|
||||||
ofColor someColor;
|
aColour.set(255, 255, 255, ofMap(_frame_cnt, 0, _fade_in_frames, 0, 255));
|
||||||
|
ofSetColor(aColour);
|
||||||
if (_frame_cnt < _fade_in_frames) {
|
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
||||||
aColour.set(255, 255, 255, ofMap(_frame_cnt, 0, _fade_in_frames, 0, 255));
|
//cout << "FADE IN STROBE TIME " << endl;
|
||||||
ofSetColor(aColour);
|
|
||||||
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
|
||||||
//cout << "FADE IN STROBE TIME " << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_frame_cnt >= _fade_in_frames && _frame_cnt < (_frame_cnt_max-_fade_in_frames)){
|
|
||||||
|
|
||||||
|
|
||||||
for(int i=0;i<_number_of_grey_levels;i++){
|
|
||||||
if (_frame_cnt>= _frames_per_level *( i-1) && +_frame_cnt < _frames_per_level * (i) ) {
|
|
||||||
//set colour to current grey level
|
|
||||||
c=255-( 255.0 * ( i /_number_of_grey_levels));
|
|
||||||
someColor.set(c);
|
|
||||||
}
|
|
||||||
ofSetColor(someColor);
|
|
||||||
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_frame_cnt >= (_frame_cnt_max-_fade_in_frames) && _frame_cnt < _frame_cnt_max) {
|
|
||||||
aColour.set(0, 0, 0, 255-ofMap(_frame_cnt, 0, _fade_in_frames, 0, 255));
|
|
||||||
ofSetColor(aColour);
|
|
||||||
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
|
||||||
// cout << "FADE OUT STROBE TIME " << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
ofDisableAlphaBlending();
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
|
||||||
_RUN_DONE = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_frame_cnt++;
|
if (_frame_cnt >= _fade_in_frames && _frame_cnt < (_frame_cnt_max-_fade_in_frames)){
|
||||||
break;
|
|
||||||
|
|
||||||
|
|
||||||
|
for(int i=0;i<_number_of_grey_levels;i++){
|
||||||
|
if (_frame_cnt>= _frames_per_level *( i-1) && +_frame_cnt < _frames_per_level * (i) ) {
|
||||||
|
//set colour to current grey level
|
||||||
|
c=255-( 255.0 * ( i /_number_of_grey_levels));
|
||||||
|
someColor.set(c);
|
||||||
|
}
|
||||||
|
ofSetColor(someColor);
|
||||||
|
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_frame_cnt >= (_frame_cnt_max-_fade_in_frames) && _frame_cnt < _frame_cnt_max) {
|
||||||
|
aColour.set(0, 0, 0, 255-ofMap(_frame_cnt, 0, _fade_in_frames, 0, 255));
|
||||||
|
ofSetColor(aColour);
|
||||||
|
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
||||||
|
// cout << "FADE OUT STROBE TIME " << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
_frame_cnt++;
|
||||||
|
ofDisableAlphaBlending();
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case STATE_SYNTHESISING:
|
case STATE_SYNTHESISING:
|
||||||
@ -233,10 +225,16 @@ void CamNoiseAnalysis::save_cb(Timer& timer)
|
|||||||
_save_cnt++;
|
_save_cnt++;
|
||||||
|
|
||||||
string file_name = ofToString(_save_cnt,2)+"_"+ ofToString(c,2)+"_"+ofToString(_run_cnt,2)+".jpg";
|
string file_name = ofToString(_save_cnt,2)+"_"+ ofToString(c,2)+"_"+ofToString(_run_cnt,2)+".jpg";
|
||||||
saveimage(file_name);
|
string thisLocation = RefractiveIndex::_location;
|
||||||
|
|
||||||
//if(_save_cnt >= NUM_SAVE_PER_RUN)
|
string file = _whole_file_path+"/"+file_name;
|
||||||
// _RUN_DONE = true;
|
|
||||||
|
ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST);
|
||||||
|
|
||||||
|
_saved_filenames.push_back(ofToDataPath("")+file);
|
||||||
|
|
||||||
|
if(_save_cnt >= NUM_SAVE_PER_RUN)
|
||||||
|
_RUN_DONE = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
void CamNoiseAnalysis::display_results_cb(Timer& timer){
|
void CamNoiseAnalysis::display_results_cb(Timer& timer){
|
||||||
|
|||||||
@ -150,53 +150,42 @@ void ColorMultiAnalysis::draw()
|
|||||||
switch (_state) {
|
switch (_state) {
|
||||||
case STATE_ACQUIRING:
|
case STATE_ACQUIRING:
|
||||||
{
|
{
|
||||||
|
int _fade_in_frames = _frame_cnt_max/50;
|
||||||
|
|
||||||
if (_frame_cnt < _frame_cnt_max)
|
if (_frame_cnt < _fade_in_frames) {
|
||||||
{
|
ofColor aColor;
|
||||||
|
|
||||||
|
aColor.setHsb(c, ofMap(_frame_cnt, 0, _fade_in_frames, 0, 255), ofMap(_frame_cnt, 0, _fade_in_frames, 0, 255));
|
||||||
|
|
||||||
int _fade_in_frames = _frame_cnt_max/50;
|
ofSetColor(aColor);
|
||||||
|
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
||||||
|
|
||||||
if (_frame_cnt < _fade_in_frames) {
|
cout << "FADING IN..." << endl;
|
||||||
ofColor aColor;
|
}
|
||||||
|
|
||||||
aColor.setHsb(c, ofMap(_frame_cnt, 0, _fade_in_frames, 0, 255), ofMap(_frame_cnt, 0, _fade_in_frames, 0, 255));
|
if (_frame_cnt >= _fade_in_frames && _frame_cnt < _frame_cnt_max-_fade_in_frames){
|
||||||
|
|
||||||
ofSetColor(aColor);
|
ofColor aColor;
|
||||||
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
aColor.setHsb(c, 255, 255);
|
||||||
|
ofSetColor(aColor);
|
||||||
|
|
||||||
cout << "FADING IN..." << endl;
|
//how far are we as a percent of _frame_count_max * 360 HUE VALUES
|
||||||
}
|
c = 255.0 * (_frame_cnt_max - _frame_cnt)/(_frame_cnt_max);
|
||||||
|
|
||||||
if (_frame_cnt >= _fade_in_frames && _frame_cnt < _frame_cnt_max-_fade_in_frames){
|
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
||||||
|
}
|
||||||
|
|
||||||
ofColor aColor;
|
if (_frame_cnt >= (_frame_cnt_max-_fade_in_frames) && _frame_cnt < _frame_cnt_max) {
|
||||||
aColor.setHsb(c, 255, 255);
|
|
||||||
ofSetColor(aColor);
|
|
||||||
|
|
||||||
//how far are we as a percent of _frame_count_max * 360 HUE VALUES
|
ofColor aColor;
|
||||||
c = 255.0 * (_frame_cnt_max - _frame_cnt)/(_frame_cnt_max);
|
|
||||||
|
|
||||||
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
aColor.setHsb(c, 255-ofMap(_fade_cnt, 0, _fade_in_frames, 0, 255), 255-ofMap(_fade_cnt, 0, _fade_in_frames, 0, 255));
|
||||||
}
|
|
||||||
|
|
||||||
if (_frame_cnt >= (_frame_cnt_max-_fade_in_frames) && _frame_cnt < _frame_cnt_max) {
|
ofSetColor(aColor);
|
||||||
|
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
||||||
|
|
||||||
ofColor aColor;
|
_fade_cnt++;
|
||||||
|
cout << "FADING OUT..." << endl;
|
||||||
aColor.setHsb(c, 255-ofMap(_fade_cnt, 0, _fade_in_frames, 0, 255), 255-ofMap(_fade_cnt, 0, _fade_in_frames, 0, 255));
|
|
||||||
|
|
||||||
ofSetColor(aColor);
|
|
||||||
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
|
||||||
|
|
||||||
_fade_cnt++;
|
|
||||||
cout << "FADING OUT..." << endl;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
_RUN_DONE = true;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,14 +236,21 @@ void ColorMultiAnalysis::draw()
|
|||||||
// this runs at save_cb timer rate = DELTA_T_SAVE
|
// this runs at save_cb timer rate = DELTA_T_SAVE
|
||||||
void ColorMultiAnalysis::save_cb(Timer& timer)
|
void ColorMultiAnalysis::save_cb(Timer& timer)
|
||||||
{
|
{
|
||||||
|
|
||||||
// cout << "COLORMULTIANALYSIS::saving...\n";
|
|
||||||
|
|
||||||
string file_name = ofToString(_save_cnt,2)+"_"+ofToString(c,2)+"_"+ofToString(_run_cnt,2)+".jpg";
|
|
||||||
saveimage(file_name);
|
|
||||||
|
|
||||||
_save_cnt++;
|
_save_cnt++;
|
||||||
|
|
||||||
|
// UPDATE THE COLOR ON THE SCREEN
|
||||||
|
//float c_last = c;
|
||||||
|
|
||||||
|
// cout << "COLORMULTIANALYSIS::saving...\n";
|
||||||
|
// cout << "c_last... " << c << endl;
|
||||||
|
string file_name = ofToString(_save_cnt,2)+"_"+ofToString(c,2)+"_"+ofToString(_run_cnt,2)+".jpg";
|
||||||
|
|
||||||
|
// cout<<_whole_file_path<<endl;
|
||||||
|
ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST);
|
||||||
|
_saved_filenames.push_back(ofToDataPath("")+_whole_file_path+"/"+file_name);
|
||||||
|
if(_save_cnt >= NUM_SAVE_PER_RUN){
|
||||||
|
_RUN_DONE = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorMultiAnalysis::display_results_cb(Timer& timer){
|
void ColorMultiAnalysis::display_results_cb(Timer& timer){
|
||||||
|
|||||||
@ -136,59 +136,51 @@ void ColorSingleAnalysis::draw()
|
|||||||
switch (_state) {
|
switch (_state) {
|
||||||
case STATE_ACQUIRING:
|
case STATE_ACQUIRING:
|
||||||
{
|
{
|
||||||
|
float one_third_of_frame_count_max=_frame_cnt_max/3;
|
||||||
|
|
||||||
|
int _fade_in_frames = one_third_of_frame_count_max/10;
|
||||||
|
|
||||||
if (_frame_cnt < _frame_cnt_max)
|
if (_frame_cnt < _fade_in_frames){
|
||||||
{
|
ofSetColor(ofMap(_frame_cnt, 0, _fade_in_frames, 0, 255), 0, 0);
|
||||||
|
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
||||||
|
fileNameTag = "FADING";
|
||||||
|
}
|
||||||
|
|
||||||
float one_third_of_frame_count_max=_frame_cnt_max/3;
|
if (_frame_cnt >= _fade_in_frames && _frame_cnt < one_third_of_frame_count_max){
|
||||||
int _fade_in_frames = one_third_of_frame_count_max/10;
|
r=255.0;
|
||||||
|
g=0.0;
|
||||||
|
b=0.0;
|
||||||
|
ofSetColor(r,g,b);
|
||||||
|
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
||||||
|
fileNameTag = "RED";
|
||||||
|
}
|
||||||
|
|
||||||
if (_frame_cnt < _fade_in_frames){
|
if (_frame_cnt >= one_third_of_frame_count_max && _frame_cnt < 2*one_third_of_frame_count_max){
|
||||||
ofSetColor(ofMap(_frame_cnt, 0, _fade_in_frames, 0, 255), 0, 0);
|
r=0.0;
|
||||||
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
g=255.0;
|
||||||
fileNameTag = "FADING";
|
b=0.0;
|
||||||
}
|
ofSetColor(r,g,b);
|
||||||
|
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
||||||
|
fileNameTag = "GREEN";
|
||||||
|
}
|
||||||
|
|
||||||
if (_frame_cnt >= _fade_in_frames && _frame_cnt < one_third_of_frame_count_max){
|
if (_frame_cnt >= 2*one_third_of_frame_count_max && _frame_cnt < (_frame_cnt_max-_fade_in_frames) ){
|
||||||
r=255.0;
|
r=0.0;
|
||||||
g=0.0;
|
g=0.0;
|
||||||
b=0.0;
|
b=255.0;
|
||||||
ofSetColor(r,g,b);
|
ofSetColor(r,g,b);
|
||||||
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
||||||
fileNameTag = "RED";
|
fileNameTag = "BLUE";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_frame_cnt >= one_third_of_frame_count_max && _frame_cnt < 2*one_third_of_frame_count_max){
|
if (_frame_cnt >= (_frame_cnt_max-_fade_in_frames) && _frame_cnt < _frame_cnt_max){
|
||||||
r=0.0;
|
|
||||||
g=255.0;
|
|
||||||
b=0.0;
|
|
||||||
ofSetColor(r,g,b);
|
|
||||||
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
|
||||||
fileNameTag = "GREEN";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_frame_cnt >= 2*one_third_of_frame_count_max && _frame_cnt < (_frame_cnt_max-_fade_in_frames) ){
|
ofSetColor(0, 0, 255-ofMap(_fade_cnt, 0, _fade_in_frames, 0, 255));
|
||||||
r=0.0;
|
cout << "255-ofMap(_frame_cnt, 0, _fade_in_frames, 0, 255)"<< 255-ofMap(_frame_cnt, 0, _fade_in_frames, 0, 255) << endl;
|
||||||
g=0.0;
|
|
||||||
b=255.0;
|
|
||||||
ofSetColor(r,g,b);
|
|
||||||
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
|
||||||
fileNameTag = "BLUE";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_frame_cnt >= (_frame_cnt_max-_fade_in_frames) && _frame_cnt < _frame_cnt_max){
|
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
||||||
|
_fade_cnt++;
|
||||||
ofSetColor(0, 0, 255-ofMap(_fade_cnt, 0, _fade_in_frames, 0, 255));
|
fileNameTag = "FADING";
|
||||||
cout << "255-ofMap(_frame_cnt, 0, _fade_in_frames, 0, 255)"<< 255-ofMap(_frame_cnt, 0, _fade_in_frames, 0, 255) << endl;
|
|
||||||
|
|
||||||
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
|
||||||
_fade_cnt++;
|
|
||||||
fileNameTag = "FADING";
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
_RUN_DONE = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_frame_cnt++;
|
_frame_cnt++;
|
||||||
@ -236,16 +228,21 @@ void ColorSingleAnalysis::draw()
|
|||||||
// this runs at save_cb timer rate = DELTA_T_SAVE
|
// this runs at save_cb timer rate = DELTA_T_SAVE
|
||||||
void ColorSingleAnalysis::save_cb(Timer& timer)
|
void ColorSingleAnalysis::save_cb(Timer& timer)
|
||||||
{
|
{
|
||||||
|
|
||||||
//cout << "ColorSingleAnalysis::saving...\n";
|
|
||||||
|
|
||||||
string file_name =ofToString(_save_cnt,2)+"_"+fileNameTag+"_"+ofToString(_run_cnt,2)+".jpg";
|
|
||||||
saveimage(file_name);
|
|
||||||
|
|
||||||
_save_cnt++;
|
_save_cnt++;
|
||||||
|
|
||||||
//if(_save_cnt >= NUM_SAVE_PER_RUN)
|
// cout << "ColorSingleAnalysis::saving...\n";
|
||||||
// _RUN_DONE = true;
|
|
||||||
|
string file_name =ofToString(_save_cnt,2)+"_"+fileNameTag+"_"+ofToString(_run_cnt,2)+".jpg";
|
||||||
|
|
||||||
|
//cout<<ofToString(_save_cnt,2)+"_"+fileNameTag+"_"+ofToString(_run_cnt,2)+".jpg";
|
||||||
|
cout<<file_name<<endl;
|
||||||
|
ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST);
|
||||||
|
_saved_filenames.push_back(ofToDataPath("")+_whole_file_path+"/"+file_name);
|
||||||
|
|
||||||
|
//cout<<_whole_file_path+"/"+file_name<<endl;
|
||||||
|
|
||||||
|
if(_save_cnt >= NUM_SAVE_PER_RUN)
|
||||||
|
_RUN_DONE = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
void ColorSingleAnalysis::display_results_cb(Timer& timer){
|
void ColorSingleAnalysis::display_results_cb(Timer& timer){
|
||||||
|
|||||||
@ -126,77 +126,67 @@ void DiffNoiseAnalysis::draw()
|
|||||||
switch (_state) {
|
switch (_state) {
|
||||||
case STATE_ACQUIRING:
|
case STATE_ACQUIRING:
|
||||||
{
|
{
|
||||||
|
ofColor aColour;
|
||||||
|
int rectSize = 5;
|
||||||
|
ofEnableAlphaBlending();
|
||||||
|
|
||||||
if (_frame_cnt < _frame_cnt_max)
|
int _fade_in_frames = _frame_cnt_max/10;
|
||||||
{
|
|
||||||
|
|
||||||
ofColor aColour;
|
if (_frame_cnt < _fade_in_frames) {
|
||||||
int rectSize = 5;
|
|
||||||
ofEnableAlphaBlending();
|
|
||||||
|
|
||||||
int _fade_in_frames = _frame_cnt_max/10;
|
for (int i=1; i < ofGetHeight() ; i=i+rectSize)
|
||||||
|
{
|
||||||
if (_frame_cnt < _fade_in_frames) {
|
for (int j=1; j < ofGetWidth(); j=j+rectSize)
|
||||||
|
|
||||||
for (int i=1; i < ofGetHeight() ; i=i+rectSize)
|
|
||||||
{
|
{
|
||||||
for (int j=1; j < ofGetWidth(); j=j+rectSize)
|
c = ofRandom(0,255);
|
||||||
{
|
aColour.set(c, c, c, ofMap(_frame_cnt, 0, _fade_in_frames, 0, 255));
|
||||||
c = ofRandom(0,255);
|
ofSetColor(aColour);
|
||||||
aColour.set(c, c, c, ofMap(_frame_cnt, 0, _fade_in_frames, 0, 255));
|
ofRect(j, i, rectSize, rectSize);
|
||||||
ofSetColor(aColour);
|
|
||||||
ofRect(j, i, rectSize, rectSize);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cout << "FADING IN..." << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (_frame_cnt >= _fade_in_frames && _frame_cnt < (_frame_cnt_max-_fade_in_frames)){
|
|
||||||
|
|
||||||
for (int i=1; i < ofGetHeight() ; i=i+rectSize)
|
|
||||||
{
|
|
||||||
for (int j=1; j < ofGetWidth(); j=j+rectSize)
|
|
||||||
{
|
|
||||||
c = ofRandom(0,255);
|
|
||||||
aColour.set(c, c, c, 255);
|
|
||||||
ofSetColor(aColour);
|
|
||||||
ofRect(j, i, rectSize, rectSize);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cout << "FADING IN..." << endl;
|
||||||
|
}
|
||||||
|
|
||||||
if (_frame_cnt >= (_frame_cnt_max-_fade_in_frames) && _frame_cnt < _frame_cnt_max) {
|
|
||||||
|
|
||||||
for (int i=1; i < ofGetHeight() ; i=i+rectSize)
|
|
||||||
|
if (_frame_cnt >= _fade_in_frames && _frame_cnt < (_frame_cnt_max-_fade_in_frames)){
|
||||||
|
|
||||||
|
for (int i=1; i < ofGetHeight() ; i=i+rectSize)
|
||||||
|
{
|
||||||
|
for (int j=1; j < ofGetWidth(); j=j+rectSize)
|
||||||
{
|
{
|
||||||
for (int j=1; j < ofGetWidth(); j=j+rectSize)
|
c = ofRandom(0,255);
|
||||||
{
|
aColour.set(c, c, c, 255);
|
||||||
c = ofRandom(0,255);
|
ofSetColor(aColour);
|
||||||
aColour.set(c, c, c, 255-ofMap(_frame_cnt, 0, _fade_in_frames, 0, 255));
|
ofRect(j, i, rectSize, rectSize);
|
||||||
ofSetColor(aColour);
|
|
||||||
ofRect(j, i, rectSize, rectSize);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_fade_cnt++;
|
|
||||||
cout << "FADING OUT..." << endl;
|
|
||||||
|
|
||||||
|
if (_frame_cnt >= (_frame_cnt_max-_fade_in_frames) && _frame_cnt < _frame_cnt_max) {
|
||||||
|
|
||||||
|
for (int i=1; i < ofGetHeight() ; i=i+rectSize)
|
||||||
|
{
|
||||||
|
for (int j=1; j < ofGetWidth(); j=j+rectSize)
|
||||||
|
{
|
||||||
|
c = ofRandom(0,255);
|
||||||
|
aColour.set(c, c, c, 255-ofMap(_frame_cnt, 0, _fade_in_frames, 0, 255));
|
||||||
|
ofSetColor(aColour);
|
||||||
|
ofRect(j, i, rectSize, rectSize);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_fade_cnt++;
|
||||||
ofDisableAlphaBlending();
|
cout << "FADING OUT..." << endl;
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
_RUN_DONE = true;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ofDisableAlphaBlending();
|
||||||
|
|
||||||
_frame_cnt++;
|
_frame_cnt++;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -252,19 +242,27 @@ void DiffNoiseAnalysis::save_cb(Timer& timer)
|
|||||||
|
|
||||||
if (rand10 > 5.0) {
|
if (rand10 > 5.0) {
|
||||||
|
|
||||||
cout << "DiffNoiseAnalysis::saving...\n";
|
cout << "DiffNoiseAnalysis::saving...\n";
|
||||||
cout << "c_last... " << c << endl;
|
cout << "c_last... " << c << endl;
|
||||||
cout<<"rand10... " <<rand10<<endl;
|
cout<<"rand10... " <<rand10<<endl;
|
||||||
|
|
||||||
string file_name = ofToString(_save_cnt,2)+"_"+ ofToString(c,2)+"_"+ofToString(_run_cnt,2)+".jpg";
|
string file_name = ofToString(_save_cnt,2)+"_"+ ofToString(c,2)+"_"+ofToString(_run_cnt,2)+".jpg";
|
||||||
saveimage(file_name);
|
string thisLocation = RefractiveIndex::_location;
|
||||||
|
|
||||||
|
//RefractiveIndex::_pixels = RefractiveIndex::_vidGrabber.getPixelsRef(); //get ofPixels from the camera
|
||||||
|
// fileName = imageSaveFolderPath+whichAnalysis+"_"+ofToString(100.0*i*scanLineSpeed/ofGetHeight(),2)+"%_"+ofToString(i)+".jpg";
|
||||||
|
//ofSaveImage(vectorOfPixels[i], fileName, OF_IMAGE_QUALITY_BEST);
|
||||||
|
|
||||||
|
string file = _whole_file_path+"/"+file_name;
|
||||||
|
|
||||||
|
ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST);
|
||||||
|
|
||||||
|
_saved_filenames.push_back(ofToDataPath("")+file);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_save_cnt++;
|
_save_cnt++;
|
||||||
|
if(_save_cnt >= NUM_SAVE_PER_RUN)
|
||||||
//if(_save_cnt >= NUM_SAVE_PER_RUN)
|
_RUN_DONE = true;
|
||||||
// _RUN_DONE = true;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
void DiffNoiseAnalysis::display_results_cb(Timer& timer){
|
void DiffNoiseAnalysis::display_results_cb(Timer& timer){
|
||||||
|
|||||||
@ -140,8 +140,6 @@ void IResponseAnalysis::draw()
|
|||||||
ofSetColor(c, c, c);
|
ofSetColor(c, c, c);
|
||||||
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
||||||
c = 255.0 * (_frame_cnt_max*_frame_cnt_max - _frame_cnt*_frame_cnt)/(_frame_cnt_max*_frame_cnt_max);
|
c = 255.0 * (_frame_cnt_max*_frame_cnt_max - _frame_cnt*_frame_cnt)/(_frame_cnt_max*_frame_cnt_max);
|
||||||
} else {
|
|
||||||
_RUN_DONE = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_frame_cnt++;
|
_frame_cnt++;
|
||||||
@ -192,15 +190,22 @@ void IResponseAnalysis::draw()
|
|||||||
// this runs at save_cb timer rate = DELTA_T_SAVE
|
// this runs at save_cb timer rate = DELTA_T_SAVE
|
||||||
void IResponseAnalysis::save_cb(Timer& timer)
|
void IResponseAnalysis::save_cb(Timer& timer)
|
||||||
{
|
{
|
||||||
//cout << "IResponseAnalysis::saving...\n";
|
|
||||||
//cout << "c_last... " << c << endl;
|
|
||||||
string file_name = ofToString(_save_cnt,2)+"_"+ ofToString(c,2)+"_"+ofToString(_run_cnt,2)+".jpg";
|
|
||||||
saveimage(file_name);
|
|
||||||
|
|
||||||
_save_cnt++;
|
_save_cnt++;
|
||||||
|
|
||||||
//if(_save_cnt >= NUM_SAVE_PER_RUN)
|
cout << "IResponseAnalysis::saving...\n";
|
||||||
// _RUN_DONE = true;
|
//cout << "c_last... " << c << endl;
|
||||||
|
string file_name = ofToString(_save_cnt,2)+"_"+ ofToString(c,2)+"_"+ofToString(_run_cnt,2)+".jpg";
|
||||||
|
string thisLocation = RefractiveIndex::_location;
|
||||||
|
|
||||||
|
//RefractiveIndex::_pixels = RefractiveIndex::_vidGrabber.getPixelsRef(); //get ofPixels from the camera
|
||||||
|
// fileName = imageSaveFolderPath+whichAnalysis+"_"+ofToString(100.0*i*scanLineSpeed/ofGetHeight(),2)+"%_"+ofToString(i)+".jpg";
|
||||||
|
//ofSaveImage(vectorOfPixels[i], fileName, OF_IMAGE_QUALITY_BEST);
|
||||||
|
_saved_filenames.push_back(ofToDataPath("")+_whole_file_path+"/"+file_name);
|
||||||
|
|
||||||
|
ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST);
|
||||||
|
|
||||||
|
if(_save_cnt >= NUM_SAVE_PER_RUN)
|
||||||
|
_RUN_DONE = true;
|
||||||
}
|
}
|
||||||
void IResponseAnalysis::display_results_cb(Timer& timer){
|
void IResponseAnalysis::display_results_cb(Timer& timer){
|
||||||
_results_cnt++;
|
_results_cnt++;
|
||||||
|
|||||||
@ -20,7 +20,7 @@ void RelaxRateAnalysis::setup(int camWidth, int camHeight)
|
|||||||
{
|
{
|
||||||
DELTA_T_SAVE = 130;
|
DELTA_T_SAVE = 130;
|
||||||
NUM_PHASE = 1;
|
NUM_PHASE = 1;
|
||||||
NUM_RUN = 3;
|
NUM_RUN = 1;
|
||||||
NUM_SAVE_PER_RUN = 100;
|
NUM_SAVE_PER_RUN = 100;
|
||||||
|
|
||||||
create_dir();
|
create_dir();
|
||||||
@ -61,7 +61,6 @@ void RelaxRateAnalysis::acquire()
|
|||||||
|
|
||||||
void RelaxRateAnalysis::synthesise()
|
void RelaxRateAnalysis::synthesise()
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
//incrementer to whichMesh
|
//incrementer to whichMesh
|
||||||
speed=0.2;
|
speed=0.2;
|
||||||
//whichMesh is the index in the vector of meshes
|
//whichMesh is the index in the vector of meshes
|
||||||
@ -101,13 +100,10 @@ void RelaxRateAnalysis::synthesise()
|
|||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
void RelaxRateAnalysis::display_results(){
|
void RelaxRateAnalysis::display_results(){
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
Timer* display_results_timer;
|
Timer* display_results_timer;
|
||||||
|
|
||||||
TimerCallback<RelaxRateAnalysis> display_results_callback(*this, &RelaxRateAnalysis::display_results_cb);
|
TimerCallback<RelaxRateAnalysis> display_results_callback(*this, &RelaxRateAnalysis::display_results_cb);
|
||||||
@ -123,7 +119,6 @@ void RelaxRateAnalysis::display_results(){
|
|||||||
Thread::sleep(3);
|
Thread::sleep(3);
|
||||||
|
|
||||||
display_results_timer->stop();
|
display_results_timer->stop();
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +134,7 @@ void RelaxRateAnalysis::draw()
|
|||||||
// still need to deal with latency frames here - i.e.: there are frames
|
// still need to deal with latency frames here - i.e.: there are frames
|
||||||
/// *** TODO *** ///
|
/// *** TODO *** ///
|
||||||
|
|
||||||
if (_frame_cnt < _frame_cnt_max)
|
if (_frame_cnt <= _frame_cnt_max)
|
||||||
{
|
{
|
||||||
|
|
||||||
float lightLevel=pow(_level,2);
|
float lightLevel=pow(_level,2);
|
||||||
@ -157,8 +152,7 @@ void RelaxRateAnalysis::draw()
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
cout << "RELAXRATE RUN COMPLETED" << endl;
|
cout << "RELAXRATE RUN COMPLETED" << endl;
|
||||||
//_state = STATE_SYNTHESISING;
|
_state = STATE_SYNTHESISING;
|
||||||
_RUN_DONE = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_frame_cnt++;
|
_frame_cnt++;
|
||||||
@ -175,7 +169,6 @@ void RelaxRateAnalysis::draw()
|
|||||||
|
|
||||||
case STATE_DISPLAY_RESULTS:
|
case STATE_DISPLAY_RESULTS:
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
// display results of the synthesis
|
// display results of the synthesis
|
||||||
// display results of the synthesis
|
// display results of the synthesis
|
||||||
int imageWidth=640;
|
int imageWidth=640;
|
||||||
@ -197,7 +190,6 @@ void RelaxRateAnalysis::draw()
|
|||||||
whichMesh+=speed;
|
whichMesh+=speed;
|
||||||
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -214,17 +206,20 @@ void RelaxRateAnalysis::draw()
|
|||||||
// this runs at save_cb timer rate = DELTA_T_SAVE
|
// this runs at save_cb timer rate = DELTA_T_SAVE
|
||||||
void RelaxRateAnalysis::save_cb(Timer& timer)
|
void RelaxRateAnalysis::save_cb(Timer& timer)
|
||||||
{
|
{
|
||||||
//cout << "RelaxRateAnalysis::saving...\n";
|
_save_cnt++;
|
||||||
|
cout << "RelaxRateAnalysis::saving...\n";
|
||||||
//cout << "c_last... " << c << endl;
|
//cout << "c_last... " << c << endl;
|
||||||
string file_name = ofToString(_save_cnt,2)+"_"+ ofToString(c,2)+"_"+ofToString(_run_cnt,2)+".jpg";
|
string file_name = ofToString(_save_cnt,2)+"_"+ ofToString(c,2)+"_"+ofToString(_run_cnt,2)+".jpg";
|
||||||
|
string thisLocation = RefractiveIndex::_location;
|
||||||
|
|
||||||
saveimage(file_name);
|
string file = _whole_file_path+"/"+file_name;
|
||||||
|
|
||||||
_save_cnt++;
|
ofSaveImage(RefractiveIndex::_pixels, file, OF_IMAGE_QUALITY_BEST);
|
||||||
|
|
||||||
|
_saved_filenames.push_back(ofToDataPath("")+file);
|
||||||
|
|
||||||
//if(_save_cnt >= NUM_SAVE_PER_RUN)
|
if(_save_cnt >= NUM_SAVE_PER_RUN)
|
||||||
// _RUN_DONE = true;
|
_RUN_DONE = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
void RelaxRateAnalysis::display_results_cb(Timer& timer){
|
void RelaxRateAnalysis::display_results_cb(Timer& timer){
|
||||||
|
|||||||
@ -119,14 +119,6 @@ void ShadowScapesAnalysis::synthesise()
|
|||||||
//there is a known issue with using loadImage inside classes in other directories. the fix is to call setUseTExture(false)
|
//there is a known issue with using loadImage inside classes in other directories. the fix is to call setUseTExture(false)
|
||||||
image1.setUseTexture(false);
|
image1.setUseTexture(false);
|
||||||
image2.setUseTexture(false);
|
image2.setUseTexture(false);
|
||||||
|
|
||||||
string fnamei = _saved_filenames[i];
|
|
||||||
string fnameii = _saved_filenames[i + 1];
|
|
||||||
|
|
||||||
bool l1 = image1.loadImage(_saved_filenames[i]);
|
|
||||||
bool l2 = image2.loadImage(_saved_filenames[i+1]);
|
|
||||||
|
|
||||||
|
|
||||||
//some of the textures are not loading correctly so only make mesh if both the images load
|
//some of the textures are not loading correctly so only make mesh if both the images load
|
||||||
if(image1.loadImage(_saved_filenames[i]) && image2.loadImage(_saved_filenames[i+1])){
|
if(image1.loadImage(_saved_filenames[i]) && image2.loadImage(_saved_filenames[i+1])){
|
||||||
meshes.push_back(ofMesh());
|
meshes.push_back(ofMesh());
|
||||||
@ -134,9 +126,6 @@ void ShadowScapesAnalysis::synthesise()
|
|||||||
setMeshFromPixels( calculateListOfZValues(image1,image2, COMPARE_BRIGHTNESS), image2, &meshes[index]);
|
setMeshFromPixels( calculateListOfZValues(image1,image2, COMPARE_BRIGHTNESS), image2, &meshes[index]);
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
image1.clear();
|
|
||||||
image2.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -234,21 +223,21 @@ void ShadowScapesAnalysis::draw()
|
|||||||
|
|
||||||
if(_dir == V && int(_line) >= (ofGetHeight()+4*_scanLineWidth)){
|
if(_dir == V && int(_line) >= (ofGetHeight()+4*_scanLineWidth)){
|
||||||
cout << "VERTICAL IS DONE - _line >= (ofGetHeight()+4*_scanLineWidth) is TRUE" << endl;
|
cout << "VERTICAL IS DONE - _line >= (ofGetHeight()+4*_scanLineWidth) is TRUE" << endl;
|
||||||
//_state = STATE_SYNTHESISING;
|
_state = STATE_SYNTHESISING;
|
||||||
_RUN_DONE = true;
|
_RUN_DONE = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_dir == H && int(_line) >= (ofGetWidth()+4*_scanLineWidth)) {
|
if(_dir == H && int(_line) >= (ofGetWidth()+4*_scanLineWidth)) {
|
||||||
|
|
||||||
//cout << "HORIZONTAL IS DONE - _line >= (ofGetWidth()+4*_scanLineWidth)) is TRUE" << endl;
|
//cout << "HORIZONTAL IS DONE - _line >= (ofGetWidth()+4*_scanLineWidth)) is TRUE" << endl;
|
||||||
//_state = STATE_SYNTHESISING;
|
_state = STATE_SYNTHESISING;
|
||||||
_RUN_DONE = true;
|
_RUN_DONE = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_dir == D && int(_line) >= (1.5*ofGetHeight()+4*_scanLineWidth)) {
|
if(_dir == D && int(_line) >= (1.5*ofGetHeight()+4*_scanLineWidth)) {
|
||||||
//cout << "DIAGONAL IS DONE - _line >= (1.5*ofGetHeight()+4*_scanLineWidth)) is TRUE" << endl;
|
//cout << "DIAGONAL IS DONE - _line >= (1.5*ofGetHeight()+4*_scanLineWidth)) is TRUE" << endl;
|
||||||
//_state = STATE_SYNTHESISING;
|
_state = STATE_SYNTHESISING;
|
||||||
_RUN_DONE = true;
|
_RUN_DONE = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -299,14 +288,6 @@ void ShadowScapesAnalysis::draw()
|
|||||||
void ShadowScapesAnalysis::save_cb(Timer& timer)
|
void ShadowScapesAnalysis::save_cb(Timer& timer)
|
||||||
{
|
{
|
||||||
|
|
||||||
RefractiveIndex::_vidGrabber.grabFrame(); // get a new frame from the camera
|
|
||||||
|
|
||||||
if (RefractiveIndex::_vidGrabber.isFrameNew())
|
|
||||||
{
|
|
||||||
RefractiveIndex::_pixels = RefractiveIndex::_vidGrabber.getPixelsRef(); //get ofPixels from the camera
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
cout << "ShadowScapesAnalysis::saving...\n";
|
cout << "ShadowScapesAnalysis::saving...\n";
|
||||||
string file_name;
|
string file_name;
|
||||||
|
|
||||||
@ -321,9 +302,9 @@ void ShadowScapesAnalysis::save_cb(Timer& timer)
|
|||||||
if(_dir == D) {
|
if(_dir == D) {
|
||||||
file_name = ofToString(_save_cnt, 2)+"_D_"+ofToString(_line, 2)+"_"+ofToString(_run_cnt,2)+".jpg";
|
file_name = ofToString(_save_cnt, 2)+"_D_"+ofToString(_line, 2)+"_"+ofToString(_run_cnt,2)+".jpg";
|
||||||
}
|
}
|
||||||
|
_saved_filenames.push_back(ofToDataPath("")+_whole_file_path+"/"+file_name);
|
||||||
|
|
||||||
saveimage(file_name);
|
ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST);
|
||||||
|
|
||||||
_save_cnt++;
|
_save_cnt++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -149,7 +149,7 @@ void ShapeFromShadingAnalysis::draw()
|
|||||||
switch (_state) {
|
switch (_state) {
|
||||||
case STATE_ACQUIRING:
|
case STATE_ACQUIRING:
|
||||||
{
|
{
|
||||||
if (_frame_cnt < _frame_cnt_max)
|
if (_frame_cnt <= _frame_cnt_max)
|
||||||
{
|
{
|
||||||
|
|
||||||
ofEnableAlphaBlending();
|
ofEnableAlphaBlending();
|
||||||
@ -420,13 +420,13 @@ void ShapeFromShadingAnalysis::save_cb(Timer& timer)
|
|||||||
//cout << "ShapeFromShadingAnalysis::saving...\n";
|
//cout << "ShapeFromShadingAnalysis::saving...\n";
|
||||||
|
|
||||||
string file_name = ofToString(_save_cnt,2)+"_"+ quad +"_"+ofToString(_run_cnt,2)+".jpg";
|
string file_name = ofToString(_save_cnt,2)+"_"+ quad +"_"+ofToString(_run_cnt,2)+".jpg";
|
||||||
|
_saved_filenames.push_back(ofToDataPath("")+_whole_file_path+"/"+file_name);
|
||||||
|
|
||||||
saveimage(file_name);
|
ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST);
|
||||||
|
|
||||||
_save_cnt++;
|
_save_cnt++;
|
||||||
|
|
||||||
//if(_save_cnt >= NUM_SAVE_PER_RUN)
|
if(_save_cnt >= NUM_SAVE_PER_RUN)
|
||||||
// _RUN_DONE = true;
|
_RUN_DONE = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
void ShapeFromShadingAnalysis::display_results_cb(Timer& timer){
|
void ShapeFromShadingAnalysis::display_results_cb(Timer& timer){
|
||||||
|
|||||||
@ -133,58 +133,51 @@ void StrobeAnalysis::draw()
|
|||||||
switch (_state) {
|
switch (_state) {
|
||||||
case STATE_ACQUIRING:
|
case STATE_ACQUIRING:
|
||||||
{
|
{
|
||||||
|
ofEnableAlphaBlending();
|
||||||
|
ofColor aColour;
|
||||||
|
int _fade_in_frames = _frame_cnt_max/10;
|
||||||
|
cout<< "_fade_in_frames" << _fade_in_frames<< endl;
|
||||||
|
|
||||||
if (_frame_cnt < _frame_cnt_max)
|
if (_frame_cnt < _fade_in_frames) {
|
||||||
{
|
|
||||||
ofEnableAlphaBlending();
|
|
||||||
ofColor aColour;
|
|
||||||
int _fade_in_frames = _frame_cnt_max/10;
|
|
||||||
cout<< "_fade_in_frames" << _fade_in_frames<< endl;
|
|
||||||
|
|
||||||
if (_frame_cnt < _fade_in_frames) {
|
aColour.set(255, 255, 255, ofMap(_frame_cnt, 0, _fade_in_frames, 0, 255));
|
||||||
|
ofSetColor(aColour);
|
||||||
|
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
||||||
|
//cout << "FADE IN STROBE TIME " << endl;
|
||||||
|
|
||||||
aColour.set(255, 255, 255, ofMap(_frame_cnt, 0, _fade_in_frames, 0, 255));
|
|
||||||
ofSetColor(aColour);
|
}
|
||||||
|
|
||||||
|
if (_frame_cnt >= _fade_in_frames && _frame_cnt < (_frame_cnt_max-_fade_in_frames)){
|
||||||
|
|
||||||
|
//cout << "_frame_cnt: " << _frame_cnt << endl;
|
||||||
|
//cout << "frame_cnt % 15: " << _frame_cnt%15 << endl;
|
||||||
|
//cout << "MAIN STROBE TIME " << endl;
|
||||||
|
|
||||||
|
if (_frame_cnt%int(ofGetFrameRate()*_strobe_interval/1000) < (ofGetFrameRate()*_strobe_interval/1000)/2)
|
||||||
|
{
|
||||||
|
ofSetColor(255, 255, 255);
|
||||||
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
||||||
//cout << "FADE IN STROBE TIME " << endl;
|
_strobe_cnt++;
|
||||||
|
_strobe_on = 1;
|
||||||
|
} else if (_frame_cnt%int(ofGetFrameRate()*_strobe_interval/1000) >= (ofGetFrameRate()*_strobe_interval/1000)/2)
|
||||||
}
|
{
|
||||||
|
ofSetColor(0, 0, 0);
|
||||||
if (_frame_cnt >= _fade_in_frames && _frame_cnt < (_frame_cnt_max-_fade_in_frames)){
|
|
||||||
|
|
||||||
//cout << "_frame_cnt: " << _frame_cnt << endl;
|
|
||||||
//cout << "frame_cnt % 15: " << _frame_cnt%15 << endl;
|
|
||||||
//cout << "MAIN STROBE TIME " << endl;
|
|
||||||
|
|
||||||
if (_frame_cnt%int(ofGetFrameRate()*_strobe_interval/1000) < (ofGetFrameRate()*_strobe_interval/1000)/2)
|
|
||||||
{
|
|
||||||
ofSetColor(255, 255, 255);
|
|
||||||
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
|
||||||
_strobe_cnt++;
|
|
||||||
_strobe_on = 1;
|
|
||||||
} else if (_frame_cnt%int(ofGetFrameRate()*_strobe_interval/1000) >= (ofGetFrameRate()*_strobe_interval/1000)/2)
|
|
||||||
{
|
|
||||||
ofSetColor(0, 0, 0);
|
|
||||||
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
|
||||||
_strobe_on = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_frame_cnt >= (_frame_cnt_max-_fade_in_frames) && _frame_cnt < _frame_cnt_max) {
|
|
||||||
aColour.set(255, 255, 255, 255-ofMap(_frame_cnt, 0, _fade_in_frames, 0, 255));
|
|
||||||
ofSetColor(aColour);
|
|
||||||
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
||||||
// cout << "FADE OUT STROBE TIME " << endl;
|
_strobe_on = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ofDisableAlphaBlending();
|
}
|
||||||
} else {
|
|
||||||
_RUN_DONE = true;
|
if (_frame_cnt >= (_frame_cnt_max-_fade_in_frames) && _frame_cnt < _frame_cnt_max) {
|
||||||
|
aColour.set(255, 255, 255, 255-ofMap(_frame_cnt, 0, _fade_in_frames, 0, 255));
|
||||||
|
ofSetColor(aColour);
|
||||||
|
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
||||||
|
// cout << "FADE OUT STROBE TIME " << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
_frame_cnt++;
|
_frame_cnt++;
|
||||||
|
ofDisableAlphaBlending();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -232,8 +225,9 @@ void StrobeAnalysis::draw()
|
|||||||
void StrobeAnalysis::save_cb(Timer& timer)
|
void StrobeAnalysis::save_cb(Timer& timer)
|
||||||
{
|
{
|
||||||
string file_name = ofToString(_save_cnt,2)+"_"+ ofToString(_strobe_on) +"_"+ofToString(_run_cnt,2)+".jpg";
|
string file_name = ofToString(_save_cnt,2)+"_"+ ofToString(_strobe_on) +"_"+ofToString(_run_cnt,2)+".jpg";
|
||||||
saveimage(file_name);
|
_saved_filenames.push_back(ofToDataPath("")+_whole_file_path+"/"+file_name);
|
||||||
|
|
||||||
|
ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST);
|
||||||
_save_cnt++;
|
_save_cnt++;
|
||||||
|
|
||||||
cout << "_save_cnt" << _save_cnt << endl;
|
cout << "_save_cnt" << _save_cnt << endl;
|
||||||
@ -241,9 +235,9 @@ void StrobeAnalysis::save_cb(Timer& timer)
|
|||||||
cout << "_save_cnt_max" << _save_cnt_max << endl;
|
cout << "_save_cnt_max" << _save_cnt_max << endl;
|
||||||
|
|
||||||
//TODO: something fucked here with my calc of _save_cnt_max - new structure should fix it?
|
//TODO: something fucked here with my calc of _save_cnt_max - new structure should fix it?
|
||||||
//if(_save_cnt >= _save_cnt_max-10) {
|
if(_save_cnt >= _save_cnt_max-10) {
|
||||||
// _RUN_DONE = true;
|
_RUN_DONE = true;
|
||||||
//}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user