new arch
> sequence: acquire -> synthesise -> display results
This commit is contained in:
parent
65c625ad1e
commit
7109c65d63
@ -11,7 +11,6 @@
|
|||||||
#include "RefractiveIndex.h"
|
#include "RefractiveIndex.h"
|
||||||
|
|
||||||
#include "IResponseAnalysis.h"
|
#include "IResponseAnalysis.h"
|
||||||
#include "StrobeAnalysis.h"
|
|
||||||
#include "ShadowScapesAnalysis.h"
|
#include "ShadowScapesAnalysis.h"
|
||||||
#include "ColorMultiAnalysis.h"
|
#include "ColorMultiAnalysis.h"
|
||||||
#include "ColorSingleAnalysis.h"
|
#include "ColorSingleAnalysis.h"
|
||||||
@ -98,7 +97,6 @@ void RefractiveIndex::setup()
|
|||||||
// setup analysis
|
// setup analysis
|
||||||
|
|
||||||
_analysisVector.push_back(new ShadowScapesAnalysis());
|
_analysisVector.push_back(new ShadowScapesAnalysis());
|
||||||
_analysisVector.push_back(new StrobeAnalysis());
|
|
||||||
_analysisVector.push_back(new IResponseAnalysis());
|
_analysisVector.push_back(new IResponseAnalysis());
|
||||||
_analysisVector.push_back(new ColorMultiAnalysis());
|
_analysisVector.push_back(new ColorMultiAnalysis());
|
||||||
_analysisVector.push_back(new CamFrameRateAnalysis());
|
_analysisVector.push_back(new CamFrameRateAnalysis());
|
||||||
|
|||||||
@ -33,8 +33,13 @@
|
|||||||
#include "AbstractAnalysis.h"
|
#include "AbstractAnalysis.h"
|
||||||
#include "RefractiveIndex.h"
|
#include "RefractiveIndex.h"
|
||||||
|
|
||||||
|
// this is the main threaded loop for a given analysis
|
||||||
void AbstractAnalysis::do_synthesize() {
|
void AbstractAnalysis::do_synthesize() {
|
||||||
synthesize();
|
_state = STATE_ACQUIRING;
|
||||||
|
acquire();
|
||||||
|
_state = STATE_SYNTHESISING;
|
||||||
|
synthesise();
|
||||||
|
_state = STATE_DISPLAY_RESULTS;
|
||||||
ofNotifyEvent(_synthesize_cb, _name);
|
ofNotifyEvent(_synthesize_cb, _name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -11,7 +11,10 @@
|
|||||||
|
|
||||||
#define ANALYSIS_PATH "analysis/"
|
#define ANALYSIS_PATH "analysis/"
|
||||||
|
|
||||||
#define STATE_STOP 0xDEADBEEF
|
#define STATE_ACQUIRING 0x1111
|
||||||
|
#define STATE_SYNTHESISING 0x2222
|
||||||
|
#define STATE_DISPLAY_RESULTS 0x3333
|
||||||
|
#define STATE_STOP 0xDEADBEEF
|
||||||
|
|
||||||
class AbstractAnalysis {
|
class AbstractAnalysis {
|
||||||
|
|
||||||
@ -20,7 +23,8 @@ public:
|
|||||||
virtual ~AbstractAnalysis(){;}
|
virtual ~AbstractAnalysis(){;}
|
||||||
|
|
||||||
// generic function to set up the camera
|
// generic function to set up the camera
|
||||||
virtual void setup(int camWidth, int camHeight){_cam_w = camWidth; _cam_h = camHeight;}
|
virtual void setup(int camWidth, int camHeight){_cam_w = camWidth; _cam_h = camHeight;}
|
||||||
|
// this is the main threaded loop for a given analysis
|
||||||
void do_synthesize();
|
void do_synthesize();
|
||||||
|
|
||||||
// ofx
|
// ofx
|
||||||
@ -30,9 +34,12 @@ protected:
|
|||||||
|
|
||||||
virtual void create_dir();
|
virtual void create_dir();
|
||||||
|
|
||||||
// the runnable function in the thread
|
// acquire images - all the children (see - do_synthesize)
|
||||||
virtual void synthesize() = 0;
|
virtual void acquire() = 0;
|
||||||
// this means that this function needs to be overwritten by children that inherit this class
|
|
||||||
|
// analysis + synthesize images - all the children (see - do_synthesize)
|
||||||
|
virtual void synthesise() = 0;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
string _name;
|
string _name;
|
||||||
@ -41,14 +48,16 @@ public:
|
|||||||
ofEvent<string> _synthesize_cb;
|
ofEvent<string> _synthesize_cb;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int _cam_w, _cam_h;
|
int _cam_w, _cam_h;
|
||||||
int _state;
|
string _whole_file_path;
|
||||||
string _whole_file_path;
|
vector<string> _saved_filenames;
|
||||||
|
|
||||||
float DELTA_T_SAVE;
|
int _state;
|
||||||
int NUM_PHASE;
|
|
||||||
int NUM_RUN;
|
float DELTA_T_SAVE;
|
||||||
int NUM_SAVE_PER_RUN;
|
int NUM_PHASE;
|
||||||
|
int NUM_RUN;
|
||||||
|
int NUM_SAVE_PER_RUN;
|
||||||
|
|
||||||
friend class AnalysisAdaptor;
|
friend class AnalysisAdaptor;
|
||||||
};
|
};
|
||||||
@ -31,7 +31,7 @@ void CamFrameRateAnalysis::setup(int camWidth, int camHeight)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CamFrameRateAnalysis::synthesize()
|
void CamFrameRateAnalysis::acquire()
|
||||||
{
|
{
|
||||||
|
|
||||||
Timer* save_timer;
|
Timer* save_timer;
|
||||||
@ -57,30 +57,59 @@ void CamFrameRateAnalysis::synthesize()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CamFrameRateAnalysis::synthesise()
|
||||||
|
{
|
||||||
|
// _saved_filenames has all the file names of all the saved images
|
||||||
|
}
|
||||||
|
|
||||||
// this runs at frame rate = 33 ms for 30 FPS
|
// this runs at frame rate = 33 ms for 30 FPS
|
||||||
void CamFrameRateAnalysis::draw()
|
void CamFrameRateAnalysis::draw()
|
||||||
{
|
{
|
||||||
/// *** TODO *** ///
|
|
||||||
// still need to deal with latency frames here - i.e.: there are frames
|
switch (_state) {
|
||||||
/// *** TODO *** ///
|
case STATE_ACQUIRING:
|
||||||
float totalTime=_frame_cnt_max/2;
|
{
|
||||||
|
/// *** TODO *** ///
|
||||||
float numSteps=10;
|
// still need to deal with latency frames here - i.e.: there are frames
|
||||||
|
/// *** TODO *** ///
|
||||||
vector<float>stepLengths;
|
float totalTime=_frame_cnt_max/2;
|
||||||
|
|
||||||
|
float numSteps=10;
|
||||||
//c must increase until frame_cnt_max * 0.5 and then decrease afterwards
|
|
||||||
|
vector<float>stepLengths;
|
||||||
|
|
||||||
if (_frame_cnt < _frame_cnt_max)
|
|
||||||
{
|
//c must increase until frame_cnt_max * 0.5 and then decrease afterwards
|
||||||
ofSetColor(c, c, c);
|
|
||||||
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
|
||||||
c = 255.0 * (_frame_cnt_max - _frame_cnt)/(_frame_cnt_max);
|
if (_frame_cnt < _frame_cnt_max)
|
||||||
cout<<_frame_cnt<<endl;
|
{
|
||||||
|
ofSetColor(c, c, c);
|
||||||
|
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
||||||
|
c = 255.0 * (_frame_cnt_max - _frame_cnt)/(_frame_cnt_max);
|
||||||
|
cout<<_frame_cnt<<endl;
|
||||||
|
}
|
||||||
|
_frame_cnt++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case STATE_SYNTHESISING:
|
||||||
|
{
|
||||||
|
// display animation of something while the synthesis in on-going...
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case STATE_DISPLAY_RESULTS:
|
||||||
|
{
|
||||||
|
// display results of the synthesis
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
_frame_cnt++;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -93,9 +122,12 @@ void CamFrameRateAnalysis::save_cb(Timer& timer)
|
|||||||
//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;
|
string thisLocation = RefractiveIndex::_location;
|
||||||
|
|
||||||
|
string file = _whole_file_path+"/"+file_name;
|
||||||
|
|
||||||
|
ofSaveImage(RefractiveIndex::_pixels, file, OF_IMAGE_QUALITY_BEST);
|
||||||
ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST);
|
|
||||||
|
_saved_filenames.push_back(file);
|
||||||
|
|
||||||
if(_save_cnt >= NUM_SAVE_PER_RUN)
|
if(_save_cnt >= NUM_SAVE_PER_RUN)
|
||||||
_RUN_DONE = true;
|
_RUN_DONE = true;
|
||||||
|
|||||||
@ -19,7 +19,8 @@ public:
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
void setup(int camWidth, int camHeight);
|
void setup(int camWidth, int camHeight);
|
||||||
void synthesize();
|
void acquire();
|
||||||
|
void synthesise();
|
||||||
void draw();
|
void draw();
|
||||||
|
|
||||||
void save_cb(Poco::Timer& timer);
|
void save_cb(Poco::Timer& timer);
|
||||||
|
|||||||
@ -31,7 +31,7 @@ void CamNoiseAnalysis::setup(int camWidth, int camHeight)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CamNoiseAnalysis::synthesize()
|
void CamNoiseAnalysis::acquire()
|
||||||
{
|
{
|
||||||
|
|
||||||
Timer* save_timer;
|
Timer* save_timer;
|
||||||
@ -57,34 +57,61 @@ void CamNoiseAnalysis::synthesize()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CamNoiseAnalysis::synthesise()
|
||||||
|
{
|
||||||
|
// _saved_filenames has all the file names of all the saved images
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// this runs at frame rate = 33 ms for 30 FPS
|
// this runs at frame rate = 33 ms for 30 FPS
|
||||||
void CamNoiseAnalysis::draw()
|
void CamNoiseAnalysis::draw()
|
||||||
{
|
{
|
||||||
/// *** TODO *** ///
|
|
||||||
// still need to deal with latency frames here - i.e.: there are frames
|
switch (_state) {
|
||||||
/// *** TODO *** ///
|
case STATE_ACQUIRING:
|
||||||
|
{
|
||||||
float _number_of_grey_levels=5;
|
/// *** TODO *** ///
|
||||||
|
// still need to deal with latency frames here - i.e.: there are frames
|
||||||
float _frames_per_level = _frame_cnt_max / _number_of_grey_levels;
|
/// *** TODO *** ///
|
||||||
ofColor someColor;
|
|
||||||
|
float _number_of_grey_levels=5;
|
||||||
for(int i=0;i<=_number_of_grey_levels;i++){
|
|
||||||
if (_frame_cnt>= _frames_per_level *( i-1) && +_frame_cnt < _frames_per_level * (i) ) {
|
float _frames_per_level = _frame_cnt_max / _number_of_grey_levels;
|
||||||
//set colour to current grey level
|
ofColor someColor;
|
||||||
c=255-( 255.0 * ( i /_number_of_grey_levels));
|
|
||||||
someColor.set(c);
|
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());
|
||||||
|
}
|
||||||
|
_frame_cnt++;
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
ofSetColor(someColor);
|
|
||||||
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
case STATE_SYNTHESISING:
|
||||||
|
{
|
||||||
|
// display animation of something while the synthesis in on-going...
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case STATE_DISPLAY_RESULTS:
|
||||||
|
{
|
||||||
|
// display results of the synthesis
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_frame_cnt++;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,9 +122,12 @@ void CamNoiseAnalysis::save_cb(Timer& timer)
|
|||||||
|
|
||||||
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;
|
string thisLocation = RefractiveIndex::_location;
|
||||||
|
|
||||||
|
string file = _whole_file_path+"/"+file_name;
|
||||||
|
|
||||||
ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST);
|
ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST);
|
||||||
|
|
||||||
|
_saved_filenames.push_back(file);
|
||||||
|
|
||||||
if(_save_cnt >= NUM_SAVE_PER_RUN)
|
if(_save_cnt >= NUM_SAVE_PER_RUN)
|
||||||
_RUN_DONE = true;
|
_RUN_DONE = true;
|
||||||
|
|||||||
@ -18,7 +18,8 @@ public:
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
void setup(int camWidth, int camHeight);
|
void setup(int camWidth, int camHeight);
|
||||||
void synthesize();
|
void acquire();
|
||||||
|
void synthesise();
|
||||||
void draw();
|
void draw();
|
||||||
|
|
||||||
void save_cb(Poco::Timer& timer);
|
void save_cb(Poco::Timer& timer);
|
||||||
|
|||||||
@ -56,7 +56,7 @@ void ColorMultiAnalysis::setup(int camWidth, int camHeight)
|
|||||||
c = 0;
|
c = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorMultiAnalysis::synthesize()
|
void ColorMultiAnalysis::acquire()
|
||||||
{
|
{
|
||||||
|
|
||||||
Timer* save_timer;
|
Timer* save_timer;
|
||||||
@ -83,18 +83,48 @@ void ColorMultiAnalysis::synthesize()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ColorMultiAnalysis::synthesise()
|
||||||
|
{
|
||||||
|
// _saved_filenames has all the file names of all the saved images
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void ColorMultiAnalysis::draw()
|
void ColorMultiAnalysis::draw()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (_frame_cnt < _frame_cnt_max) {
|
switch (_state) {
|
||||||
ofColor aColor;
|
case STATE_ACQUIRING:
|
||||||
aColor.setHsb(c, 255, 255);
|
{
|
||||||
ofSetColor(aColor);
|
if (_frame_cnt < _frame_cnt_max) {
|
||||||
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
ofColor aColor;
|
||||||
//how far are we as a percent of _frame_count_max
|
aColor.setHsb(c, 255, 255);
|
||||||
c = 255.0 * (_frame_cnt_max - _frame_cnt)/(_frame_cnt_max);
|
ofSetColor(aColor);
|
||||||
|
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
||||||
|
//how far are we as a percent of _frame_count_max
|
||||||
|
c = 255.0 * (_frame_cnt_max - _frame_cnt)/(_frame_cnt_max);
|
||||||
|
}
|
||||||
|
_frame_cnt++;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case STATE_SYNTHESISING:
|
||||||
|
{
|
||||||
|
// display animation of something while the synthesis in on-going...
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case STATE_DISPLAY_RESULTS:
|
||||||
|
{
|
||||||
|
// display results of the synthesis
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
_frame_cnt++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -109,9 +139,12 @@ void ColorMultiAnalysis::save_cb(Timer& timer)
|
|||||||
cout << "COLORMULTIANALYSIS::saving...\n";
|
cout << "COLORMULTIANALYSIS::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 file = _whole_file_path+"/"+file_name;
|
||||||
|
|
||||||
cout<<_whole_file_path<<endl;
|
|
||||||
ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST);
|
ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST);
|
||||||
|
|
||||||
|
_saved_filenames.push_back(file);
|
||||||
|
|
||||||
if(_save_cnt >= NUM_SAVE_PER_RUN){
|
if(_save_cnt >= NUM_SAVE_PER_RUN){
|
||||||
_RUN_DONE = true;
|
_RUN_DONE = true;
|
||||||
|
|||||||
@ -13,7 +13,8 @@ public:
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
void setup(int camWidth, int camHeight);
|
void setup(int camWidth, int camHeight);
|
||||||
void synthesize();
|
void acquire();
|
||||||
|
void synthesise();
|
||||||
void draw();
|
void draw();
|
||||||
|
|
||||||
void save_cb(Poco::Timer& timer);
|
void save_cb(Poco::Timer& timer);
|
||||||
|
|||||||
@ -32,7 +32,7 @@ void ColorSingleAnalysis::setup(int camWidth, int camHeight)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ColorSingleAnalysis::synthesize()
|
void ColorSingleAnalysis::acquire()
|
||||||
{
|
{
|
||||||
|
|
||||||
Timer* save_timer;
|
Timer* save_timer;
|
||||||
@ -58,34 +58,63 @@ void ColorSingleAnalysis::synthesize()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ColorSingleAnalysis::synthesise()
|
||||||
|
{
|
||||||
|
// _saved_filenames has all the file names of all the saved images
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void ColorSingleAnalysis::draw()
|
void ColorSingleAnalysis::draw()
|
||||||
{
|
{
|
||||||
|
|
||||||
float one_third_of_frame_count_max=_frame_cnt_max/3;
|
switch (_state) {
|
||||||
if (_frame_cnt < one_third_of_frame_count_max){
|
case STATE_ACQUIRING:
|
||||||
r=255.0;
|
{
|
||||||
g=0.0;
|
float one_third_of_frame_count_max=_frame_cnt_max/3;
|
||||||
b=0.0;
|
if (_frame_cnt < one_third_of_frame_count_max){
|
||||||
ofSetColor(r,g,b);
|
r=255.0;
|
||||||
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
g=0.0;
|
||||||
|
b=0.0;
|
||||||
|
ofSetColor(r,g,b);
|
||||||
|
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
||||||
|
}
|
||||||
|
if (_frame_cnt >= one_third_of_frame_count_max && _frame_cnt < 2*one_third_of_frame_count_max){
|
||||||
|
r=0.0;
|
||||||
|
g=255.0;
|
||||||
|
b=0.0;
|
||||||
|
ofSetColor(r,g,b);
|
||||||
|
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
||||||
|
}
|
||||||
|
if (_frame_cnt >= 2*one_third_of_frame_count_max && _frame_cnt < _frame_cnt_max){
|
||||||
|
r=0.0;
|
||||||
|
g=0.0;
|
||||||
|
b=255.0;
|
||||||
|
ofSetColor(r,g,b);
|
||||||
|
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
||||||
|
}
|
||||||
|
|
||||||
|
_frame_cnt++;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case STATE_SYNTHESISING:
|
||||||
|
{
|
||||||
|
// display animation of something while the synthesis in on-going...
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case STATE_DISPLAY_RESULTS:
|
||||||
|
{
|
||||||
|
// display results of the synthesis
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (_frame_cnt >= one_third_of_frame_count_max && _frame_cnt < 2*one_third_of_frame_count_max){
|
|
||||||
r=0.0;
|
|
||||||
g=255.0;
|
|
||||||
b=0.0;
|
|
||||||
ofSetColor(r,g,b);
|
|
||||||
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
|
||||||
}
|
|
||||||
if (_frame_cnt >= 2*one_third_of_frame_count_max && _frame_cnt < _frame_cnt_max){
|
|
||||||
r=0.0;
|
|
||||||
g=0.0;
|
|
||||||
b=255.0;
|
|
||||||
ofSetColor(r,g,b);
|
|
||||||
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
|
||||||
}
|
|
||||||
|
|
||||||
_frame_cnt++;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,8 +127,12 @@ void ColorSingleAnalysis::save_cb(Timer& timer)
|
|||||||
cout << "ColorSingleAnalysis::saving...\n";
|
cout << "ColorSingleAnalysis::saving...\n";
|
||||||
string file_name =ofToString(_frame_cnt,2)+"_"+ofToString((int)r,2)+"_"+ofToString((int)g,2)+"_"+ofToString((int)b,2)+"_"+ofToString(_run_cnt,2)+".jpg";
|
string file_name =ofToString(_frame_cnt,2)+"_"+ofToString((int)r,2)+"_"+ofToString((int)g,2)+"_"+ofToString((int)b,2)+"_"+ofToString(_run_cnt,2)+".jpg";
|
||||||
|
|
||||||
|
string file = _whole_file_path+"/"+file_name;
|
||||||
|
|
||||||
ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST);
|
ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST);
|
||||||
|
|
||||||
|
_saved_filenames.push_back(file);
|
||||||
|
|
||||||
cout<<_whole_file_path+"/"+file_name<<endl;
|
cout<<_whole_file_path+"/"+file_name<<endl;
|
||||||
|
|
||||||
if(_save_cnt >= NUM_SAVE_PER_RUN)
|
if(_save_cnt >= NUM_SAVE_PER_RUN)
|
||||||
|
|||||||
@ -18,7 +18,8 @@ public:
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
void setup(int camWidth, int camHeight);
|
void setup(int camWidth, int camHeight);
|
||||||
void synthesize();
|
void acquire();
|
||||||
|
void synthesise();
|
||||||
void draw();
|
void draw();
|
||||||
|
|
||||||
void save_cb(Poco::Timer& timer);
|
void save_cb(Poco::Timer& timer);
|
||||||
|
|||||||
@ -30,7 +30,7 @@ void DiffNoiseAnalysis::setup(int camWidth, int camHeight)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DiffNoiseAnalysis::synthesize()
|
void DiffNoiseAnalysis::acquire()
|
||||||
{
|
{
|
||||||
|
|
||||||
Timer* save_timer;
|
Timer* save_timer;
|
||||||
@ -56,24 +56,52 @@ void DiffNoiseAnalysis::synthesize()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DiffNoiseAnalysis::synthesise()
|
||||||
|
{
|
||||||
|
// _saved_filenames has all the file names of all the saved images
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// this runs at frame rate = 33 ms for 30 FPS
|
// this runs at frame rate = 33 ms for 30 FPS
|
||||||
void DiffNoiseAnalysis::draw()
|
void DiffNoiseAnalysis::draw()
|
||||||
{
|
{
|
||||||
/// *** TODO *** ///
|
switch (_state) {
|
||||||
// still need to deal with latency frames here - i.e.: there are frames
|
case STATE_ACQUIRING:
|
||||||
/// *** TODO *** ///
|
{
|
||||||
ofColor aColour;
|
/// *** TODO *** ///
|
||||||
|
// still need to deal with latency frames here - i.e.: there are frames
|
||||||
c = ofRandom(0,255);
|
/// *** TODO *** ///
|
||||||
aColour.setHsb(c, 255, 255);
|
ofColor aColour;
|
||||||
if (_frame_cnt < _frame_cnt_max)
|
|
||||||
{
|
c = ofRandom(0,255);
|
||||||
ofSetColor(aColour);
|
aColour.setHsb(c, 255, 255);
|
||||||
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
if (_frame_cnt < _frame_cnt_max)
|
||||||
|
{
|
||||||
|
ofSetColor(aColour);
|
||||||
|
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
||||||
|
|
||||||
|
}
|
||||||
|
_frame_cnt++;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case STATE_SYNTHESISING:
|
||||||
|
{
|
||||||
|
// display animation of something while the synthesis in on-going...
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case STATE_DISPLAY_RESULTS:
|
||||||
|
{
|
||||||
|
// display results of the synthesis
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
_frame_cnt++;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,8 +124,12 @@ void DiffNoiseAnalysis::save_cb(Timer& timer)
|
|||||||
//RefractiveIndex::_pixels = RefractiveIndex::_vidGrabber.getPixelsRef(); //get ofPixels from the camera
|
//RefractiveIndex::_pixels = RefractiveIndex::_vidGrabber.getPixelsRef(); //get ofPixels from the camera
|
||||||
// fileName = imageSaveFolderPath+whichAnalysis+"_"+ofToString(100.0*i*scanLineSpeed/ofGetHeight(),2)+"%_"+ofToString(i)+".jpg";
|
// fileName = imageSaveFolderPath+whichAnalysis+"_"+ofToString(100.0*i*scanLineSpeed/ofGetHeight(),2)+"%_"+ofToString(i)+".jpg";
|
||||||
//ofSaveImage(vectorOfPixels[i], fileName, OF_IMAGE_QUALITY_BEST);
|
//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);
|
ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST);
|
||||||
|
|
||||||
|
_saved_filenames.push_back(file);
|
||||||
|
|
||||||
}
|
}
|
||||||
_save_cnt++;
|
_save_cnt++;
|
||||||
|
|||||||
@ -18,7 +18,8 @@ public:
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
void setup(int camWidth, int camHeight);
|
void setup(int camWidth, int camHeight);
|
||||||
void synthesize();
|
void acquire();
|
||||||
|
void synthesise();
|
||||||
void draw();
|
void draw();
|
||||||
|
|
||||||
void save_cb(Poco::Timer& timer);
|
void save_cb(Poco::Timer& timer);
|
||||||
|
|||||||
@ -29,7 +29,7 @@ void IResponseAnalysis::setup(int camWidth, int camHeight)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void IResponseAnalysis::synthesize()
|
void IResponseAnalysis::acquire()
|
||||||
{
|
{
|
||||||
|
|
||||||
Timer* save_timer;
|
Timer* save_timer;
|
||||||
@ -55,22 +55,52 @@ void IResponseAnalysis::synthesize()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IResponseAnalysis::synthesise()
|
||||||
|
{
|
||||||
|
// _saved_filenames has all the file names of all the saved images
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// this runs at frame rate = 33 ms for 30 FPS
|
// this runs at frame rate = 33 ms for 30 FPS
|
||||||
void IResponseAnalysis::draw()
|
void IResponseAnalysis::draw()
|
||||||
{
|
{
|
||||||
/// *** TODO *** ///
|
|
||||||
// still need to deal with latency frames here - i.e.: there are frames
|
switch (_state) {
|
||||||
/// *** TODO *** ///
|
case STATE_ACQUIRING:
|
||||||
|
{
|
||||||
if (_frame_cnt < _frame_cnt_max)
|
/// *** TODO *** ///
|
||||||
{
|
// still need to deal with latency frames here - i.e.: there are frames
|
||||||
ofSetColor(c, c, c);
|
/// *** TODO *** ///
|
||||||
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
|
||||||
c = 255.0 * (_frame_cnt_max - _frame_cnt)/(_frame_cnt_max);
|
if (_frame_cnt < _frame_cnt_max)
|
||||||
|
{
|
||||||
|
ofSetColor(c, c, c);
|
||||||
|
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
||||||
|
c = 255.0 * (_frame_cnt_max - _frame_cnt)/(_frame_cnt_max);
|
||||||
|
}
|
||||||
|
|
||||||
|
_frame_cnt++;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case STATE_SYNTHESISING:
|
||||||
|
{
|
||||||
|
// display animation of something while the synthesis in on-going...
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case STATE_DISPLAY_RESULTS:
|
||||||
|
{
|
||||||
|
// display results of the synthesis
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
_frame_cnt++;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,8 +120,12 @@ void IResponseAnalysis::save_cb(Timer& timer)
|
|||||||
//RefractiveIndex::_pixels = RefractiveIndex::_vidGrabber.getPixelsRef(); //get ofPixels from the camera
|
//RefractiveIndex::_pixels = RefractiveIndex::_vidGrabber.getPixelsRef(); //get ofPixels from the camera
|
||||||
// fileName = imageSaveFolderPath+whichAnalysis+"_"+ofToString(100.0*i*scanLineSpeed/ofGetHeight(),2)+"%_"+ofToString(i)+".jpg";
|
// fileName = imageSaveFolderPath+whichAnalysis+"_"+ofToString(100.0*i*scanLineSpeed/ofGetHeight(),2)+"%_"+ofToString(i)+".jpg";
|
||||||
//ofSaveImage(vectorOfPixels[i], fileName, OF_IMAGE_QUALITY_BEST);
|
//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);
|
ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST);
|
||||||
|
|
||||||
|
_saved_filenames.push_back(file);
|
||||||
|
|
||||||
if(_save_cnt >= NUM_SAVE_PER_RUN)
|
if(_save_cnt >= NUM_SAVE_PER_RUN)
|
||||||
_RUN_DONE = true;
|
_RUN_DONE = true;
|
||||||
|
|||||||
@ -18,7 +18,8 @@ public:
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
void setup(int camWidth, int camHeight);
|
void setup(int camWidth, int camHeight);
|
||||||
void synthesize();
|
void acquire();
|
||||||
|
void synthesise();
|
||||||
void draw();
|
void draw();
|
||||||
|
|
||||||
void save_cb(Poco::Timer& timer);
|
void save_cb(Poco::Timer& timer);
|
||||||
|
|||||||
@ -30,7 +30,7 @@ void LatencyTestAnalysis::setup(int camWidth, int camHeight)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LatencyTestAnalysis::synthesize()
|
void LatencyTestAnalysis::acquire()
|
||||||
{
|
{
|
||||||
|
|
||||||
Timer* save_timer;
|
Timer* save_timer;
|
||||||
@ -56,39 +56,68 @@ void LatencyTestAnalysis::synthesize()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LatencyTestAnalysis::synthesise()
|
||||||
|
{
|
||||||
|
// _saved_filenames has all the file names of all the saved images
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// this runs at frame rate = 33 ms for 30 FPS
|
// this runs at frame rate = 33 ms for 30 FPS
|
||||||
void LatencyTestAnalysis::draw()
|
void LatencyTestAnalysis::draw()
|
||||||
{
|
{
|
||||||
/// *** TODO *** ///
|
|
||||||
// still need to deal with latency frames here - i.e.: there are frames
|
switch (_state) {
|
||||||
/// *** TODO *** ///
|
case STATE_ACQUIRING:
|
||||||
|
{
|
||||||
if (_frame_cnt < _frame_cnt_max/3)
|
/// *** TODO *** ///
|
||||||
{
|
// still need to deal with latency frames here - i.e.: there are frames
|
||||||
c = 0;
|
/// *** TODO *** ///
|
||||||
|
|
||||||
ofSetColor(c, c, c);
|
if (_frame_cnt < _frame_cnt_max/3)
|
||||||
cout<<"1st third"<<endl;
|
{
|
||||||
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
c = 0;
|
||||||
}
|
|
||||||
if (_frame_cnt >= _frame_cnt_max/3 && _frame_cnt < 2*( _frame_cnt_max/3))
|
ofSetColor(c, c, c);
|
||||||
{
|
cout<<"1st third"<<endl;
|
||||||
c = 255;
|
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
||||||
cout<<"2nd third"<<endl;
|
}
|
||||||
|
if (_frame_cnt >= _frame_cnt_max/3 && _frame_cnt < 2*( _frame_cnt_max/3))
|
||||||
ofSetColor(c, c, c);
|
{
|
||||||
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
c = 255;
|
||||||
}
|
cout<<"2nd third"<<endl;
|
||||||
if (_frame_cnt >= 2*( _frame_cnt_max/3) && _frame_cnt < _frame_cnt_max)
|
|
||||||
{
|
ofSetColor(c, c, c);
|
||||||
c = 0;
|
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
||||||
cout<<"3rd third"<<endl;
|
}
|
||||||
|
if (_frame_cnt >= 2*( _frame_cnt_max/3) && _frame_cnt < _frame_cnt_max)
|
||||||
ofSetColor(c, c, c);
|
{
|
||||||
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
c = 0;
|
||||||
}
|
cout<<"3rd third"<<endl;
|
||||||
_frame_cnt++;
|
|
||||||
|
ofSetColor(c, c, c);
|
||||||
|
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
||||||
|
}
|
||||||
|
_frame_cnt++;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case STATE_SYNTHESISING:
|
||||||
|
{
|
||||||
|
// display animation of something while the synthesis in on-going...
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case STATE_DISPLAY_RESULTS:
|
||||||
|
{
|
||||||
|
// display results of the synthesis
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,8 +137,12 @@ void LatencyTestAnalysis::save_cb(Timer& timer)
|
|||||||
//RefractiveIndex::_pixels = RefractiveIndex::_vidGrabber.getPixelsRef(); //get ofPixels from the camera
|
//RefractiveIndex::_pixels = RefractiveIndex::_vidGrabber.getPixelsRef(); //get ofPixels from the camera
|
||||||
// fileName = imageSaveFolderPath+whichAnalysis+"_"+ofToString(100.0*i*scanLineSpeed/ofGetHeight(),2)+"%_"+ofToString(i)+".jpg";
|
// fileName = imageSaveFolderPath+whichAnalysis+"_"+ofToString(100.0*i*scanLineSpeed/ofGetHeight(),2)+"%_"+ofToString(i)+".jpg";
|
||||||
//ofSaveImage(vectorOfPixels[i], fileName, OF_IMAGE_QUALITY_BEST);
|
//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);
|
ofSaveImage(RefractiveIndex::_pixels, _whole_file_path+"/"+file_name, OF_IMAGE_QUALITY_BEST);
|
||||||
|
|
||||||
|
_saved_filenames.push_back(file);
|
||||||
|
|
||||||
if(_save_cnt >= NUM_SAVE_PER_RUN)
|
if(_save_cnt >= NUM_SAVE_PER_RUN)
|
||||||
_RUN_DONE = true;
|
_RUN_DONE = true;
|
||||||
|
|||||||
@ -18,7 +18,8 @@ public:
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
void setup(int camWidth, int camHeight);
|
void setup(int camWidth, int camHeight);
|
||||||
void synthesize();
|
void acquire();
|
||||||
|
void synthesise();
|
||||||
void draw();
|
void draw();
|
||||||
|
|
||||||
void save_cb(Poco::Timer& timer);
|
void save_cb(Poco::Timer& timer);
|
||||||
|
|||||||
@ -50,7 +50,7 @@ void ShadowScapesAnalysis::setup(int camWidth, int camHeight)
|
|||||||
_speed = 300;
|
_speed = 300;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShadowScapesAnalysis::synthesize()
|
void ShadowScapesAnalysis::acquire()
|
||||||
{
|
{
|
||||||
int w;
|
int w;
|
||||||
if(_dir == H) w = ofGetWidth();
|
if(_dir == H) w = ofGetWidth();
|
||||||
@ -79,29 +79,59 @@ void ShadowScapesAnalysis::synthesize()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ShadowScapesAnalysis::synthesise()
|
||||||
|
{
|
||||||
|
// _saved_filenames has all the file names of all the saved images
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// the animation draw - and the output draw
|
// the animation draw - and the output draw
|
||||||
void ShadowScapesAnalysis::draw()
|
void ShadowScapesAnalysis::draw()
|
||||||
{
|
{
|
||||||
|
|
||||||
static int _pos;
|
switch (_state) {
|
||||||
|
case STATE_ACQUIRING:
|
||||||
if(_state == STATE_ANALYSIS) {
|
{
|
||||||
ofSetColor(0, 200, 0);
|
static int _pos;
|
||||||
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
|
||||||
return;
|
if(_state == STATE_ANALYSIS) {
|
||||||
}
|
ofSetColor(0, 200, 0);
|
||||||
|
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
||||||
if(_state == STATE_SCAN) {
|
return;
|
||||||
if(_pos != _line) {
|
}
|
||||||
//take snap??
|
|
||||||
_pos = _line;
|
if(_state == STATE_SCAN) {
|
||||||
|
if(_pos != _line) {
|
||||||
|
//take snap??
|
||||||
|
_pos = _line;
|
||||||
|
}
|
||||||
|
ofSetColor(255, 255, 255);
|
||||||
|
|
||||||
|
if(_dir == H) ofRect(_pos, 0, 50, ofGetHeight());
|
||||||
|
else if(_dir == V) ofRect(0, _pos, ofGetWidth(), 50);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
ofSetColor(255, 255, 255);
|
|
||||||
|
case STATE_SYNTHESISING:
|
||||||
if(_dir == H) ofRect(_pos, 0, 50, ofGetHeight());
|
{
|
||||||
else if(_dir == V) ofRect(0, _pos, ofGetWidth(), 50);
|
// display animation of something while the synthesis in on-going...
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case STATE_DISPLAY_RESULTS:
|
||||||
|
{
|
||||||
|
// display results of the synthesis
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -50,7 +50,8 @@ public:
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
void setup(int camWidth, int camHeight);
|
void setup(int camWidth, int camHeight);
|
||||||
void synthesize();
|
void acquire();
|
||||||
|
void synthesise();
|
||||||
void draw();
|
void draw();
|
||||||
|
|
||||||
void scan_cb(Poco::Timer& timer);
|
void scan_cb(Poco::Timer& timer);
|
||||||
|
|||||||
@ -1,108 +0,0 @@
|
|||||||
/*
|
|
||||||
- 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
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "StrobeAnalysis.h"
|
|
||||||
#include "ofMain.h"
|
|
||||||
|
|
||||||
#include "Poco/Timer.h"
|
|
||||||
#include "Poco/Thread.h"
|
|
||||||
#include "RefractiveIndex.h"
|
|
||||||
using Poco::Timer;
|
|
||||||
using Poco::TimerCallback;
|
|
||||||
using Poco::Thread;
|
|
||||||
|
|
||||||
#define STATE_STROBE 0
|
|
||||||
#define STATE_ANALYSIS 1
|
|
||||||
|
|
||||||
void StrobeAnalysis::setup(int camWidth, int camHeight)
|
|
||||||
{
|
|
||||||
create_dir();
|
|
||||||
}
|
|
||||||
|
|
||||||
void StrobeAnalysis::synthesize()
|
|
||||||
{
|
|
||||||
Timer strobe_timer(0, 70);
|
|
||||||
|
|
||||||
TimerCallback<StrobeAnalysis> strobe_callback(*this, &StrobeAnalysis::strobe_cb);
|
|
||||||
|
|
||||||
_state = STATE_STROBE;
|
|
||||||
_darkness = true;
|
|
||||||
_strobe_cnt = 0;
|
|
||||||
|
|
||||||
strobe_timer.start(strobe_callback);
|
|
||||||
|
|
||||||
while(_state != STATE_ANALYSIS)
|
|
||||||
Thread::sleep(5);
|
|
||||||
|
|
||||||
strobe_timer.stop();
|
|
||||||
|
|
||||||
// do analysis here
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
while(_state != STATE_STOP)
|
|
||||||
Thread::sleep(100);
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void StrobeAnalysis::draw()
|
|
||||||
{
|
|
||||||
if(_state == STATE_ANALYSIS) {
|
|
||||||
ofSetColor(0, 200, 0);
|
|
||||||
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(_darkness) {
|
|
||||||
ofSetColor(0, 0, 0);
|
|
||||||
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
|
||||||
} else {
|
|
||||||
ofSetColor(255, 255, 255);
|
|
||||||
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void StrobeAnalysis::strobe_cb(Timer& timer)
|
|
||||||
{
|
|
||||||
cout << "IResponseAnalysis::saving...\n";
|
|
||||||
_strobe_cnt++;
|
|
||||||
|
|
||||||
_darkness = !_darkness;
|
|
||||||
|
|
||||||
if(_strobe_cnt >= 20) {
|
|
||||||
_state = STATE_ANALYSIS;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,57 +0,0 @@
|
|||||||
/*
|
|
||||||
- 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
|
|
||||||
|
|
||||||
#include "AbstractAnalysis.h"
|
|
||||||
|
|
||||||
#include "Poco/Timer.h"
|
|
||||||
|
|
||||||
class StrobeAnalysis : public AbstractAnalysis
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
StrobeAnalysis(): AbstractAnalysis("STROBE"){;}
|
|
||||||
virtual ~StrobeAnalysis(){;}
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
void setup(int camWidth, int camHeight);
|
|
||||||
void synthesize();
|
|
||||||
void draw();
|
|
||||||
|
|
||||||
void strobe_cb(Poco::Timer& timer);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
int _strobe_cnt;
|
|
||||||
bool _darkness;
|
|
||||||
};
|
|
||||||
Loading…
x
Reference in New Issue
Block a user