2012-01-24 15:13:07 +01:00
|
|
|
/*
|
|
|
|
|
~ author: dviid
|
|
|
|
|
~ contact: dviid@labs.ciid.dk
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2012-02-11 18:54:46 +01:00
|
|
|
#include "ofMain.h"
|
|
|
|
|
#include "ofEvents.h"
|
2012-01-24 15:13:07 +01:00
|
|
|
#include <string>
|
|
|
|
|
|
|
|
|
|
#define ANALYSIS_PATH "analysis/"
|
2012-02-22 02:09:19 +01:00
|
|
|
#define SYNTHESIS_PATH "synthesis/"
|
2012-01-24 15:13:07 +01:00
|
|
|
|
2012-02-15 08:43:43 +01:00
|
|
|
#define STATE_ACQUIRING 0x1111
|
|
|
|
|
#define STATE_SYNTHESISING 0x2222
|
|
|
|
|
#define STATE_DISPLAY_RESULTS 0x3333
|
|
|
|
|
#define STATE_STOP 0xDEADBEEF
|
2012-01-24 15:13:07 +01:00
|
|
|
|
|
|
|
|
class AbstractAnalysis {
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
AbstractAnalysis(string name) : _name(name) {;}
|
|
|
|
|
virtual ~AbstractAnalysis(){;}
|
|
|
|
|
|
|
|
|
|
// generic function to set up the camera
|
2012-02-15 08:43:43 +01:00
|
|
|
virtual void setup(int camWidth, int camHeight){_cam_w = camWidth; _cam_h = camHeight;}
|
2012-02-22 02:09:19 +01:00
|
|
|
|
2012-02-15 08:43:43 +01:00
|
|
|
// this is the main threaded loop for a given analysis
|
2012-02-11 18:54:46 +01:00
|
|
|
void do_synthesize();
|
|
|
|
|
|
2012-02-22 02:09:19 +01:00
|
|
|
// show the results to the screen
|
2012-01-24 15:13:07 +01:00
|
|
|
virtual void draw() = 0;
|
2012-02-11 18:54:46 +01:00
|
|
|
|
|
|
|
|
protected:
|
2012-01-24 15:13:07 +01:00
|
|
|
|
2012-02-15 07:58:30 +01:00
|
|
|
virtual void create_dir();
|
2012-01-24 15:13:07 +01:00
|
|
|
|
2012-02-26 15:28:27 +01:00
|
|
|
virtual void saveimage(string filename);
|
|
|
|
|
|
2012-02-15 08:43:43 +01:00
|
|
|
// acquire images - all the children (see - do_synthesize)
|
|
|
|
|
virtual void acquire() = 0;
|
|
|
|
|
|
|
|
|
|
// analysis + synthesize images - all the children (see - do_synthesize)
|
|
|
|
|
virtual void synthesise() = 0;
|
|
|
|
|
|
2012-02-22 02:09:19 +01:00
|
|
|
// display the results from disk
|
|
|
|
|
virtual void displayresults() = 0;
|
2012-02-15 07:58:30 +01:00
|
|
|
|
2012-01-24 15:13:07 +01:00
|
|
|
public:
|
|
|
|
|
string _name;
|
2012-02-11 18:54:46 +01:00
|
|
|
|
2012-02-15 07:58:30 +01:00
|
|
|
// event
|
2012-02-11 18:54:46 +01:00
|
|
|
ofEvent<string> _synthesize_cb;
|
2012-01-24 15:13:07 +01:00
|
|
|
|
|
|
|
|
protected:
|
2012-02-15 08:43:43 +01:00
|
|
|
int _cam_w, _cam_h;
|
2012-02-22 02:09:19 +01:00
|
|
|
string _whole_file_path_analysis, _whole_file_path_synthesis;
|
|
|
|
|
vector<string> _saved_filenames_analysis;
|
|
|
|
|
vector<string> _saved_filenames_synthesis;
|
2012-02-15 08:43:43 +01:00
|
|
|
|
|
|
|
|
int _state;
|
|
|
|
|
|
2012-02-22 15:36:22 +01:00
|
|
|
//int _run_cnt;
|
|
|
|
|
|
2012-02-15 08:43:43 +01:00
|
|
|
float DELTA_T_SAVE;
|
|
|
|
|
int NUM_PHASE;
|
|
|
|
|
int NUM_RUN;
|
|
|
|
|
int NUM_SAVE_PER_RUN;
|
2012-02-12 09:39:36 +01:00
|
|
|
|
2012-01-24 15:13:07 +01:00
|
|
|
friend class AnalysisAdaptor;
|
|
|
|
|
};
|