fixed timings so everything is on the second-basis, fixed David's flags so that each section in the classes terminates on RUN_DONE
This commit is contained in:
parent
12d210327b
commit
b514c12a53
@ -8,6 +8,9 @@
|
||||
~ contact: dviid@labs.ciid.dk
|
||||
*/
|
||||
|
||||
////also the new shit////
|
||||
|
||||
|
||||
#include "RefractiveIndex.h"
|
||||
|
||||
#include "ShadowScapesAnalysis.h"
|
||||
@ -94,13 +97,14 @@ void RefractiveIndex::setup()
|
||||
|
||||
//getting a warning from the OFlog that the pixels aren't allocated
|
||||
//void ofPixels::allocate(int w, int h, ofImageType type)
|
||||
_pixels.allocate(_vid_w, _vid_h, OF_IMAGE_COLOR);
|
||||
|
||||
|
||||
//TODO: whichever one of these is first - it always runs twice ?
|
||||
|
||||
// _analysisVector.push_back(new ShadowScapesAnalysis(V));
|
||||
// _analysisVector.push_back(new ShadowScapesAnalysis(H));
|
||||
// _analysisVector.push_back(new ShadowScapesAnalysis(D));
|
||||
_analysisVector.push_back(new ShadowScapesAnalysis(V));
|
||||
_analysisVector.push_back(new ShadowScapesAnalysis(H));
|
||||
_analysisVector.push_back(new ShadowScapesAnalysis(D));
|
||||
|
||||
_analysisVector.push_back(new RelaxRateAnalysis());
|
||||
|
||||
@ -205,10 +209,11 @@ void RefractiveIndex::setup_camera()
|
||||
{
|
||||
stop_camera();
|
||||
|
||||
if(!_vidGrabber.initGrabber(_vid_w, _vid_h)) {
|
||||
if(!_vidGrabber.initGrabber(_vid_w, _vid_h)) {
|
||||
ofLog(OF_LOG_ERROR) << "RefractiveIndex::setup_camera - could not initialise grabber";
|
||||
return;
|
||||
}
|
||||
|
||||
_vidGrabber.listDevices();
|
||||
_vidGrabber.setVerbose(true);
|
||||
_vid_stream_open = true;
|
||||
|
||||
@ -1,8 +1,3 @@
|
||||
/*
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~ author: dviid
|
||||
~ contact: dviid@labs.ciid.dk
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
@ -4,21 +4,15 @@
|
||||
|
||||
#define SCREEN_WIDTH 800
|
||||
#define SCREEN_HEIGHT 600
|
||||
/////////////////////////dis is the new shit///////////
|
||||
|
||||
/////////////////////////dis is the new shit///////////
|
||||
|
||||
/////////////////////////dis is the new shit///////////
|
||||
|
||||
/////////////////////////dis is the new shit///////////
|
||||
|
||||
////also the new shit////
|
||||
|
||||
int main() {
|
||||
ofAppGlutWindow window;
|
||||
|
||||
ofxXmlSettings XML;
|
||||
XML.loadFile("../data/config.refindx");
|
||||
bool fullscreen = (XML.getValue("config:display:fullscreen", "false") == "true" ? true : false);
|
||||
bool fullscreen = (XML.getValue("config:display:fullscreen", "true") == "true" ? true : false);
|
||||
int screen_w = XML.getValue("config:display:width", SCREEN_WIDTH);
|
||||
int screen_h = XML.getValue("config:display:height", SCREEN_HEIGHT);
|
||||
|
||||
|
||||
@ -41,6 +41,9 @@ void AbstractAnalysis::do_synthesize() {
|
||||
_state = STATE_SYNTHESISING;
|
||||
synthesise();
|
||||
_state = STATE_DISPLAY_RESULTS;
|
||||
|
||||
//displayresults();
|
||||
|
||||
ofNotifyEvent(_synthesize_cb, _name);
|
||||
}
|
||||
|
||||
|
||||
@ -13,19 +13,25 @@ using Poco::Thread;
|
||||
|
||||
void CamNoiseAnalysis::setup(int camWidth, int camHeight)
|
||||
{
|
||||
DELTA_T_SAVE = 200;
|
||||
NUM_PHASE = 1;
|
||||
|
||||
NUM_RUN = 1;
|
||||
NUM_SAVE_PER_RUN = 100;
|
||||
|
||||
int acq_run_time = 20; // 20 seconds of acquiring per run
|
||||
|
||||
DELTA_T_SAVE = 10*acq_run_time/2; // for 20 seconds, we want this to be around 200 files
|
||||
// or 10 times per second = every 100 ms
|
||||
|
||||
_frame_cnt_max = acq_run_time*ofGetFrameRate(); // e.g.: 30 frames per second * 20 seconds = 600 frames
|
||||
|
||||
create_dir();
|
||||
|
||||
|
||||
_frame_cnt = 0;
|
||||
_frame_cnt_max = ofGetFrameRate() * ((DELTA_T_SAVE * NUM_SAVE_PER_RUN) / 1000);
|
||||
c = 0;
|
||||
|
||||
int anim_time = 10; // 10 seconds
|
||||
int anim_time = 5; // 10 seconds
|
||||
_anim_cnt_max = anim_time*ofGetFrameRate(); // e.g.: 30 frames per second = 150 frames
|
||||
|
||||
create_dir();
|
||||
|
||||
}
|
||||
|
||||
@ -54,12 +60,17 @@ void CamNoiseAnalysis::acquire()
|
||||
Thread::sleep(3);
|
||||
|
||||
save_timer->stop();
|
||||
|
||||
_RUN_DONE = false;
|
||||
}
|
||||
}
|
||||
|
||||
void CamNoiseAnalysis::synthesise()
|
||||
{
|
||||
{
|
||||
// _saved_filenames has all the file names of all the saved images
|
||||
while(!_RUN_DONE)
|
||||
Thread::sleep(3);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -81,7 +92,7 @@ void CamNoiseAnalysis::draw()
|
||||
ofColor aColour;
|
||||
|
||||
int _fade_in_frames = _frame_cnt_max/10;
|
||||
float _number_of_grey_levels=10;
|
||||
float _number_of_grey_levels=5;
|
||||
|
||||
float _frames_per_level = _frame_cnt_max / _number_of_grey_levels;
|
||||
ofColor someColor;
|
||||
@ -119,8 +130,8 @@ void CamNoiseAnalysis::draw()
|
||||
|
||||
|
||||
} else {
|
||||
_state = STATE_SYNTHESISING;
|
||||
// _RUN_DONE = true;
|
||||
// _state = STATE_SYNTHESISING;
|
||||
_RUN_DONE = true;
|
||||
}
|
||||
|
||||
_frame_cnt++;
|
||||
@ -200,7 +211,8 @@ void CamNoiseAnalysis::draw()
|
||||
_anim_cnt++;
|
||||
|
||||
} else {
|
||||
_state = STATE_DISPLAY_RESULTS;
|
||||
_RUN_DONE = true;
|
||||
//_state = STATE_DISPLAY_RESULTS;
|
||||
_anim_cnt=0;
|
||||
}
|
||||
ofPopMatrix();
|
||||
@ -214,7 +226,6 @@ void CamNoiseAnalysis::draw()
|
||||
{
|
||||
// display results of the synthesis
|
||||
_RUN_DONE = true;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -28,6 +28,6 @@ protected:
|
||||
|
||||
bool _RUN_DONE;
|
||||
|
||||
int _run_cnt, _save_cnt, _fade_cnt, _anim_cnt;
|
||||
int _run_cnt, _save_cnt, _anim_cnt;
|
||||
float c, _frame_cnt, _frame_cnt_max, _anim_cnt_max;
|
||||
};
|
||||
|
||||
@ -13,19 +13,26 @@ using Poco::Thread;
|
||||
|
||||
void ColorMultiAnalysis::setup(int camWidth, int camHeight)
|
||||
{
|
||||
DELTA_T_SAVE = 150; // the right number is about 300
|
||||
NUM_PHASE = 1;
|
||||
|
||||
|
||||
NUM_RUN = 1;
|
||||
NUM_SAVE_PER_RUN = 300;
|
||||
|
||||
int acq_run_time = 35;
|
||||
|
||||
DELTA_T_SAVE = 10*acq_run_time/2; // for 20 seconds, we want this to be around 200 files
|
||||
// or 10 times per second = every 100 ms
|
||||
|
||||
_frame_cnt_max = acq_run_time*ofGetFrameRate(); // e.g.: 30 frames per second * 20 seconds = 600 frames
|
||||
|
||||
create_dir();
|
||||
|
||||
_frame_cnt = 0;
|
||||
_fade_cnt=0;
|
||||
_frame_cnt_max = ofGetFrameRate() * ((DELTA_T_SAVE * NUM_SAVE_PER_RUN) / 1000);
|
||||
c = 0;
|
||||
|
||||
int anim_time = 10; // 10 seconds
|
||||
int anim_time = 5; // 10 seconds
|
||||
_anim_cnt_max = anim_time*ofGetFrameRate(); // e.g.: 30 frames per second = 150 frames
|
||||
|
||||
create_dir();
|
||||
|
||||
}
|
||||
|
||||
@ -53,8 +60,9 @@ void ColorMultiAnalysis::acquire()
|
||||
Thread::sleep(3);
|
||||
|
||||
save_timer->stop();
|
||||
_RUN_DONE = false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ColorMultiAnalysis::synthesise()
|
||||
@ -69,15 +77,16 @@ void ColorMultiAnalysis::draw()
|
||||
switch (_state) {
|
||||
case STATE_ACQUIRING:
|
||||
{
|
||||
ofEnableAlphaBlending();
|
||||
|
||||
if (_frame_cnt < _frame_cnt_max)
|
||||
{
|
||||
|
||||
|
||||
int _fade_in_frames = _frame_cnt_max/50;
|
||||
ofColor aColor;
|
||||
|
||||
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));
|
||||
|
||||
@ -87,9 +96,10 @@ void ColorMultiAnalysis::draw()
|
||||
cout << "FADING IN..." << endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (_frame_cnt >= _fade_in_frames && _frame_cnt < _frame_cnt_max-_fade_in_frames){
|
||||
|
||||
ofColor aColor;
|
||||
aColor.setHsb(c, 255, 255);
|
||||
ofSetColor(aColor);
|
||||
|
||||
@ -99,29 +109,26 @@ void ColorMultiAnalysis::draw()
|
||||
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
||||
}
|
||||
|
||||
if (_frame_cnt >= (_frame_cnt_max-_fade_in_frames) && _frame_cnt < _frame_cnt_max) {
|
||||
if (_frame_cnt >= (_frame_cnt_max-_fade_in_frames) && _frame_cnt <= _frame_cnt_max) {
|
||||
|
||||
ofColor aColor;
|
||||
aColor.set(c, c, c, 255-int(ofMap(_frame_cnt-(_frame_cnt_max-_fade_in_frames), 0, _fade_in_frames, 0, 255)));
|
||||
|
||||
aColor.setHsb(c, 255-ofMap(_fade_cnt, 0, _fade_in_frames, 0, 255), 255-ofMap(_fade_cnt, 0, _fade_in_frames, 0, 255));
|
||||
//aColor.setHsb(c, 255-ofMap(_fade_cnt- (_frame_cnt_max-_fade_in_frames), 0, _fade_in_frames, 0, 255), 255-(ofMap(_fade_cnt-(_frame_cnt_max-_fade_in_frames), 0, _fade_in_frames, 0, 255)));
|
||||
|
||||
ofSetColor(aColor);
|
||||
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
||||
|
||||
_fade_cnt++;
|
||||
cout << "FADING OUT..." << endl;
|
||||
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
_state = STATE_SYNTHESISING;
|
||||
|
||||
//_RUN_DONE = true;
|
||||
|
||||
//_state = STATE_SYNTHESISING;
|
||||
_RUN_DONE = true;
|
||||
}
|
||||
|
||||
_frame_cnt++;
|
||||
|
||||
ofDisableAlphaBlending();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -13,24 +13,34 @@ using Poco::Thread;
|
||||
|
||||
void ColorSingleAnalysis::setup(int camWidth, int camHeight)
|
||||
{
|
||||
DELTA_T_SAVE = 100; //300 is the right number here
|
||||
NUM_PHASE = 1;
|
||||
|
||||
NUM_RUN = 1;
|
||||
NUM_SAVE_PER_RUN = 100;
|
||||
|
||||
int acq_run_time = 20; // 20 seconds of acquiring per run
|
||||
|
||||
DELTA_T_SAVE = 10*acq_run_time/2; // for 20 seconds, we want this to be around 200 files
|
||||
// or 10 times per second = every 100 ms
|
||||
|
||||
_frame_cnt_max = acq_run_time*ofGetFrameRate(); // e.g.: 30 frames per second * 20 seconds = 600 frames
|
||||
|
||||
create_dir();
|
||||
|
||||
_frame_cnt = 0;
|
||||
_frame_cnt_max = ofGetFrameRate() * ((DELTA_T_SAVE * NUM_SAVE_PER_RUN) / 1000);
|
||||
c = 0;
|
||||
|
||||
int anim_time = 5; // 10 seconds
|
||||
_anim_cnt_max = anim_time*ofGetFrameRate(); // e.g.: 30 frames per second = 150 frames
|
||||
|
||||
create_dir();
|
||||
|
||||
|
||||
NUM_RUN = 1;
|
||||
|
||||
r = 0;
|
||||
g = 0;
|
||||
b = 0;
|
||||
|
||||
_fade_cnt=0;
|
||||
fileNameTag = "";
|
||||
|
||||
|
||||
int anim_time = 10; // 10 seconds
|
||||
_anim_cnt_max = anim_time*ofGetFrameRate(); // e.g.: 30 frames per second = 150 frames
|
||||
|
||||
}
|
||||
|
||||
@ -59,12 +69,15 @@ void ColorSingleAnalysis::acquire()
|
||||
Thread::sleep(3);
|
||||
|
||||
save_timer->stop();
|
||||
_RUN_DONE = false;
|
||||
}
|
||||
}
|
||||
|
||||
void ColorSingleAnalysis::synthesise()
|
||||
{
|
||||
// _saved_filenames has all the file names of all the saved images
|
||||
while(!_RUN_DONE)
|
||||
Thread::sleep(3);
|
||||
}
|
||||
|
||||
|
||||
@ -126,8 +139,8 @@ void ColorSingleAnalysis::draw()
|
||||
}
|
||||
|
||||
} else {
|
||||
_state = STATE_SYNTHESISING;
|
||||
//_RUN_DONE = true;
|
||||
//_state = STATE_SYNTHESISING;
|
||||
_RUN_DONE = true;
|
||||
}
|
||||
|
||||
_frame_cnt++;
|
||||
@ -207,7 +220,8 @@ void ColorSingleAnalysis::draw()
|
||||
_anim_cnt++;
|
||||
|
||||
} else {
|
||||
_state = STATE_DISPLAY_RESULTS;
|
||||
_RUN_DONE = true;
|
||||
//_state = STATE_DISPLAY_RESULTS;
|
||||
_anim_cnt=0;
|
||||
}
|
||||
ofPopMatrix();
|
||||
|
||||
@ -13,19 +13,25 @@ using Poco::Thread;
|
||||
|
||||
void DiffNoiseAnalysis::setup(int camWidth, int camHeight)
|
||||
{
|
||||
DELTA_T_SAVE = 100; // right number is about 600
|
||||
NUM_PHASE = 1;
|
||||
|
||||
NUM_RUN = 1;
|
||||
NUM_SAVE_PER_RUN = 50;
|
||||
|
||||
int acq_run_time = 20; // 20 seconds of acquiring per run
|
||||
|
||||
DELTA_T_SAVE = 10*acq_run_time/2; // for 20 seconds, we want this to be around 200 files
|
||||
// or 10 times per second = every 100 ms
|
||||
|
||||
_frame_cnt_max = acq_run_time*ofGetFrameRate(); // e.g.: 30 frames per second * 20 seconds = 600 frames
|
||||
|
||||
create_dir();
|
||||
//_fade_cnt=0;
|
||||
|
||||
_frame_cnt = 0;
|
||||
_frame_cnt_max = ofGetFrameRate() * ((DELTA_T_SAVE * NUM_SAVE_PER_RUN) / 1000);
|
||||
c = 0;
|
||||
|
||||
int anim_time = 10; // 10 seconds
|
||||
int anim_time = 5; // 10 seconds
|
||||
_anim_cnt_max = anim_time*ofGetFrameRate(); // e.g.: 30 frames per second = 150 frames
|
||||
|
||||
create_dir();
|
||||
|
||||
}
|
||||
|
||||
@ -58,8 +64,11 @@ void DiffNoiseAnalysis::acquire()
|
||||
}
|
||||
|
||||
void DiffNoiseAnalysis::synthesise()
|
||||
{
|
||||
{
|
||||
// _saved_filenames has all the file names of all the saved images
|
||||
while(!_RUN_DONE)
|
||||
Thread::sleep(3);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -133,7 +142,7 @@ void DiffNoiseAnalysis::draw()
|
||||
ofDisableAlphaBlending();
|
||||
|
||||
} else {
|
||||
_state = STATE_SYNTHESISING;
|
||||
// _state = STATE_SYNTHESISING;
|
||||
_RUN_DONE = true;
|
||||
|
||||
}
|
||||
@ -215,7 +224,9 @@ void DiffNoiseAnalysis::draw()
|
||||
_anim_cnt++;
|
||||
|
||||
} else {
|
||||
_state = STATE_DISPLAY_RESULTS;
|
||||
|
||||
_RUN_DONE = true;
|
||||
//_state = STATE_DISPLAY_RESULTS;
|
||||
_anim_cnt=0;
|
||||
}
|
||||
ofPopMatrix();
|
||||
@ -232,7 +243,6 @@ void DiffNoiseAnalysis::draw()
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -242,15 +252,14 @@ void DiffNoiseAnalysis::draw()
|
||||
// this runs at save_cb timer rate = DELTA_T_SAVE
|
||||
void DiffNoiseAnalysis::save_cb(Timer& timer)
|
||||
{
|
||||
|
||||
_save_cnt++;
|
||||
|
||||
cout << "DiffNoiseAnalysis::saving...\n";
|
||||
|
||||
string file_name = ofToString(_save_cnt,2)+"_"+ ofToString(c,2)+"_"+ofToString(_run_cnt,2)+".jpg";
|
||||
|
||||
|
||||
ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST);
|
||||
|
||||
|
||||
_saved_filenames.push_back(_whole_file_path+"/"+file_name);
|
||||
|
||||
_save_cnt++;
|
||||
|
||||
@ -12,14 +12,19 @@ using Poco::Thread;
|
||||
|
||||
void IResponseAnalysis::setup(int camWidth, int camHeight)
|
||||
{
|
||||
DELTA_T_SAVE = 50; //150 is about right
|
||||
NUM_PHASE = 1;
|
||||
|
||||
NUM_RUN = 1;
|
||||
NUM_SAVE_PER_RUN = 100;
|
||||
|
||||
int acq_run_time = 20; // 20 seconds of acquiring per run
|
||||
|
||||
DELTA_T_SAVE = 10*acq_run_time/2; // for 20 seconds, we want this to be around 200 files
|
||||
// or 10 times per second = every 100 ms
|
||||
|
||||
_frame_cnt_max = acq_run_time*ofGetFrameRate(); // e.g.: 30 frames per second * 20 seconds = 600 frames
|
||||
|
||||
create_dir();
|
||||
|
||||
_frame_cnt = 0;
|
||||
_frame_cnt_max = ofGetFrameRate() * ((DELTA_T_SAVE * NUM_SAVE_PER_RUN) / 1000);
|
||||
c = 0;
|
||||
|
||||
int anim_time = 5; // 10 seconds
|
||||
@ -51,12 +56,17 @@ void IResponseAnalysis::acquire()
|
||||
Thread::sleep(3);
|
||||
|
||||
save_timer->stop();
|
||||
|
||||
_RUN_DONE = false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void IResponseAnalysis::synthesise()
|
||||
{
|
||||
// _saved_filenames has all the file names of all the saved images
|
||||
while(!_RUN_DONE)
|
||||
Thread::sleep(3);
|
||||
}
|
||||
|
||||
|
||||
@ -79,9 +89,8 @@ void IResponseAnalysis::draw()
|
||||
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
||||
c = 255.0 * (_frame_cnt_max*_frame_cnt_max - _frame_cnt*_frame_cnt)/(_frame_cnt_max*_frame_cnt_max);
|
||||
} else {
|
||||
_state = STATE_SYNTHESISING;
|
||||
//_RUN_DONE = true;
|
||||
|
||||
_RUN_DONE = true;
|
||||
}
|
||||
|
||||
_frame_cnt++;
|
||||
@ -161,7 +170,8 @@ void IResponseAnalysis::draw()
|
||||
_anim_cnt++;
|
||||
|
||||
} else {
|
||||
_state = STATE_DISPLAY_RESULTS;
|
||||
|
||||
_RUN_DONE = true;
|
||||
_anim_cnt=0;
|
||||
}
|
||||
ofPopMatrix();
|
||||
@ -170,6 +180,7 @@ void IResponseAnalysis::draw()
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case STATE_DISPLAY_RESULTS:
|
||||
{
|
||||
@ -177,8 +188,7 @@ void IResponseAnalysis::draw()
|
||||
_RUN_DONE = true;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@ public:
|
||||
protected:
|
||||
|
||||
bool _RUN_DONE;
|
||||
int _run_cnt, _save_cnt, _fade_cnt, _anim_cnt;
|
||||
int _run_cnt, _save_cnt, _anim_cnt;
|
||||
float c, _frame_cnt, _frame_cnt_max, _anim_cnt_max;
|
||||
|
||||
};
|
||||
|
||||
@ -13,17 +13,20 @@ using Poco::Thread;
|
||||
|
||||
void RelaxRateAnalysis::setup(int camWidth, int camHeight)
|
||||
{
|
||||
DELTA_T_SAVE = 50; //300 is the correct number
|
||||
NUM_PHASE = 1;
|
||||
NUM_RUN = 1;
|
||||
NUM_SAVE_PER_RUN = 100;
|
||||
|
||||
int acq_run_time = 20; // 20 seconds of acquiring per run
|
||||
|
||||
DELTA_T_SAVE = 10*acq_run_time/2; // for 20 seconds, we want this to be around 200 files
|
||||
// or 10 times per second = every 100 ms
|
||||
|
||||
_frame_cnt_max = acq_run_time*ofGetFrameRate(); // e.g.: 30 frames per second * 20 seconds = 600 frames
|
||||
|
||||
create_dir();
|
||||
|
||||
_level = 0;
|
||||
_flip = 1;
|
||||
_frame_cnt = 0;
|
||||
_frame_cnt_max = ofGetFrameRate() * ((DELTA_T_SAVE * NUM_SAVE_PER_RUN) / 1000);
|
||||
c = 0;
|
||||
|
||||
int anim_time = 5; // 10 seconds
|
||||
@ -55,12 +58,17 @@ void RelaxRateAnalysis::acquire()
|
||||
Thread::sleep(3);
|
||||
|
||||
save_timer->stop();
|
||||
|
||||
_RUN_DONE = false;
|
||||
}
|
||||
}
|
||||
|
||||
void RelaxRateAnalysis::synthesise()
|
||||
{
|
||||
// _saved_filenames has all the file names of all the saved images
|
||||
while(!_RUN_DONE)
|
||||
Thread::sleep(3);
|
||||
|
||||
}
|
||||
|
||||
// this runs at frame rate = 33 ms for 30 FPS
|
||||
@ -92,9 +100,7 @@ void RelaxRateAnalysis::draw()
|
||||
|
||||
} else {
|
||||
|
||||
_state = STATE_SYNTHESISING;
|
||||
|
||||
//_RUN_DONE = true;
|
||||
_RUN_DONE = true;
|
||||
}
|
||||
|
||||
_frame_cnt++;
|
||||
@ -182,7 +188,7 @@ void RelaxRateAnalysis::draw()
|
||||
_anim_cnt++;
|
||||
|
||||
} else {
|
||||
_state = STATE_DISPLAY_RESULTS;
|
||||
_RUN_DONE = true;
|
||||
_anim_cnt=0;
|
||||
}
|
||||
ofPopMatrix();
|
||||
|
||||
@ -1,7 +1,3 @@
|
||||
/*
|
||||
~ author: dviid
|
||||
~ contact: dviid@labs.ciid.dk
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
@ -29,6 +25,6 @@ protected:
|
||||
|
||||
bool _RUN_DONE;
|
||||
float _flip, _level;
|
||||
int _run_cnt, _save_cnt, _fade_cnt, _anim_cnt;
|
||||
int _run_cnt, _save_cnt, _anim_cnt;
|
||||
float c, _frame_cnt, _frame_cnt_max, _anim_cnt_max;
|
||||
};
|
||||
|
||||
@ -14,16 +14,26 @@ using Poco::Thread;
|
||||
|
||||
void ShadowScapesAnalysis::setup(int camWidth, int camHeight)
|
||||
{
|
||||
|
||||
DELTA_T_SAVE = 50;
|
||||
NUM_PHASE = 1;
|
||||
NUM_RUN = 1;
|
||||
NUM_SAVE_PER_RUN = 100;
|
||||
|
||||
int acq_run_time = 15; // 10 seconds of acquiring per run
|
||||
|
||||
int screenSpan;
|
||||
if (_dir == V) screenSpan = ofGetHeight();
|
||||
if (_dir == H) screenSpan = ofGetWidth();
|
||||
if (_dir == D) screenSpan = ofGetHeight();
|
||||
|
||||
_step = (screenSpan/acq_run_time)/(ofGetFrameRate());
|
||||
// pixel per frame = (pixels / sec) / (frame / sec)
|
||||
|
||||
|
||||
// 40 pixels per second should give us a 20 second scan at 800 pixels wide
|
||||
|
||||
DELTA_T_SAVE = 10*acq_run_time/2; // for 20 seconds, we want this to be around 200 files
|
||||
// or 10 times per second = every 100 ms
|
||||
|
||||
create_dir();
|
||||
|
||||
|
||||
_speed = 100.0; // 900.0 is the correct number
|
||||
_scanLineWidth = 100.0;
|
||||
_run_cnt = 0;
|
||||
_save_cnt = 0;
|
||||
@ -34,14 +44,8 @@ void ShadowScapesAnalysis::setup(int camWidth, int camHeight)
|
||||
|
||||
void ShadowScapesAnalysis::acquire()
|
||||
{
|
||||
int screenSpan;
|
||||
if (_dir == V) screenSpan = ofGetHeight();
|
||||
if (_dir == H) screenSpan = ofGetWidth();
|
||||
if (_dir == D) screenSpan = ofGetHeight();
|
||||
|
||||
_step = ((screenSpan/_speed) * 1000.0) / 500.0;
|
||||
_line = 0;
|
||||
|
||||
_line = 0;
|
||||
|
||||
// RUN ROUTINE
|
||||
for(int i = 0; i < NUM_RUN; i++) {
|
||||
@ -58,6 +62,8 @@ void ShadowScapesAnalysis::acquire()
|
||||
Thread::sleep(3);
|
||||
|
||||
save_timer.stop();
|
||||
|
||||
_RUN_DONE = false;
|
||||
}
|
||||
|
||||
}
|
||||
@ -65,6 +71,8 @@ void ShadowScapesAnalysis::acquire()
|
||||
void ShadowScapesAnalysis::synthesise()
|
||||
{
|
||||
// _saved_filenames has all the file names of all the saved images
|
||||
while(!_RUN_DONE)
|
||||
Thread::sleep(3);
|
||||
}
|
||||
|
||||
|
||||
@ -140,20 +148,23 @@ void ShadowScapesAnalysis::draw()
|
||||
|
||||
if(_dir == V && int(_line) >= (ofGetHeight()+4*_scanLineWidth)){
|
||||
//cout << "VERTICAL IS DONE - _line >= (ofGetHeight()+4*_scanLineWidth) is TRUE" << endl;
|
||||
_state = STATE_SYNTHESISING;
|
||||
//_state = STATE_SYNTHESISING;
|
||||
_RUN_DONE = true;
|
||||
|
||||
}
|
||||
|
||||
if(_dir == H && int(_line) >= (ofGetWidth()+4*_scanLineWidth)) {
|
||||
|
||||
//cout << "HORIZONTAL IS DONE - _line >= (ofGetWidth()+4*_scanLineWidth)) is TRUE" << endl;
|
||||
_state = STATE_SYNTHESISING;
|
||||
//_state = STATE_SYNTHESISING;
|
||||
_RUN_DONE = true;
|
||||
|
||||
}
|
||||
|
||||
if(_dir == D && int(_line) >= (1.5*ofGetHeight()+4*_scanLineWidth)) {
|
||||
//cout << "DIAGONAL IS DONE - _line >= (1.5*ofGetHeight()+4*_scanLineWidth)) is TRUE" << endl;
|
||||
_state = STATE_SYNTHESISING;
|
||||
//_state = STATE_SYNTHESISING;
|
||||
_RUN_DONE = true;
|
||||
}
|
||||
|
||||
break;
|
||||
@ -229,7 +240,9 @@ void ShadowScapesAnalysis::draw()
|
||||
_anim_cnt++;
|
||||
|
||||
} else {
|
||||
_state = STATE_DISPLAY_RESULTS;
|
||||
|
||||
_RUN_DONE = true;
|
||||
//_state = STATE_DISPLAY_RESULTS;
|
||||
_anim_cnt=0;
|
||||
}
|
||||
ofPopMatrix();
|
||||
|
||||
@ -1,34 +1,4 @@
|
||||
/*
|
||||
- copyright (c) 2011 Copenhagen Institute of Interaction Design (CIID)
|
||||
- all rights reserved.
|
||||
|
||||
+ redistribution and use in source and binary forms, with or without
|
||||
+ modification, are permitted provided that the following conditions
|
||||
+ are met:
|
||||
+ > redistributions of source code must retain the above copyright
|
||||
+ notice, this list of conditions and the following disclaimer.
|
||||
+ > redistributions in binary form must reproduce the above copyright
|
||||
+ notice, this list of conditions and the following disclaimer in
|
||||
+ the documentation and/or other materials provided with the
|
||||
+ distribution.
|
||||
|
||||
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
+ FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
+ COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
+ AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
+ SUCH DAMAGE.
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
~ author: dviid
|
||||
~ contact: dviid@labs.ciid.dk
|
||||
*/
|
||||
/* */
|
||||
|
||||
#pragma once
|
||||
|
||||
@ -64,7 +34,7 @@ protected:
|
||||
float _scanLineWidth; // pix per second
|
||||
float _step;
|
||||
shadow_type _dir;
|
||||
int _run_cnt, _save_cnt, _fade_cnt, _anim_cnt;
|
||||
int _run_cnt, _save_cnt, _anim_cnt;
|
||||
float c, _frame_cnt, _frame_cnt_max, _anim_cnt_max;
|
||||
|
||||
};
|
||||
@ -13,23 +13,25 @@ using Poco::Thread;
|
||||
|
||||
void ShapeFromShadingAnalysis::setup(int camWidth, int camHeight)
|
||||
{
|
||||
DELTA_T_SAVE = 50; //300 is about the right number
|
||||
NUM_PHASE = 1;
|
||||
|
||||
|
||||
NUM_RUN = 1;
|
||||
NUM_SAVE_PER_RUN = 100;
|
||||
|
||||
int acq_run_time = 20; // 20 seconds of acquiring per run
|
||||
|
||||
DELTA_T_SAVE = 10*acq_run_time/2; // for 20 seconds, we want this to be around 200 files
|
||||
// or 10 times per second = every 100 ms
|
||||
|
||||
_frame_cnt_max = acq_run_time*ofGetFrameRate(); // e.g.: 30 frames per second * 20 seconds = 600 frames
|
||||
|
||||
create_dir();
|
||||
|
||||
_level = 0;
|
||||
_flip = 1;
|
||||
_frame_cnt = 0;
|
||||
|
||||
_frame_cnt_max = ofGetFrameRate() * ((DELTA_T_SAVE * NUM_SAVE_PER_RUN) / 1000);
|
||||
c = 0;
|
||||
|
||||
int anim_time = 10; // 10 seconds
|
||||
int anim_time = 5; // 10 seconds
|
||||
_anim_cnt_max = anim_time*ofGetFrameRate(); // e.g.: 30 frames per second = 150 frames
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -75,12 +77,17 @@ void ShapeFromShadingAnalysis::acquire()
|
||||
Thread::sleep(3);
|
||||
|
||||
save_timer->stop();
|
||||
|
||||
_RUN_DONE = false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void ShapeFromShadingAnalysis::synthesise()
|
||||
{
|
||||
// _saved_filenames has all the file names of all the saved images
|
||||
while(!_RUN_DONE)
|
||||
Thread::sleep(3);
|
||||
}
|
||||
|
||||
// this runs at frame rate = 33 ms for 30 FPS
|
||||
@ -308,8 +315,8 @@ void ShapeFromShadingAnalysis::draw()
|
||||
|
||||
ofDisableAlphaBlending();
|
||||
} else {
|
||||
_state = STATE_SYNTHESISING;
|
||||
//_RUN_DONE = true;
|
||||
//_state = STATE_SYNTHESISING;
|
||||
_RUN_DONE = true;
|
||||
}
|
||||
|
||||
_frame_cnt++;
|
||||
@ -390,7 +397,8 @@ void ShapeFromShadingAnalysis::draw()
|
||||
_anim_cnt++;
|
||||
|
||||
} else {
|
||||
_state = STATE_DISPLAY_RESULTS;
|
||||
_RUN_DONE = true;
|
||||
//_state = STATE_DISPLAY_RESULTS;
|
||||
_anim_cnt=0;
|
||||
}
|
||||
ofPopMatrix();
|
||||
|
||||
@ -48,6 +48,6 @@ protected:
|
||||
int _animation_cnt16;
|
||||
int _animation_reset; // this reset part didn't get working - so using 16 different counters! yay!
|
||||
|
||||
int _run_cnt, _save_cnt, _fade_cnt, _anim_cnt;
|
||||
int _run_cnt, _save_cnt, _anim_cnt;
|
||||
float c, _frame_cnt, _frame_cnt_max, _anim_cnt_max;
|
||||
};
|
||||
|
||||
@ -12,20 +12,22 @@ using Poco::Thread;
|
||||
|
||||
void StrobeAnalysis::setup(int camWidth, int camHeight)
|
||||
{
|
||||
DELTA_T_SAVE = 100;
|
||||
NUM_RUN = 1;
|
||||
|
||||
_strobe_cnt = 0;
|
||||
_strobe_cnt_max = 20; // 40 x 500 ms = 20000 ms = 20 seconds run time
|
||||
_strobe_interval = 1500; //every 0.5seconds = 15 frames
|
||||
_frame_cnt_max = _strobe_cnt_max * _strobe_interval * ofGetFrameRate()/1000;
|
||||
int acq_run_time = 20; // 20 seconds of acquiring per run
|
||||
|
||||
DELTA_T_SAVE = 10*acq_run_time/2; // for 20 seconds, we want this to be around 200 files
|
||||
// or 10 times per second = every 100 ms
|
||||
|
||||
_frame_cnt_max = acq_run_time*ofGetFrameRate(); // e.g.: 30 frames per second * 20 seconds = 600 frames
|
||||
|
||||
_strobe_interval = 1500; //every 1 seconds, or every thirty frames 30 frames
|
||||
|
||||
// The British Health and Safety Executive recommend that a net flash rate for a bank of strobe lights does not exceed 5 flashes per second, at which only 5% of photosensitive epileptics are at risk. It also recommends that no strobing effect continue for more than 30 seconds, due to the potential for discomfort and disorientation.
|
||||
|
||||
create_dir();
|
||||
|
||||
|
||||
int anim_time = 10; // 10 seconds
|
||||
int anim_time = 5; // 5 seconds for the animation
|
||||
_anim_cnt_max = anim_time*ofGetFrameRate(); // e.g.: 30 frames per second = 150 frames
|
||||
|
||||
}
|
||||
@ -51,18 +53,22 @@ void StrobeAnalysis::acquire()
|
||||
save_timer->start(save_callback);
|
||||
_RUN_DONE = false;
|
||||
|
||||
_frame_cnt = 0; _save_cnt = 0; _anim_cnt = 0;
|
||||
_frame_cnt = 0; _save_cnt = 0; _anim_cnt = 0; _strobe_cnt = 0;
|
||||
|
||||
while(!_RUN_DONE)
|
||||
Thread::sleep(3);
|
||||
|
||||
save_timer->stop();
|
||||
|
||||
_RUN_DONE = false;
|
||||
}
|
||||
}
|
||||
|
||||
void StrobeAnalysis::synthesise()
|
||||
{
|
||||
// _saved_filenames has all the file names of all the saved images
|
||||
while(!_RUN_DONE)
|
||||
Thread::sleep(3);
|
||||
}
|
||||
|
||||
// this runs at frame rate = 33 ms for 30 FPS
|
||||
@ -120,8 +126,8 @@ void StrobeAnalysis::draw()
|
||||
|
||||
ofDisableAlphaBlending();
|
||||
} else {
|
||||
_state = STATE_SYNTHESISING;
|
||||
//_RUN_DONE = true;
|
||||
//_state = STATE_SYNTHESISING;
|
||||
_RUN_DONE = true;
|
||||
}
|
||||
|
||||
_frame_cnt++;
|
||||
@ -201,7 +207,8 @@ void StrobeAnalysis::draw()
|
||||
_anim_cnt++;
|
||||
|
||||
} else {
|
||||
_state = STATE_DISPLAY_RESULTS;
|
||||
_RUN_DONE = true;
|
||||
//_state = STATE_DISPLAY_RESULTS;
|
||||
_anim_cnt=0;
|
||||
}
|
||||
ofPopMatrix();
|
||||
|
||||
@ -33,6 +33,6 @@ protected:
|
||||
int _strobe_interval;
|
||||
bool _strobe_on;
|
||||
|
||||
int _run_cnt, _save_cnt, _fade_cnt, _anim_cnt;
|
||||
int _run_cnt, _save_cnt, _anim_cnt;
|
||||
float c, _frame_cnt, _frame_cnt_max, _anim_cnt_max;
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user