Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 327830a581 | |||
| 877123a2db | |||
| feedecfe04 |
+39
-40
@@ -1,46 +1,45 @@
|
|||||||
<!-- THIS FILE NEEDS TO GO IN THE APPLICATION /data/ folder -->
|
<!-- THIS FILE NEEDS TO GO IN THE APPLICATION /data/ folder -->
|
||||||
|
|
||||||
<config>
|
<config>
|
||||||
<mode>drawing</mode>
|
<camera>
|
||||||
<camera>
|
<id>1</id>
|
||||||
<id>1</id>
|
<width>640</width>
|
||||||
<width>640</width>
|
<height>480</height>
|
||||||
<height>480</height>
|
</camera>
|
||||||
</camera>
|
<display>
|
||||||
<display>
|
<fps>30</fps>
|
||||||
<fps>30</fps>
|
</display>
|
||||||
</display>
|
<locale>
|
||||||
<locale>
|
<name>SWANSEA</name>
|
||||||
<name>SWANSEA</name>
|
</locale>
|
||||||
</locale>
|
|
||||||
|
|
||||||
<analysis_NUM_RUN>
|
<analysis_NUM_RUN>
|
||||||
<NUM_RUN_shadowscapes> 3 </NUM_RUN_shadowscapes>
|
<NUM_RUN_shadowscapes> 3 </NUM_RUN_shadowscapes>
|
||||||
<NUM_RUN_relaxrate> 3 </NUM_RUN_relaxrate>
|
<NUM_RUN_relaxrate> 3 </NUM_RUN_relaxrate>
|
||||||
<NUM_RUN_iresponse> 3 </NUM_RUN_iresponse>
|
<NUM_RUN_iresponse> 3 </NUM_RUN_iresponse>
|
||||||
<NUM_RUN_shapefromshading> 3 </NUM_RUN_shapefromshading>
|
<NUM_RUN_shapefromshading> 3 </NUM_RUN_shapefromshading>
|
||||||
<NUM_RUN_strobe> 5 </NUM_RUN_strobe>
|
<NUM_RUN_strobe> 5 </NUM_RUN_strobe>
|
||||||
<NUM_RUN_camnoise> 5 </NUM_RUN_camnoise>
|
<NUM_RUN_camnoise> 5 </NUM_RUN_camnoise>
|
||||||
<NUM_RUN_colorsingle> 5 </NUM_RUN_colorsingle>
|
<NUM_RUN_colorsingle> 5 </NUM_RUN_colorsingle>
|
||||||
<NUM_RUN_colormulti> 5 </NUM_RUN_colormulti>
|
<NUM_RUN_colormulti> 5 </NUM_RUN_colormulti>
|
||||||
<NUM_RUN_diffnoise> 3 </NUM_RUN_diffnoise>
|
<NUM_RUN_diffnoise> 3 </NUM_RUN_diffnoise>
|
||||||
</analysis_NUM_RUN>
|
</analysis_NUM_RUN>
|
||||||
|
|
||||||
|
<analysis_time>
|
||||||
|
<acquiretime_shadowscapes> 30 </acquiretime_shadowscapes>
|
||||||
|
<acquiretime_relaxrate> 30 </acquiretime_relaxrate>
|
||||||
|
<acquiretime_iresponse> 30 </acquiretime_iresponse>
|
||||||
|
<acquiretime_shapefromshading> 30 </acquiretime_shapefromshading>
|
||||||
|
<acquiretime_strobe> 30 </acquiretime_strobe>
|
||||||
|
<acquiretime_camnoise> 30 </acquiretime_camnoise>
|
||||||
|
<acquiretime_colorsingle> 40 </acquiretime_colorsingle>
|
||||||
|
<acquiretime_colormulti> 40 </acquiretime_colormulti>
|
||||||
|
<acquiretime_diffnoise> 30 </acquiretime_diffnoise>
|
||||||
|
</analysis_time>
|
||||||
|
|
||||||
|
<relaxrate>
|
||||||
|
<threshold>51</threshold>
|
||||||
|
<maxblobs>25</maxblobs>
|
||||||
|
</relaxrate>
|
||||||
|
|
||||||
<analysis_time>
|
|
||||||
<acquiretime_shadowscapes> 30 </acquiretime_shadowscapes>
|
|
||||||
<acquiretime_relaxrate> 30 </acquiretime_relaxrate>
|
|
||||||
<acquiretime_iresponse> 30 </acquiretime_iresponse>
|
|
||||||
<acquiretime_shapefromshading> 30 </acquiretime_shapefromshading>
|
|
||||||
<acquiretime_strobe> 30 </acquiretime_strobe>
|
|
||||||
<acquiretime_camnoise> 30 </acquiretime_camnoise>
|
|
||||||
<acquiretime_colorsingle> 40 </acquiretime_colorsingle>
|
|
||||||
<acquiretime_colormulti> 40 </acquiretime_colormulti>
|
|
||||||
<acquiretime_diffnoise> 30 </acquiretime_diffnoise>
|
|
||||||
</analysis_time>
|
|
||||||
|
|
||||||
<relaxrate>
|
|
||||||
<treshold>51</treshold>
|
|
||||||
<maxblobs>25</maxblobs>
|
|
||||||
</relaxrate>
|
|
||||||
|
|
||||||
</config>
|
</config>
|
||||||
+48
-48
@@ -55,7 +55,7 @@ void RefractiveIndex::setup()
|
|||||||
// <mode>
|
// <mode>
|
||||||
string m = XML.getValue("config:mode", "analysing");
|
string m = XML.getValue("config:mode", "analysing");
|
||||||
_mode = (m == "analysing" ? MODE_ANALYSING : (m == "drawing" ? MODE_DRAWING : MODE_ANALYSING));
|
_mode = (m == "analysing" ? MODE_ANALYSING : (m == "drawing" ? MODE_DRAWING : MODE_ANALYSING));
|
||||||
|
|
||||||
// <camera>
|
// <camera>
|
||||||
_vid_id = XML.getValue("config:camera:id", CAMERA_ID);
|
_vid_id = XML.getValue("config:camera:id", CAMERA_ID);
|
||||||
cout << "_vid_id: " << _vid_id << endl;
|
cout << "_vid_id: " << _vid_id << endl;
|
||||||
@@ -65,12 +65,12 @@ void RefractiveIndex::setup()
|
|||||||
|
|
||||||
// <display>
|
// <display>
|
||||||
int fps = XML.getValue("config:display:fps", 30);
|
int fps = XML.getValue("config:display:fps", 30);
|
||||||
|
|
||||||
// <location>
|
// <location>
|
||||||
_location = XML.getValue("config:locale:name", LOCATION);
|
_location = XML.getValue("config:locale:name", LOCATION);
|
||||||
|
|
||||||
cout << "Configuring..." << endl;
|
cout << "Configuring..." << endl;
|
||||||
|
|
||||||
// display
|
// display
|
||||||
cout << "> display" << endl;
|
cout << "> display" << endl;
|
||||||
ofSetFrameRate(fps);
|
ofSetFrameRate(fps);
|
||||||
@@ -94,9 +94,9 @@ void RefractiveIndex::setup()
|
|||||||
}
|
}
|
||||||
|
|
||||||
cout << "RRRRRREADY!" << endl;
|
cout << "RRRRRREADY!" << endl;
|
||||||
|
|
||||||
_analysisAdapator = NULL;
|
_analysisAdapator = NULL;
|
||||||
|
|
||||||
//getting a warning from the OFlog that the pixels aren't allocated
|
//getting a warning from the OFlog that the pixels aren't allocated
|
||||||
//void ofPixels::allocate(int w, int h, ofImageType type)
|
//void ofPixels::allocate(int w, int h, ofImageType type)
|
||||||
_pixels.allocate(_vid_w, _vid_h, OF_IMAGE_COLOR);
|
_pixels.allocate(_vid_w, _vid_h, OF_IMAGE_COLOR);
|
||||||
@@ -107,7 +107,7 @@ void RefractiveIndex::setup()
|
|||||||
_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());
|
||||||
|
|
||||||
|
|
||||||
@@ -125,7 +125,7 @@ void RefractiveIndex::setup()
|
|||||||
|
|
||||||
_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;
|
||||||
@@ -210,7 +210,7 @@ void RefractiveIndex::draw()
|
|||||||
|
|
||||||
// black
|
// black
|
||||||
ofBackground(0, 0, 0);
|
ofBackground(0, 0, 0);
|
||||||
|
|
||||||
if(_currentAnalysis)
|
if(_currentAnalysis)
|
||||||
_currentAnalysis->draw();
|
_currentAnalysis->draw();
|
||||||
}
|
}
|
||||||
@@ -271,7 +271,7 @@ void RefractiveIndex::keyPressed (int key)
|
|||||||
if(!_currentAnalysis)
|
if(!_currentAnalysis)
|
||||||
_state = ISTATE_TRANSITION;
|
_state = ISTATE_TRANSITION;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(key == '2')
|
else if(key == '2')
|
||||||
{
|
{
|
||||||
if(_currentAnalysis)
|
if(_currentAnalysis)
|
||||||
@@ -280,7 +280,7 @@ void RefractiveIndex::keyPressed (int key)
|
|||||||
if(!_currentAnalysis)
|
if(!_currentAnalysis)
|
||||||
_state = ISTATE_TRANSITION;
|
_state = ISTATE_TRANSITION;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(key == '3')
|
else if(key == '3')
|
||||||
{
|
{
|
||||||
if(_currentAnalysis)
|
if(_currentAnalysis)
|
||||||
@@ -352,7 +352,7 @@ void RefractiveIndex::keyPressed (int key)
|
|||||||
if(!_currentAnalysis)
|
if(!_currentAnalysis)
|
||||||
_state = ISTATE_TRANSITION;
|
_state = ISTATE_TRANSITION;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(key == 'q')
|
else if(key == 'q')
|
||||||
{
|
{
|
||||||
if(_currentAnalysis)
|
if(_currentAnalysis)
|
||||||
@@ -366,42 +366,42 @@ void RefractiveIndex::keyPressed (int key)
|
|||||||
TO DO: add a file dialog so we can save images to another hard drive...
|
TO DO: add a file dialog so we can save images to another hard drive...
|
||||||
e.g.: http://dev.openframeworks.cc/pipermail/of-dev-openframeworks.cc/2011-April/003125.html
|
e.g.: http://dev.openframeworks.cc/pipermail/of-dev-openframeworks.cc/2011-April/003125.html
|
||||||
|
|
||||||
>> case 's':
|
>> case 's':
|
||||||
>> doSave ^= true;
|
>> doSave ^= true;
|
||||||
>> doLoad = false;
|
>> doLoad = false;
|
||||||
>> if(doSave) {
|
>> if(doSave) {
|
||||||
>> ofFileDialogResult r = ofSystemLoadDialog("Select path to save to", true);
|
>> ofFileDialogResult r = ofSystemLoadDialog("Select path to save to", true);
|
||||||
>> if(r.bSuccess) {
|
>> if(r.bSuccess) {
|
||||||
>> saveCounter = 0;
|
>> saveCounter = 0;
|
||||||
>> savePath = r.getPath();
|
>> savePath = r.getPath();
|
||||||
>> ofDirectory::createDirectory(savePath + "/color/");
|
>> ofDirectory::createDirectory(savePath + "/color/");
|
||||||
>> ofDirectory::createDirectory(savePath + "/depth/");
|
>> ofDirectory::createDirectory(savePath + "/depth/");
|
||||||
>> printf("SAVE %s %s\n", r.getPath().c_str(), r.getName().c_str());
|
>> printf("SAVE %s %s\n", r.getPath().c_str(), r.getName().c_str());
|
||||||
>> } else {
|
>> } else {
|
||||||
>> doSave = false;
|
>> doSave = false;
|
||||||
>> }
|
>> }
|
||||||
>>
|
>>
|
||||||
>> }
|
>> }
|
||||||
>> break;
|
>> break;
|
||||||
>>
|
>>
|
||||||
>> case 'l':
|
>> case 'l':
|
||||||
>> doLoad ^= true;
|
>> doLoad ^= true;
|
||||||
>> doSave = false;
|
>> doSave = false;
|
||||||
>> if(doLoad) {
|
>> if(doLoad) {
|
||||||
>> ofFileDialogResult r = ofSystemLoadDialog("Select path to load from", true);
|
>> ofFileDialogResult r = ofSystemLoadDialog("Select path to load from", true);
|
||||||
>> if(r.bSuccess) {
|
>> if(r.bSuccess) {
|
||||||
>> loadCounter = 0;
|
>> loadCounter = 0;
|
||||||
>> loadPath = r.getPath();
|
>> loadPath = r.getPath();
|
||||||
>> ofDirectory dir;
|
>> ofDirectory dir;
|
||||||
>> loadMaxFiles = MAX(dir.listDir(loadPath + "/color"), dir.listDir(loadPath + "/depth"));
|
>> loadMaxFiles = MAX(dir.listDir(loadPath + "/color"), dir.listDir(loadPath + "/depth"));
|
||||||
>> printf("LOAD %i %s %s\n", loadMaxFiles, r.getPath().c_str(), r.getName().c_str());
|
>> printf("LOAD %i %s %s\n", loadMaxFiles, r.getPath().c_str(), r.getName().c_str());
|
||||||
>> } else {
|
>> } else {
|
||||||
>> doLoad = false;
|
>> doLoad = false;
|
||||||
>> }
|
>> }
|
||||||
>>
|
>>
|
||||||
>> }
|
>> }
|
||||||
>> break;
|
>> break;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-110
@@ -3,72 +3,31 @@
|
|||||||
#include "AbstractAnalysis.h"
|
#include "AbstractAnalysis.h"
|
||||||
#include "RefractiveIndex.h"
|
#include "RefractiveIndex.h"
|
||||||
#include "ofxFileHelper.h"
|
#include "ofxFileHelper.h"
|
||||||
#include "ofSystemUtils.h"
|
|
||||||
|
|
||||||
void AbstractAnalysis::setup(int camWidth, int camHeight) {
|
|
||||||
|
|
||||||
_cam_w = camWidth; _cam_h = camHeight;
|
|
||||||
|
|
||||||
if(RefractiveIndex::_mode == MODE_DRAWING) {
|
|
||||||
ofFileDialogResult r = ofSystemLoadDialog("choooose da folda", true);
|
|
||||||
if(!r.bSuccess) {
|
|
||||||
ofSystemAlertDialog("OOOOPS.... ERROR...");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_whole_file_path_analysis = r.filePath;
|
|
||||||
_whole_file_path_synthesis = r.filePath + "/darwings";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// this is the main threaded loop for a given analysis
|
// this is the main threaded loop for a given analysis
|
||||||
void AbstractAnalysis::do_synthesize() {
|
void AbstractAnalysis::do_synthesize() {
|
||||||
|
|
||||||
switch(RefractiveIndex::_mode)
|
for(int i = 0; i < NUM_RUN; i++) {
|
||||||
{
|
|
||||||
case MODE_ANALYSING:
|
cout << "NUM_RUN: " << i << endl;
|
||||||
{
|
|
||||||
for(int i = 0; i < NUM_RUN; i++) {
|
|
||||||
|
|
||||||
cout << "NUM_RUN: " << i << endl;
|
_saved_filenames_analysis.clear();
|
||||||
|
_saved_filenames_synthesis.clear();
|
||||||
_saved_filenames_analysis.clear();
|
|
||||||
_saved_filenames_synthesis.clear();
|
_state = STATE_ACQUIRING;
|
||||||
|
acquire();
|
||||||
_state = STATE_ACQUIRING;
|
if(_state == STATE_STOP) goto exit;
|
||||||
acquire();
|
_state = STATE_SYNTHESISING;
|
||||||
if(_state == STATE_STOP) goto exit;
|
synthesise();
|
||||||
_state = STATE_SYNTHESISING;
|
if(_state == STATE_STOP) goto exit;
|
||||||
synthesise();
|
_state = STATE_DISPLAY_RESULTS;
|
||||||
if(_state == STATE_STOP) goto exit;
|
displayresults();
|
||||||
_state = STATE_DISPLAY_RESULTS;
|
cleanup();
|
||||||
displayresults();
|
|
||||||
cleanup();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
case MODE_DRAWING:
|
|
||||||
{
|
|
||||||
ofxFileHelper fileHelperDrawing;
|
|
||||||
if(!fileHelperDrawing.doesDirectoryExist(_whole_file_path_synthesis)){
|
|
||||||
fileHelperDrawing.makeDirectory(_whole_file_path_synthesis);
|
|
||||||
}
|
|
||||||
|
|
||||||
read_dir_create_list(_whole_file_path_analysis);
|
|
||||||
_state = STATE_SYNTHESISING;
|
|
||||||
synthesise();
|
|
||||||
if(_state == STATE_STOP) goto exit;
|
|
||||||
_state = STATE_DISPLAY_RESULTS;
|
|
||||||
displayresults();
|
|
||||||
cleanup();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
cleanup();
|
cleanup();
|
||||||
ofNotifyEvent(_synthesize_cb, _name);
|
ofNotifyEvent(_synthesize_cb, _name);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractAnalysis::create_dir_allocate_images()
|
void AbstractAnalysis::create_dir_allocate_images()
|
||||||
@@ -157,57 +116,6 @@ void AbstractAnalysis::create_dir_allocate_images()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool cmp_file(string f0, string f1)
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
int v0 = atoi(f0.substr(0, f0.find("_")).c_str());
|
|
||||||
|
|
||||||
int v1 = atoi(f1.substr(0, f1.find("_")).c_str());
|
|
||||||
|
|
||||||
return v0 < v1;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void AbstractAnalysis::read_dir_create_list(string folder_path)
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
File dir(folder_path);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(dir.exists() && dir.isDirectory()) {
|
|
||||||
|
|
||||||
vector<string> list;
|
|
||||||
|
|
||||||
dir.list(list);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
std::sort(list.begin(), list.end(), cmp_file);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for(int i = 0; i < list.size(); i++) {
|
|
||||||
|
|
||||||
string filepath = folder_path + "/" + list[i];
|
|
||||||
|
|
||||||
_saved_filenames_analysis.push_back(filepath);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void AbstractAnalysis::saveImageAnalysis(string filename)
|
void AbstractAnalysis::saveImageAnalysis(string filename)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -272,7 +180,6 @@ void AbstractAnalysis::saveImageSynthesis(string filename, ofxCvImage* newPixels
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
_saved_filenames_synthesis.push_back(_whole_file_path_synthesis+"/"+filename);
|
_saved_filenames_synthesis.push_back(_whole_file_path_synthesis+"/"+filename);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ 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);
|
virtual void setup(int camWidth, int camHeight){_cam_w = camWidth; _cam_h = camHeight;}
|
||||||
|
|
||||||
// this is the main threaded loop for a given analysis
|
// this is the main threaded loop for a given analysis
|
||||||
void do_synthesize();
|
void do_synthesize();
|
||||||
@@ -37,8 +37,6 @@ protected:
|
|||||||
|
|
||||||
virtual void create_dir_allocate_images();
|
virtual void create_dir_allocate_images();
|
||||||
|
|
||||||
virtual void read_dir_create_list(string folder_path);
|
|
||||||
|
|
||||||
virtual void saveImageAnalysis(string filename);
|
virtual void saveImageAnalysis(string filename);
|
||||||
virtual void saveImageSynthesis(string filename, ofxCvImage* newPixels, ofImageType newType);
|
virtual void saveImageSynthesis(string filename, ofxCvImage* newPixels, ofImageType newType);
|
||||||
|
|
||||||
@@ -56,8 +54,7 @@ protected:
|
|||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
string _name;
|
string _name;
|
||||||
string _draw_directory;
|
|
||||||
|
|
||||||
// event
|
// event
|
||||||
ofEvent<string> _synthesize_cb;
|
ofEvent<string> _synthesize_cb;
|
||||||
|
|||||||
@@ -15,8 +15,6 @@ using Poco::Thread;
|
|||||||
|
|
||||||
void CamNoiseAnalysis::setup(int camWidth, int camHeight)
|
void CamNoiseAnalysis::setup(int camWidth, int camHeight)
|
||||||
{
|
{
|
||||||
AbstractAnalysis::setup(camWidth, camHeight);
|
|
||||||
|
|
||||||
NUM_RUN = RefractiveIndex::XML.getValue("config:analysis_NUM_RUN:NUM_RUN_camnoise", NUMBER_RUNS);
|
NUM_RUN = RefractiveIndex::XML.getValue("config:analysis_NUM_RUN:NUM_RUN_camnoise", NUMBER_RUNS);
|
||||||
cout << "NUM_RUN CamNoiseAnalysis " << NUM_RUN << endl;
|
cout << "NUM_RUN CamNoiseAnalysis " << NUM_RUN << endl;
|
||||||
//NUM_RUN = 5;
|
//NUM_RUN = 5;
|
||||||
|
|||||||
@@ -14,8 +14,6 @@ using Poco::Thread;
|
|||||||
|
|
||||||
void ColorMultiAnalysis::setup(int camWidth, int camHeight)
|
void ColorMultiAnalysis::setup(int camWidth, int camHeight)
|
||||||
{
|
{
|
||||||
AbstractAnalysis::setup(camWidth, camHeight);
|
|
||||||
|
|
||||||
NUM_RUN = RefractiveIndex::XML.getValue("config:analysis_NUM_RUN:NUM_RUN_colormulti", NUMBER_RUNS);
|
NUM_RUN = RefractiveIndex::XML.getValue("config:analysis_NUM_RUN:NUM_RUN_colormulti", NUMBER_RUNS);
|
||||||
cout << "NUM_RUN ColorMultiAnalysis " << NUM_RUN << endl;
|
cout << "NUM_RUN ColorMultiAnalysis " << NUM_RUN << endl;
|
||||||
//NUM_RUN = 5;
|
//NUM_RUN = 5;
|
||||||
@@ -248,8 +246,6 @@ void ColorMultiAnalysis::draw()
|
|||||||
//cout << "FADING IN..." << endl;
|
//cout << "FADING IN..." << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (_frame_cnt >= _fade_in_frames && _frame_cnt < _frame_cnt_max-_fade_in_frames){
|
if (_frame_cnt >= _fade_in_frames && _frame_cnt < _frame_cnt_max-_fade_in_frames){
|
||||||
|
|
||||||
aColor.setHsb(c, 255, 255);
|
aColor.setHsb(c, 255, 255);
|
||||||
|
|||||||
+221
-76
@@ -15,8 +15,6 @@ using Poco::Thread;
|
|||||||
|
|
||||||
void ColorSingleAnalysis::setup(int camWidth, int camHeight)
|
void ColorSingleAnalysis::setup(int camWidth, int camHeight)
|
||||||
{
|
{
|
||||||
AbstractAnalysis::setup(camWidth, camHeight);
|
|
||||||
|
|
||||||
NUM_RUN = RefractiveIndex::XML.getValue("config:analysis_NUM_RUN:NUM_RUN_colorsingle", NUMBER_RUNS);
|
NUM_RUN = RefractiveIndex::XML.getValue("config:analysis_NUM_RUN:NUM_RUN_colorsingle", NUMBER_RUNS);
|
||||||
cout << "NUM_RUN ColorSingleAnalysis " << NUM_RUN << endl;
|
cout << "NUM_RUN ColorSingleAnalysis " << NUM_RUN << endl;
|
||||||
//NUM_RUN = 5;
|
//NUM_RUN = 5;
|
||||||
@@ -24,11 +22,11 @@ void ColorSingleAnalysis::setup(int camWidth, int camHeight)
|
|||||||
int acq_run_time; // 10 seconds of acquiring per run
|
int acq_run_time; // 10 seconds of acquiring per run
|
||||||
acq_run_time = RefractiveIndex::XML.getValue("config:analysis_time:acquiretime_colorsingle", ACQUIRE_TIME);
|
acq_run_time = RefractiveIndex::XML.getValue("config:analysis_time:acquiretime_colorsingle", ACQUIRE_TIME);
|
||||||
cout << "ACQUIRE_TIME ColorSingleAnalysis " << acq_run_time << endl;
|
cout << "ACQUIRE_TIME ColorSingleAnalysis " << acq_run_time << endl;
|
||||||
|
|
||||||
//int acq_run_time = 25; // 20 seconds of acquiring per run
|
//int acq_run_time = 25; // 20 seconds of acquiring per run
|
||||||
|
|
||||||
DELTA_T_SAVE = 1*(10*acq_run_time/2); // for 20 seconds, we want this to be around 200 files
|
DELTA_T_SAVE = 1*(10*acq_run_time/2); // for 20 seconds, we want this to be around 200 files
|
||||||
// or 10 times per second = every 100 ms
|
// 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
|
_frame_cnt_max = acq_run_time*ofGetFrameRate(); // e.g.: 30 frames per second * 20 seconds = 600 frames
|
||||||
|
|
||||||
@@ -47,7 +45,7 @@ void ColorSingleAnalysis::setup(int camWidth, int camHeight)
|
|||||||
b = 0;
|
b = 0;
|
||||||
|
|
||||||
fileNameTag = "";
|
fileNameTag = "";
|
||||||
|
|
||||||
_show_image = false;
|
_show_image = false;
|
||||||
_image_shown = false;
|
_image_shown = false;
|
||||||
|
|
||||||
@@ -103,11 +101,11 @@ void ColorSingleAnalysis::setup(int camWidth, int camHeight)
|
|||||||
|
|
||||||
void ColorSingleAnalysis::acquire()
|
void ColorSingleAnalysis::acquire()
|
||||||
{
|
{
|
||||||
|
|
||||||
Timer* save_timer;
|
Timer* save_timer;
|
||||||
|
|
||||||
TimerCallback<ColorSingleAnalysis> save_callback(*this, &ColorSingleAnalysis::save_cb);
|
TimerCallback<ColorSingleAnalysis> save_callback(*this, &ColorSingleAnalysis::save_cb);
|
||||||
|
|
||||||
_run_cnt++;
|
_run_cnt++;
|
||||||
_frame_cnt = 0; _save_cnt = 0; _anim_cnt = 0, _synth_save_cnt = 0;
|
_frame_cnt = 0; _save_cnt = 0; _anim_cnt = 0, _synth_save_cnt = 0;
|
||||||
_RUN_DONE = false;
|
_RUN_DONE = false;
|
||||||
@@ -115,18 +113,17 @@ void ColorSingleAnalysis::acquire()
|
|||||||
|
|
||||||
// RUN ROUTINE
|
// RUN ROUTINE
|
||||||
//for(int i = 0; i < NUM_RUN; i++) {
|
//for(int i = 0; i < NUM_RUN; i++) {
|
||||||
// _run_cnt = i;
|
// _run_cnt = i;
|
||||||
//cout << "RUN NUM = " << i;
|
//cout << "RUN NUM = " << i;
|
||||||
|
|
||||||
save_timer = new Timer(0, DELTA_T_SAVE); // timing interval for saving files
|
save_timer = new Timer(0, DELTA_T_SAVE); // timing interval for saving files
|
||||||
save_timer->start(save_callback);
|
save_timer->start(save_callback);
|
||||||
|
|
||||||
while(!_RUN_DONE && _state != STATE_STOP)
|
while(!_RUN_DONE && _state != STATE_STOP)
|
||||||
Thread::sleep(3);
|
Thread::sleep(3);
|
||||||
|
|
||||||
save_timer->stop();
|
save_timer->stop();
|
||||||
|
|
||||||
|
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,13 +134,105 @@ void ColorSingleAnalysis::synthesise()
|
|||||||
if(_state == STATE_STOP) return;
|
if(_state == STATE_STOP) return;
|
||||||
|
|
||||||
for(float i=1;i<_saved_filenames_analysis.size()-1;i++){
|
for(float i=1;i<_saved_filenames_analysis.size()-1;i++){
|
||||||
|
|
||||||
//cout << "ColorSingleAnalysis::synthesis FOR LOOP...\n";
|
//cout << "ColorSingleAnalysis::synthesis FOR LOOP...\n";
|
||||||
|
|
||||||
//cout << "_saved_filenames_analysis[i]" << _saved_filenames_analysis[i] << endl;
|
//cout << "_saved_filenames_analysis[i]" << _saved_filenames_analysis[i] << endl;
|
||||||
|
|
||||||
if(_state == STATE_STOP) return;
|
if(_state == STATE_STOP) return;
|
||||||
|
|
||||||
|
image1.loadImage("Mar_02_19_00_47_2/194_9.72_1.jpg");
|
||||||
|
image1.resize(image1.width/20, image1.height/20);
|
||||||
|
|
||||||
|
int width = image1.width;
|
||||||
|
int height = image1.height;
|
||||||
|
|
||||||
|
// get the pixels from the image
|
||||||
|
imagePixels = image1.getPixels();
|
||||||
|
|
||||||
|
// ------------------- create the vector field ------------------------------------
|
||||||
|
|
||||||
|
vectorCount = width * height;
|
||||||
|
|
||||||
|
// create a 2d vector field
|
||||||
|
vectorField = new ofVec2f[vectorCount];
|
||||||
|
|
||||||
|
// set all values in vector field to 0.0
|
||||||
|
for(int i=0; i<vectorCount; i++){
|
||||||
|
|
||||||
|
vectorField[i].x = 0.0;
|
||||||
|
vectorField[i].y = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ------------------- calculate the vectors ------------------------------------
|
||||||
|
|
||||||
|
// loop through all of the pixels
|
||||||
|
for(int x=1; x< width-1; x++){
|
||||||
|
for(int y=1; y< height-1; y++){
|
||||||
|
|
||||||
|
char areaPixels[9];
|
||||||
|
|
||||||
|
// loop through the area pixels
|
||||||
|
for(int i=-1; i<=1; i++){
|
||||||
|
for(int j=-1; j<=1; j++){
|
||||||
|
|
||||||
|
// determine where to read from in the area (not optimized)
|
||||||
|
int readPos = ((y + j) * width + (x + i)) * 3;
|
||||||
|
|
||||||
|
unsigned char R = imagePixels[readPos];
|
||||||
|
unsigned char G = imagePixels[readPos+1];
|
||||||
|
unsigned char B = imagePixels[readPos+2];
|
||||||
|
|
||||||
|
unsigned char BR = (0.299 * R) + (.587 * G) + (.114 * B);
|
||||||
|
|
||||||
|
int writePos = (j+1) * 3 + (i + 1);
|
||||||
|
|
||||||
|
areaPixels[writePos] = BR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
float dX = (areaPixels[0] + areaPixels[3] + areaPixels[6])/3 - (areaPixels[2] + areaPixels[5] + areaPixels[8])/3;
|
||||||
|
float dY = (areaPixels[0] + areaPixels[1] + areaPixels[2])/3 - (areaPixels[6] + areaPixels[7] + areaPixels[8])/3;
|
||||||
|
|
||||||
|
int vectorPos = y * width + x;
|
||||||
|
|
||||||
|
//printf("dx %f\n", dX);
|
||||||
|
|
||||||
|
vectorField[vectorPos].x = dX;
|
||||||
|
vectorField[vectorPos].y = dY;
|
||||||
|
|
||||||
|
//vectorField[vectorPos].x = -dY;
|
||||||
|
//vectorField[vectorPos].y = dX;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// ------------------- normalize the vectors ------------------------------------
|
||||||
|
|
||||||
|
// variables for the maximum magnitude (absolute) in x and y
|
||||||
|
float maxMagX = 1.0;
|
||||||
|
float maxMagY = 1.0;
|
||||||
|
|
||||||
|
// loop through the vector field to find the maximum x and y values
|
||||||
|
for(int i=0; i< vectorCount; i++){
|
||||||
|
|
||||||
|
if(fabs(vectorField[i].x) > maxMagX) maxMagX = fabs(vectorField[i].x);
|
||||||
|
if(fabs(vectorField[i].y) > maxMagY) maxMagY = fabs(vectorField[i].y);
|
||||||
|
}
|
||||||
|
|
||||||
|
// loop through the vector field to normalize the values
|
||||||
|
for(int i=0; i< vectorCount; i++){
|
||||||
|
|
||||||
|
vectorField[i].x /= maxMagX;
|
||||||
|
vectorField[i].y /= maxMagY;
|
||||||
|
}
|
||||||
|
|
||||||
|
// COMMENTING OUT THE FILLER SYNTH ALGORITHM
|
||||||
|
/*
|
||||||
if(!image1.loadImage(_saved_filenames_analysis[i])){
|
if(!image1.loadImage(_saved_filenames_analysis[i])){
|
||||||
//couldn't load image
|
//couldn't load image
|
||||||
cout << "didn't load image" << endl;
|
cout << "didn't load image" << endl;
|
||||||
@@ -152,51 +241,54 @@ void ColorSingleAnalysis::synthesise()
|
|||||||
if(image1.loadImage(_saved_filenames_analysis[i])){
|
if(image1.loadImage(_saved_filenames_analysis[i])){
|
||||||
//cout << "LOADED image1!!!" << endl;
|
//cout << "LOADED image1!!!" << endl;
|
||||||
//if(image5.loadImage(_saved_filenames_analysis[i+1])){
|
//if(image5.loadImage(_saved_filenames_analysis[i+1])){
|
||||||
|
|
||||||
|
///////////////////////// PROCESS THE SAVED CAMERA IMAGES OF SHIT TO THE IMAGES //////////////////////////
|
||||||
|
|
||||||
|
cvColorImage1.setFromPixels(image1.getPixels(), image1.width, image1.height);
|
||||||
|
//cvColorImage2.setFromPixels(image5.getPixels(), image5.width, image5.height);
|
||||||
|
|
||||||
|
cvColorImage1.blur(5);
|
||||||
|
cvColorImage1.erode();
|
||||||
|
cvColorImage1.erode();
|
||||||
|
cvColorImage1.dilate();
|
||||||
|
cvColorImage1.blur(5);
|
||||||
|
cvColorImage1.erode();
|
||||||
|
cvColorImage1.erode();
|
||||||
|
cvColorImage1.erode();
|
||||||
|
cvColorImage1.erode();
|
||||||
|
|
||||||
///////////////////////// PROCESS THE SAVED CAMERA IMAGES OF SHIT TO THE IMAGES //////////////////////////
|
/////////////////////////////////// SAVE TO DISK IN THE SYNTHESIS FOLDER ////////////////////////////////
|
||||||
|
string file_name;
|
||||||
|
|
||||||
|
file_name = ofToString(_synth_save_cnt, 2)+"_ColorSingleAnalysis_"+ofToString(_run_cnt,2)+".jpg";
|
||||||
|
|
||||||
|
|
||||||
|
//<---- THE OLD WAY OF SAVING - works on OSX but generates BLACK FRAMES on WINDOWS ---->
|
||||||
|
// ofSaveImage(cvGrayImage1.getPixelsRef(),_whole_file_path_synthesis+"/"+file_name, OF_IMAGE_QUALITY_BEST);
|
||||||
|
|
||||||
|
|
||||||
|
//<---- NEW SAVING - seems to fix WINDOWS saving out BLACK FRAMES PROBLEM ---->
|
||||||
|
//ofImage image;
|
||||||
|
//image.allocate(cvColorImage1.width, cvColorImage1.height, OF_IMAGE_COLOR);
|
||||||
|
|
||||||
|
// This needs to be here for OSX of we get a BAD ACCESS ERROR. DOES IT BREAK WINDOWS?
|
||||||
|
//image.setUseTexture(false);
|
||||||
|
|
||||||
|
//image.setFromPixels(cvColorImage1.getPixels(), cvColorImage1.width, cvColorImage1.height,OF_IMAGE_COLOR);
|
||||||
|
//image.saveImage(_whole_file_path_synthesis+"/"+file_name);
|
||||||
|
|
||||||
cvColorImage1.setFromPixels(image1.getPixels(), image1.width, image1.height);
|
//_saved_filenames_synthesis.push_back(_whole_file_path_synthesis+"/"+file_name);
|
||||||
//cvColorImage2.setFromPixels(image5.getPixels(), image5.width, image5.height);
|
|
||||||
|
// <--- REALLY NEW SAVING METHOD --- 26 feb 2012 --- consolidated the save function into Abstract Analysis> ///
|
||||||
|
|
||||||
cvColorImage1.blur(5);
|
saveImageSynthesis(file_name, &cvColorImage1, OF_IMAGE_COLOR);
|
||||||
cvColorImage1.erode();
|
_synth_save_cnt++;
|
||||||
cvColorImage1.erode();
|
|
||||||
cvColorImage1.dilate();
|
// }
|
||||||
cvColorImage1.blur(5);
|
|
||||||
cvColorImage1.erode();
|
}
|
||||||
cvColorImage1.erode();
|
*/
|
||||||
cvColorImage1.erode();
|
|
||||||
cvColorImage1.erode();
|
|
||||||
|
|
||||||
/////////////////////////////////// SAVE TO DISK IN THE SYNTHESIS FOLDER ////////////////////////////////
|
|
||||||
string file_name;
|
|
||||||
|
|
||||||
file_name = ofToString(_synth_save_cnt, 2)+"_ColorSingleAnalysis_"+ofToString(_run_cnt,2)+".jpg";
|
|
||||||
|
|
||||||
|
|
||||||
//<---- THE OLD WAY OF SAVING - works on OSX but generates BLACK FRAMES on WINDOWS ---->
|
|
||||||
// ofSaveImage(cvGrayImage1.getPixelsRef(),_whole_file_path_synthesis+"/"+file_name, OF_IMAGE_QUALITY_BEST);
|
|
||||||
|
|
||||||
|
|
||||||
//<---- NEW SAVING - seems to fix WINDOWS saving out BLACK FRAMES PROBLEM ---->
|
|
||||||
//ofImage image;
|
|
||||||
//image.allocate(cvColorImage1.width, cvColorImage1.height, OF_IMAGE_COLOR);
|
|
||||||
|
|
||||||
//*** This needs to be here for OSX of we get a BAD ACCESS ERROR. DOES IT BREAK WINDOWS? ***//
|
|
||||||
//image.setUseTexture(false);
|
|
||||||
|
|
||||||
//image.setFromPixels(cvColorImage1.getPixels(), cvColorImage1.width, cvColorImage1.height,OF_IMAGE_COLOR);
|
|
||||||
//image.saveImage(_whole_file_path_synthesis+"/"+file_name);
|
|
||||||
|
|
||||||
//_saved_filenames_synthesis.push_back(_whole_file_path_synthesis+"/"+file_name);
|
|
||||||
|
|
||||||
// <--- REALLY NEW SAVING METHOD --- 26 feb 2012 --- consolidated the save function into Abstract Analysis> ///
|
|
||||||
|
|
||||||
saveImageSynthesis(file_name, &cvColorImage1, OF_IMAGE_COLOR);
|
|
||||||
_synth_save_cnt++;
|
|
||||||
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// _saved_filenames_synthesis has processed all the files in the analysis images folder
|
// _saved_filenames_synthesis has processed all the files in the analysis images folder
|
||||||
@@ -205,8 +297,23 @@ void ColorSingleAnalysis::synthesise()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
void ColorSingleAnalysis::displayresults()
|
void ColorSingleAnalysis::displayresults()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if(_state == STATE_STOP) return;
|
||||||
|
|
||||||
|
_show_image = true;
|
||||||
|
_image_shown = false;
|
||||||
|
|
||||||
|
//cout << "_saved_filenames_analysis[i] - " << _saved_filenames_synthesis[i] << endl;
|
||||||
|
|
||||||
|
while(!_image_shown){
|
||||||
|
Thread::sleep(2);
|
||||||
|
//cout << "!_image_shown" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
for(float i=1;i<_saved_filenames_synthesis.size();i++){
|
for(float i=1;i<_saved_filenames_synthesis.size();i++){
|
||||||
|
|
||||||
if(_state == STATE_STOP) return;
|
if(_state == STATE_STOP) return;
|
||||||
@@ -230,6 +337,7 @@ void ColorSingleAnalysis::displayresults()
|
|||||||
_image_shown = false;
|
_image_shown = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -240,11 +348,9 @@ void ColorSingleAnalysis::draw()
|
|||||||
switch (_state) {
|
switch (_state) {
|
||||||
case STATE_ACQUIRING:
|
case STATE_ACQUIRING:
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
if (_frame_cnt < _frame_cnt_max)
|
if (_frame_cnt < _frame_cnt_max)
|
||||||
{
|
{
|
||||||
|
|
||||||
float one_third_of_frame_count_max=_frame_cnt_max/3;
|
float one_third_of_frame_count_max=_frame_cnt_max/3;
|
||||||
int _fade_in_frames = one_third_of_frame_count_max/10;
|
int _fade_in_frames = one_third_of_frame_count_max/10;
|
||||||
|
|
||||||
@@ -282,15 +388,15 @@ void ColorSingleAnalysis::draw()
|
|||||||
}
|
}
|
||||||
|
|
||||||
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){
|
||||||
|
|
||||||
int fade = ofMap(_fade_cnt, 0, _fade_in_frames, 0, 255);
|
int fade = ofMap(_fade_cnt, 0, _fade_in_frames, 0, 255);
|
||||||
ofSetColor(0, 0, 255-fade);
|
ofSetColor(0, 0, 255-fade);
|
||||||
|
|
||||||
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
ofRect(0, 0, ofGetWidth(), ofGetHeight());
|
||||||
_fade_cnt++;
|
_fade_cnt++;
|
||||||
fileNameTag = "FADING";
|
fileNameTag = "FADING";
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//_state = STATE_SYNTHESISING;
|
//_state = STATE_SYNTHESISING;
|
||||||
_RUN_DONE = true;
|
_RUN_DONE = true;
|
||||||
@@ -326,7 +432,7 @@ void ColorSingleAnalysis::draw()
|
|||||||
//ofRotate(ofMap(_anim_cnt/2.0, 0, _anim_cnt_max, 0, 360));
|
//ofRotate(ofMap(_anim_cnt/2.0, 0, _anim_cnt_max, 0, 360));
|
||||||
|
|
||||||
if (_anim_cnt < _fade_in_frames) {
|
if (_anim_cnt < _fade_in_frames) {
|
||||||
// cout << "ColorSingleAnalysis STATE_SYNTHESIZING = FADING IN ANIMATION...\n";
|
// cout << "ColorSingleAnalysis STATE_SYNTHESIZING = FADING IN ANIMATION...\n";
|
||||||
|
|
||||||
fade = ofMap(_anim_cnt, 0, _fade_in_frames, 0, 255);
|
fade = ofMap(_anim_cnt, 0, _fade_in_frames, 0, 255);
|
||||||
|
|
||||||
@@ -387,8 +493,48 @@ void ColorSingleAnalysis::draw()
|
|||||||
case STATE_DISPLAY_RESULTS:
|
case STATE_DISPLAY_RESULTS:
|
||||||
{
|
{
|
||||||
|
|
||||||
//cout << "STATE_DISPLAY_RESULTS...\n" << endl;
|
cout << "case STATE_DISPLAY_RESULTS = true" << endl;
|
||||||
|
|
||||||
|
int width = image1.width;
|
||||||
|
int height = image1.height;
|
||||||
|
float spacing = 10;
|
||||||
|
|
||||||
|
if (_frame_cnt > 2000)
|
||||||
|
{
|
||||||
|
_image_shown = true;
|
||||||
|
_frame_cnt=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
_frame_cnt++;
|
||||||
|
|
||||||
|
if (_show_image)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
cout << "_show_image = true" << endl;
|
||||||
|
|
||||||
|
for(int x=0; x<width; x++){
|
||||||
|
|
||||||
|
float xPos = (float) x * spacing + 5;
|
||||||
|
|
||||||
|
for(int y=0; y<height; y++){
|
||||||
|
float yPos = (float)y * spacing + 5;
|
||||||
|
glPushMatrix();
|
||||||
|
ofLine(xPos, yPos, xPos+(vectorField[y*width+x].x*spacing), yPos+(vectorField[y*width+x].y*spacing));
|
||||||
|
glPopMatrix();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//this is where we save the full-frame software output to file... after the vectors, etc. are rendered...
|
||||||
|
//saveImageSynthesis(file_name, &cvColorImage1, OF_IMAGE_COLOR);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
_RUN_DONE = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
/*
|
||||||
|
//cout << "STATE_DISPLAY_RESULTS...\n" << endl;
|
||||||
|
|
||||||
if (_frame_cnt > 2)
|
if (_frame_cnt > 2)
|
||||||
{
|
{
|
||||||
@@ -404,9 +550,9 @@ void ColorSingleAnalysis::draw()
|
|||||||
|
|
||||||
ofEnableAlphaBlending();
|
ofEnableAlphaBlending();
|
||||||
|
|
||||||
ofSetColor(255, 255, 255);
|
ofSetColor(255, 255, 255);
|
||||||
image2.setFromPixels(image3.getPixels(),image3.width,image3.height, OF_IMAGE_COLOR);
|
image2.setFromPixels(image3.getPixels(),image3.width,image3.height, OF_IMAGE_COLOR);
|
||||||
image2.draw(0,0, ofGetWidth(), ofGetHeight());
|
image2.draw(0,0, ofGetWidth(), ofGetHeight());
|
||||||
|
|
||||||
ofDisableAlphaBlending();
|
ofDisableAlphaBlending();
|
||||||
}
|
}
|
||||||
@@ -414,12 +560,11 @@ void ColorSingleAnalysis::draw()
|
|||||||
// display results of the synthesis
|
// display results of the synthesis
|
||||||
_RUN_DONE = true;
|
_RUN_DONE = true;
|
||||||
break;
|
break;
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -432,4 +577,4 @@ void ColorSingleAnalysis::save_cb(Timer& timer)
|
|||||||
string file_name =ofToString(_save_cnt,2)+"_"+fileNameTag+"_"+ofToString(_run_cnt,2)+".jpg";
|
string file_name =ofToString(_save_cnt,2)+"_"+fileNameTag+"_"+ofToString(_run_cnt,2)+".jpg";
|
||||||
|
|
||||||
saveImageAnalysis(file_name);
|
saveImageAnalysis(file_name);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,5 +68,5 @@ protected:
|
|||||||
unsigned char * imagePixels;
|
unsigned char * imagePixels;
|
||||||
int vectorCount;
|
int vectorCount;
|
||||||
ofVec2f * vectorField;
|
ofVec2f * vectorField;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -15,8 +15,6 @@ using Poco::Thread;
|
|||||||
|
|
||||||
void DiffNoiseAnalysis::setup(int camWidth, int camHeight)
|
void DiffNoiseAnalysis::setup(int camWidth, int camHeight)
|
||||||
{
|
{
|
||||||
AbstractAnalysis::setup(camWidth, camHeight);
|
|
||||||
|
|
||||||
NUM_RUN = RefractiveIndex::XML.getValue("config:analysis_NUM_RUN:NUM_RUN_diffnoise", NUMBER_RUNS);
|
NUM_RUN = RefractiveIndex::XML.getValue("config:analysis_NUM_RUN:NUM_RUN_diffnoise", NUMBER_RUNS);
|
||||||
cout << "NUM_RUN DiffNoiseAnalysis " << NUM_RUN << endl;
|
cout << "NUM_RUN DiffNoiseAnalysis " << NUM_RUN << endl;
|
||||||
//NUM_RUN = 5;
|
//NUM_RUN = 5;
|
||||||
|
|||||||
@@ -15,8 +15,6 @@ using Poco::Thread;
|
|||||||
|
|
||||||
void IResponseAnalysis::setup(int camWidth, int camHeight)
|
void IResponseAnalysis::setup(int camWidth, int camHeight)
|
||||||
{
|
{
|
||||||
AbstractAnalysis::setup(camWidth, camHeight);
|
|
||||||
|
|
||||||
NUM_RUN = RefractiveIndex::XML.getValue("config:analysis_NUM_RUN:NUM_RUN_iresponse", NUMBER_RUNS);
|
NUM_RUN = RefractiveIndex::XML.getValue("config:analysis_NUM_RUN:NUM_RUN_iresponse", NUMBER_RUNS);
|
||||||
cout << "NUM_RUN IResponseAnalysis " << NUM_RUN << endl;
|
cout << "NUM_RUN IResponseAnalysis " << NUM_RUN << endl;
|
||||||
//NUM_RUN = 5;
|
//NUM_RUN = 5;
|
||||||
|
|||||||
@@ -12,13 +12,11 @@ using Poco::Thread;
|
|||||||
|
|
||||||
#define NUMBER_RUNS 1
|
#define NUMBER_RUNS 1
|
||||||
#define ACQUIRE_TIME 20
|
#define ACQUIRE_TIME 20
|
||||||
#define TRESHOLD 80
|
#define THRESHOLD 80
|
||||||
#define MAXBLOBS 15
|
#define MAXBLOBS 15
|
||||||
|
|
||||||
void RelaxRateAnalysis::setup(int camWidth, int camHeight)
|
void RelaxRateAnalysis::setup(int camWidth, int camHeight)
|
||||||
{
|
{
|
||||||
AbstractAnalysis::setup(camWidth, camHeight);
|
|
||||||
|
|
||||||
NUM_RUN = RefractiveIndex::XML.getValue("config:analysis_NUM_RUN:NUM_RUN_relaxrate", NUMBER_RUNS);
|
NUM_RUN = RefractiveIndex::XML.getValue("config:analysis_NUM_RUN:NUM_RUN_relaxrate", NUMBER_RUNS);
|
||||||
cout << "NUM_RUN RelaxRateAnalysis " << NUM_RUN << endl;
|
cout << "NUM_RUN RelaxRateAnalysis " << NUM_RUN << endl;
|
||||||
//NUM_RUN = 5;
|
//NUM_RUN = 5;
|
||||||
@@ -27,8 +25,8 @@ void RelaxRateAnalysis::setup(int camWidth, int camHeight)
|
|||||||
acq_run_time = RefractiveIndex::XML.getValue("config:analysis_time:acquiretime_relaxrate", ACQUIRE_TIME);
|
acq_run_time = RefractiveIndex::XML.getValue("config:analysis_time:acquiretime_relaxrate", ACQUIRE_TIME);
|
||||||
cout << "ACQUIRE_TIME RelaxRateAnalysis " << acq_run_time << endl;
|
cout << "ACQUIRE_TIME RelaxRateAnalysis " << acq_run_time << endl;
|
||||||
|
|
||||||
_treshold = RefractiveIndex::XML.getValue("config:relaxrate:treshold", TRESHOLD);
|
_threshold = RefractiveIndex::XML.getValue("config:relaxrate:threshold", THRESHOLD);
|
||||||
cout << "TRESHOLD RelaxRateAnalysis " << _treshold << endl;
|
cout << "THRESHOLD RelaxRateAnalysis " << _threshold << endl;
|
||||||
|
|
||||||
_maxblobs = RefractiveIndex::XML.getValue("config:relaxrate:maxblobs", MAXBLOBS);
|
_maxblobs = RefractiveIndex::XML.getValue("config:relaxrate:maxblobs", MAXBLOBS);
|
||||||
cout << "MAXBLOBS RelaxRateAnalysis " << _maxblobs << endl;
|
cout << "MAXBLOBS RelaxRateAnalysis " << _maxblobs << endl;
|
||||||
@@ -118,7 +116,7 @@ void RelaxRateAnalysis::synthesise()
|
|||||||
cvColorImage1.setFromPixels(image1.getPixels(), image1.width, image1.height);
|
cvColorImage1.setFromPixels(image1.getPixels(), image1.width, image1.height);
|
||||||
cvColorImage1.convertToGrayscalePlanarImage(cvGrayDiff1, 1);
|
cvColorImage1.convertToGrayscalePlanarImage(cvGrayDiff1, 1);
|
||||||
|
|
||||||
cvGrayDiff1.threshold(_treshold);
|
cvGrayDiff1.threshold(_threshold);
|
||||||
|
|
||||||
rfiCvContourFinder* cf = new rfiCvContourFinder();
|
rfiCvContourFinder* cf = new rfiCvContourFinder();
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ protected:
|
|||||||
int _run_cnt, _save_cnt, _synth_save_cnt, _anim_cnt;
|
int _run_cnt, _save_cnt, _synth_save_cnt, _anim_cnt;
|
||||||
float c, _frame_cnt, _frame_cnt_max, _anim_cnt_max;
|
float c, _frame_cnt, _frame_cnt_max, _anim_cnt_max;
|
||||||
|
|
||||||
int _treshold;
|
int _threshold;
|
||||||
int _maxblobs;
|
int _maxblobs;
|
||||||
|
|
||||||
bool _show_image, _image_shown;
|
bool _show_image, _image_shown;
|
||||||
|
|||||||
@@ -19,8 +19,6 @@ using Poco::Thread;
|
|||||||
|
|
||||||
void ShadowScapesAnalysis::setup(int camWidth, int camHeight)
|
void ShadowScapesAnalysis::setup(int camWidth, int camHeight)
|
||||||
{
|
{
|
||||||
AbstractAnalysis::setup(camWidth, camHeight);
|
|
||||||
|
|
||||||
NUM_RUN = RefractiveIndex::XML.getValue("config:analysis_NUM_RUN:NUM_RUN_shadowscapes", NUMBER_RUNS);
|
NUM_RUN = RefractiveIndex::XML.getValue("config:analysis_NUM_RUN:NUM_RUN_shadowscapes", NUMBER_RUNS);
|
||||||
cout << "NUM_RUN ShadowScapesAnalysis " << NUM_RUN << endl;
|
cout << "NUM_RUN ShadowScapesAnalysis " << NUM_RUN << endl;
|
||||||
//NUM_RUN = 5;
|
//NUM_RUN = 5;
|
||||||
|
|||||||
@@ -15,8 +15,6 @@ using Poco::Thread;
|
|||||||
|
|
||||||
void ShapeFromShadingAnalysis::setup(int camWidth, int camHeight)
|
void ShapeFromShadingAnalysis::setup(int camWidth, int camHeight)
|
||||||
{
|
{
|
||||||
AbstractAnalysis::setup(camWidth, camHeight);
|
|
||||||
|
|
||||||
NUM_RUN = RefractiveIndex::XML.getValue("config:analysis_NUM_RUN:NUM_RUN_shapefromshading", NUMBER_RUNS);
|
NUM_RUN = RefractiveIndex::XML.getValue("config:analysis_NUM_RUN:NUM_RUN_shapefromshading", NUMBER_RUNS);
|
||||||
cout << "NUM_RUN ShapeFromShadingAnalysis " << NUM_RUN << endl;
|
cout << "NUM_RUN ShapeFromShadingAnalysis " << NUM_RUN << endl;
|
||||||
//NUM_RUN = 5;
|
//NUM_RUN = 5;
|
||||||
|
|||||||
@@ -15,8 +15,6 @@ using Poco::Thread;
|
|||||||
|
|
||||||
void StrobeAnalysis::setup(int camWidth, int camHeight)
|
void StrobeAnalysis::setup(int camWidth, int camHeight)
|
||||||
{
|
{
|
||||||
AbstractAnalysis::setup(camWidth, camHeight);
|
|
||||||
|
|
||||||
NUM_RUN = RefractiveIndex::XML.getValue("config:analysis_NUM_RUN:NUM_RUN_strobe", NUMBER_RUNS);
|
NUM_RUN = RefractiveIndex::XML.getValue("config:analysis_NUM_RUN:NUM_RUN_strobe", NUMBER_RUNS);
|
||||||
cout << "NUM_RUN StrobeAnalysis " << NUM_RUN << endl;
|
cout << "NUM_RUN StrobeAnalysis " << NUM_RUN << endl;
|
||||||
//NUM_RUN = 5;
|
//NUM_RUN = 5;
|
||||||
|
|||||||
Reference in New Issue
Block a user