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