added image playout for all classes

This commit is contained in:
Jamie Allen 2012-02-21 01:34:24 +01:00
parent e17a3a0d91
commit 3eef15a14b
20 changed files with 532 additions and 26 deletions

View File

@ -1,12 +1,4 @@
/*
todo:
(1) Look at warinings about the #define which get over written
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ author: dviid
~ contact: dviid@labs.ciid.dk
*/
////also the new shit//// ////also the new shit////
@ -26,6 +18,7 @@
#include "ofxXmlSettings.h" #include "ofxXmlSettings.h"
#include "ofxOpenCv.h" #include "ofxOpenCv.h"
#define CAMERA_ID 1 #define CAMERA_ID 1
#define CAMERA_ACQU_WIDTH 640 #define CAMERA_ACQU_WIDTH 640
#define CAMERA_ACQU_HEIGHT 480 #define CAMERA_ACQU_HEIGHT 480

View File

@ -9,6 +9,7 @@
#include "AnalysisAdaptor.h" #include "AnalysisAdaptor.h"
class RefractiveIndex : public ofBaseApp class RefractiveIndex : public ofBaseApp
{ {
public: public:

View File

@ -33,6 +33,14 @@ void CamNoiseAnalysis::setup(int camWidth, int camHeight)
create_dir(); create_dir();
_show_image = false;
_image_shown = false;
//for an ofxOpenCv.h image i would like to use..."
//image3.allocate(RefractiveIndex::_vid_w, RefractiveIndex::_vid_h);
image1.setUseTexture(false);
image2.setUseTexture(true);
} }
@ -73,6 +81,33 @@ void CamNoiseAnalysis::synthesise()
} }
void CamNoiseAnalysis::displayresults()
{
for(float i=1;i<_saved_filenames.size();i++){
cout << "_saved_filenames[i]" << _saved_filenames[i] << endl;
while(!_image_shown){
Thread::sleep(2);
//cout << "!_image_shown" << endl;
}
if(!image1.loadImage(_saved_filenames[i])){
//couldn't load image
cout << "didn't load image" << endl;
}
if(image1.loadImage(_saved_filenames[i])){
image1.loadImage(_saved_filenames[i]);
//cout << "_show_image = true;" << endl;
_show_image = true;
_image_shown = false;
}
}
}
// this runs at frame rate = 33 ms for 30 FPS // this runs at frame rate = 33 ms for 30 FPS
@ -224,9 +259,30 @@ void CamNoiseAnalysis::draw()
case STATE_DISPLAY_RESULTS: case STATE_DISPLAY_RESULTS:
{ {
if (_frame_cnt > 2)
{
_image_shown = true;
_frame_cnt=0;
}
_frame_cnt++;
if (_show_image)
{
ofEnableAlphaBlending();
ofSetColor(255, 255, 255, 255);
image2.setFromPixels(image1.getPixels(),image1.width,image1.height, OF_IMAGE_COLOR);
image2.draw(0,0, ofGetWidth(), ofGetHeight());
ofDisableAlphaBlending();
}
// display results of the synthesis // display results of the synthesis
_RUN_DONE = true; _RUN_DONE = true;
break; break;
} }

View File

@ -20,6 +20,8 @@ public:
void setup(int camWidth, int camHeight); void setup(int camWidth, int camHeight);
void acquire(); void acquire();
void synthesise(); void synthesise();
void displayresults();
void draw(); void draw();
void save_cb(Poco::Timer& timer); void save_cb(Poco::Timer& timer);
@ -30,4 +32,9 @@ protected:
int _run_cnt, _save_cnt, _anim_cnt; int _run_cnt, _save_cnt, _anim_cnt;
float c, _frame_cnt, _frame_cnt_max, _anim_cnt_max; float c, _frame_cnt, _frame_cnt_max, _anim_cnt_max;
bool _show_image, _image_shown;
ofImage image1;
ofImage image2;
}; };

View File

@ -33,6 +33,15 @@ void ColorMultiAnalysis::setup(int camWidth, int camHeight)
_anim_cnt_max = anim_time*ofGetFrameRate(); // e.g.: 30 frames per second = 150 frames _anim_cnt_max = anim_time*ofGetFrameRate(); // e.g.: 30 frames per second = 150 frames
create_dir(); create_dir();
_show_image = false;
_image_shown = false;
//for an ofxOpenCv.h image i would like to use..."
//image3.allocate(RefractiveIndex::_vid_w, RefractiveIndex::_vid_h);
image1.setUseTexture(false);
image2.setUseTexture(true);
} }
@ -70,6 +79,34 @@ void ColorMultiAnalysis::synthesise()
// _saved_filenames has all the file names of all the saved images // _saved_filenames has all the file names of all the saved images
} }
void ColorMultiAnalysis::displayresults()
{
for(float i=1;i<_saved_filenames.size();i++){
cout << "_saved_filenames[i]" << _saved_filenames[i] << endl;
while(!_image_shown){
Thread::sleep(2);
//cout << "!_image_shown" << endl;
}
if(!image1.loadImage(_saved_filenames[i])){
//couldn't load image
cout << "didn't load image" << endl;
}
if(image1.loadImage(_saved_filenames[i])){
image1.loadImage(_saved_filenames[i]);
//cout << "_show_image = true;" << endl;
_show_image = true;
_image_shown = false;
}
}
}
void ColorMultiAnalysis::draw() void ColorMultiAnalysis::draw()
{ {
@ -216,9 +253,30 @@ void ColorMultiAnalysis::draw()
case STATE_DISPLAY_RESULTS: case STATE_DISPLAY_RESULTS:
{ {
if (_frame_cnt > 2)
{
_image_shown = true;
_frame_cnt=0;
}
_frame_cnt++;
if (_show_image)
{
ofEnableAlphaBlending();
ofSetColor(255, 255, 255, 255);
image2.setFromPixels(image1.getPixels(),image1.width,image1.height, OF_IMAGE_COLOR);
image2.draw(0,0, ofGetWidth(), ofGetHeight());
ofDisableAlphaBlending();
}
// display results of the synthesis // display results of the synthesis
_RUN_DONE = true; _RUN_DONE = true;
break; break;
} }

View File

@ -14,7 +14,8 @@ public:
void setup(int camWidth, int camHeight); void setup(int camWidth, int camHeight);
void acquire(); void acquire();
void synthesise(); void synthesise();
void displayresults();
void draw(); void draw();
void save_cb(Poco::Timer& timer); void save_cb(Poco::Timer& timer);
@ -25,4 +26,9 @@ protected:
int _run_cnt, _save_cnt, _fade_cnt, _anim_cnt; int _run_cnt, _save_cnt, _fade_cnt, _anim_cnt;
float c, _frame_cnt, _frame_cnt_max, _anim_cnt_max; float c, _frame_cnt, _frame_cnt_max, _anim_cnt_max;
bool _show_image, _image_shown;
ofImage image1;
ofImage image2;
}; };

View File

@ -42,6 +42,14 @@ void ColorSingleAnalysis::setup(int camWidth, int camHeight)
fileNameTag = ""; fileNameTag = "";
_show_image = false;
_image_shown = false;
//for an ofxOpenCv.h image i would like to use..."
//image3.allocate(RefractiveIndex::_vid_w, RefractiveIndex::_vid_h);
image1.setUseTexture(false);
image2.setUseTexture(true);
} }
@ -80,6 +88,34 @@ void ColorSingleAnalysis::synthesise()
Thread::sleep(3); Thread::sleep(3);
} }
void ColorSingleAnalysis::displayresults()
{
for(float i=1;i<_saved_filenames.size();i++){
cout << "_saved_filenames[i]" << _saved_filenames[i] << endl;
while(!_image_shown){
Thread::sleep(2);
//cout << "!_image_shown" << endl;
}
if(!image1.loadImage(_saved_filenames[i])){
//couldn't load image
cout << "didn't load image" << endl;
}
if(image1.loadImage(_saved_filenames[i])){
image1.loadImage(_saved_filenames[i]);
//cout << "_show_image = true;" << endl;
_show_image = true;
_image_shown = false;
}
}
}
void ColorSingleAnalysis::draw() void ColorSingleAnalysis::draw()
{ {
@ -233,9 +269,30 @@ void ColorSingleAnalysis::draw()
case STATE_DISPLAY_RESULTS: case STATE_DISPLAY_RESULTS:
{ {
if (_frame_cnt > 2)
{
_image_shown = true;
_frame_cnt=0;
}
_frame_cnt++;
if (_show_image)
{
ofEnableAlphaBlending();
ofSetColor(255, 255, 255, 255);
image2.setFromPixels(image1.getPixels(),image1.width,image1.height, OF_IMAGE_COLOR);
image2.draw(0,0, ofGetWidth(), ofGetHeight());
ofDisableAlphaBlending();
}
// display results of the synthesis // display results of the synthesis
_RUN_DONE = true; _RUN_DONE = true;
break; break;
} }
default: default:

View File

@ -19,7 +19,8 @@ public:
void setup(int camWidth, int camHeight); void setup(int camWidth, int camHeight);
void acquire(); void acquire();
void synthesise(); void synthesise();
void displayresults();
void draw(); void draw();
void save_cb(Poco::Timer& timer); void save_cb(Poco::Timer& timer);
@ -32,4 +33,9 @@ protected:
int _run_cnt, _save_cnt, _fade_cnt, _anim_cnt; int _run_cnt, _save_cnt, _fade_cnt, _anim_cnt;
float c, _frame_cnt, _frame_cnt_max, _anim_cnt_max; float c, _frame_cnt, _frame_cnt_max, _anim_cnt_max;
bool _show_image, _image_shown;
ofImage image1;
ofImage image2;
}; };

View File

@ -32,6 +32,15 @@ void DiffNoiseAnalysis::setup(int camWidth, int camHeight)
_anim_cnt_max = anim_time*ofGetFrameRate(); // e.g.: 30 frames per second = 150 frames _anim_cnt_max = anim_time*ofGetFrameRate(); // e.g.: 30 frames per second = 150 frames
create_dir(); create_dir();
_show_image = false;
_image_shown = false;
//for an ofxOpenCv.h image i would like to use..."
//image3.allocate(RefractiveIndex::_vid_w, RefractiveIndex::_vid_h);
image1.setUseTexture(false);
image2.setUseTexture(true);
} }
@ -71,6 +80,34 @@ void DiffNoiseAnalysis::synthesise()
} }
void DiffNoiseAnalysis::displayresults()
{
for(float i=1;i<_saved_filenames.size();i++){
cout << "_saved_filenames[i]" << _saved_filenames[i] << endl;
while(!_image_shown){
Thread::sleep(2);
//cout << "!_image_shown" << endl;
}
if(!image1.loadImage(_saved_filenames[i])){
//couldn't load image
cout << "didn't load image" << endl;
}
if(image1.loadImage(_saved_filenames[i])){
image1.loadImage(_saved_filenames[i]);
//cout << "_show_image = true;" << endl;
_show_image = true;
_image_shown = false;
}
}
}
// 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()
@ -238,9 +275,30 @@ void DiffNoiseAnalysis::draw()
case STATE_DISPLAY_RESULTS: case STATE_DISPLAY_RESULTS:
{ {
if (_frame_cnt > 2)
{
_image_shown = true;
_frame_cnt=0;
}
_frame_cnt++;
if (_show_image)
{
ofEnableAlphaBlending();
ofSetColor(255, 255, 255, 255);
image2.setFromPixels(image1.getPixels(),image1.width,image1.height, OF_IMAGE_COLOR);
image2.draw(0,0, ofGetWidth(), ofGetHeight());
ofDisableAlphaBlending();
}
// display results of the synthesis // display results of the synthesis
_RUN_DONE = true; _RUN_DONE = true;
break; break;
} }
default: default:

View File

@ -19,7 +19,8 @@ public:
void setup(int camWidth, int camHeight); void setup(int camWidth, int camHeight);
void acquire(); void acquire();
void synthesise(); void synthesise();
void displayresults();
void draw(); void draw();
void save_cb(Poco::Timer& timer); void save_cb(Poco::Timer& timer);
@ -30,4 +31,9 @@ protected:
int _run_cnt, _save_cnt, _fade_cnt, _anim_cnt; int _run_cnt, _save_cnt, _fade_cnt, _anim_cnt;
float c, _frame_cnt, _frame_cnt_max, _anim_cnt_max; float c, _frame_cnt, _frame_cnt_max, _anim_cnt_max;
bool _show_image, _image_shown;
ofImage image1;
ofImage image2;
}; };

View File

@ -30,6 +30,15 @@ void IResponseAnalysis::setup(int camWidth, int camHeight)
int anim_time = 5; // 10 seconds int anim_time = 5; // 10 seconds
_anim_cnt_max = anim_time*ofGetFrameRate(); // e.g.: 30 frames per second = 150 frames _anim_cnt_max = anim_time*ofGetFrameRate(); // e.g.: 30 frames per second = 150 frames
_show_image = false;
_image_shown = false;
//for an ofxOpenCv.h image i would like to use..."
//image3.allocate(RefractiveIndex::_vid_w, RefractiveIndex::_vid_h);
image1.setUseTexture(false);
image2.setUseTexture(true);
} }
@ -70,6 +79,35 @@ void IResponseAnalysis::synthesise()
} }
void IResponseAnalysis::displayresults()
{
for(float i=1;i<_saved_filenames.size();i++){
cout << "_saved_filenames[i]" << _saved_filenames[i] << endl;
while(!_image_shown){
Thread::sleep(2);
//cout << "!_image_shown" << endl;
}
if(!image1.loadImage(_saved_filenames[i])){
//couldn't load image
cout << "didn't load image" << endl;
}
if(image1.loadImage(_saved_filenames[i])){
image1.loadImage(_saved_filenames[i]);
//cout << "_show_image = true;" << endl;
_show_image = true;
_image_shown = false;
}
}
}
// 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()
@ -184,9 +222,30 @@ void IResponseAnalysis::draw()
case STATE_DISPLAY_RESULTS: case STATE_DISPLAY_RESULTS:
{ {
if (_frame_cnt > 2)
{
_image_shown = true;
_frame_cnt=0;
}
_frame_cnt++;
if (_show_image)
{
ofEnableAlphaBlending();
ofSetColor(255, 255, 255, 255);
image2.setFromPixels(image1.getPixels(),image1.width,image1.height, OF_IMAGE_COLOR);
image2.draw(0,0, ofGetWidth(), ofGetHeight());
ofDisableAlphaBlending();
}
// display results of the synthesis // display results of the synthesis
_RUN_DONE = true; _RUN_DONE = true;
break; break;
} }
default: default:

View File

@ -19,7 +19,9 @@ public:
void setup(int camWidth, int camHeight); void setup(int camWidth, int camHeight);
void acquire(); void acquire();
void synthesise(); void synthesise();
void displayresults();
void draw(); void draw();
void save_cb(Poco::Timer& timer); void save_cb(Poco::Timer& timer);
@ -29,5 +31,9 @@ protected:
bool _RUN_DONE; bool _RUN_DONE;
int _run_cnt, _save_cnt, _anim_cnt; int _run_cnt, _save_cnt, _anim_cnt;
float c, _frame_cnt, _frame_cnt_max, _anim_cnt_max; float c, _frame_cnt, _frame_cnt_max, _anim_cnt_max;
bool _show_image, _image_shown;
ofImage image1;
ofImage image2;
}; };

View File

@ -31,6 +31,15 @@ void RelaxRateAnalysis::setup(int camWidth, int camHeight)
int anim_time = 5; // 10 seconds int anim_time = 5; // 10 seconds
_anim_cnt_max = anim_time*ofGetFrameRate(); // e.g.: 30 frames per second = 150 frames _anim_cnt_max = anim_time*ofGetFrameRate(); // e.g.: 30 frames per second = 150 frames
_show_image = false;
_image_shown = false;
//for an ofxOpenCv.h image i would like to use..."
//image3.allocate(RefractiveIndex::_vid_w, RefractiveIndex::_vid_h);
image1.setUseTexture(false);
image2.setUseTexture(true);
} }
@ -69,6 +78,35 @@ void RelaxRateAnalysis::synthesise()
} }
void RelaxRateAnalysis::displayresults()
{
for(float i=1;i<_saved_filenames.size();i++){
cout << "_saved_filenames[i]" << _saved_filenames[i] << endl;
while(!_image_shown){
Thread::sleep(2);
//cout << "!_image_shown" << endl;
}
if(!image1.loadImage(_saved_filenames[i])){
//couldn't load image
cout << "didn't load image" << endl;
}
if(image1.loadImage(_saved_filenames[i])){
image1.loadImage(_saved_filenames[i]);
//cout << "_show_image = true;" << endl;
_show_image = true;
_image_shown = false;
}
}
}
// this runs at frame rate = 33 ms for 30 FPS // this runs at frame rate = 33 ms for 30 FPS
void RelaxRateAnalysis::draw() void RelaxRateAnalysis::draw()
{ {
@ -198,9 +236,28 @@ void RelaxRateAnalysis::draw()
case STATE_DISPLAY_RESULTS: case STATE_DISPLAY_RESULTS:
{ {
if (_frame_cnt > 2)
{
_image_shown = true;
_frame_cnt=0;
}
_frame_cnt++;
if (_show_image)
{
ofEnableAlphaBlending();
ofSetColor(255, 255, 255, 255);
image2.setFromPixels(image1.getPixels(),image1.width,image1.height, OF_IMAGE_COLOR);
image2.draw(0,0, ofGetWidth(), ofGetHeight());
ofDisableAlphaBlending();
}
// display results of the synthesis // display results of the synthesis
_RUN_DONE = true; _RUN_DONE = true;
cout << "RELAXRATE RUN COMPLETED" << endl;
break; break;
} }

View File

@ -16,7 +16,9 @@ public:
void setup(int camWidth, int camHeight); void setup(int camWidth, int camHeight);
void acquire(); void acquire();
void synthesise(); void synthesise();
void displayresults();
void draw(); void draw();
void save_cb(Poco::Timer& timer); void save_cb(Poco::Timer& timer);
@ -27,4 +29,9 @@ protected:
float _flip, _level; float _flip, _level;
int _run_cnt, _save_cnt, _anim_cnt; int _run_cnt, _save_cnt, _anim_cnt;
float c, _frame_cnt, _frame_cnt_max, _anim_cnt_max; float c, _frame_cnt, _frame_cnt_max, _anim_cnt_max;
bool _show_image, _image_shown;
ofImage image1;
ofImage image2;
}; };

View File

@ -39,6 +39,15 @@ void ShadowScapesAnalysis::setup(int camWidth, int camHeight)
int anim_time = 5; // 10 seconds int anim_time = 5; // 10 seconds
_anim_cnt_max = anim_time*ofGetFrameRate(); // e.g.: 30 frames per second = 150 frames _anim_cnt_max = anim_time*ofGetFrameRate(); // e.g.: 30 frames per second = 150 frames
_show_image = false;
_image_shown = false;
//for an ofxOpenCv.h image i would like to use..."
//image3.allocate(RefractiveIndex::_vid_w, RefractiveIndex::_vid_h);
image1.setUseTexture(false);
image2.setUseTexture(true);
} }
void ShadowScapesAnalysis::acquire() void ShadowScapesAnalysis::acquire()
@ -75,6 +84,35 @@ void ShadowScapesAnalysis::synthesise()
} }
void ShadowScapesAnalysis::displayresults()
{
for(float i=1;i<_saved_filenames.size();i++){
cout << "_saved_filenames[i]" << _saved_filenames[i] << endl;
while(!_image_shown){
Thread::sleep(2);
//cout << "!_image_shown" << endl;
}
if(!image1.loadImage(_saved_filenames[i])){
//couldn't load image
cout << "didn't load image" << endl;
}
if(image1.loadImage(_saved_filenames[i])){
image1.loadImage(_saved_filenames[i]);
//cout << "_show_image = true;" << endl;
_show_image = true;
_image_shown = false;
}
}
}
// the animation draw - and the output draw // the animation draw - and the output draw
void ShadowScapesAnalysis::draw() void ShadowScapesAnalysis::draw()
{ {
@ -253,8 +291,27 @@ void ShadowScapesAnalysis::draw()
case STATE_DISPLAY_RESULTS: case STATE_DISPLAY_RESULTS:
{ {
if (_frame_cnt > 2)
{
_image_shown = true;
_frame_cnt=0;
}
_frame_cnt++;
if (_show_image)
{
ofEnableAlphaBlending();
ofSetColor(255, 255, 255, 255);
image2.setFromPixels(image1.getPixels(),image1.width,image1.height, OF_IMAGE_COLOR);
image2.draw(0,0, ofGetWidth(), ofGetHeight());
ofDisableAlphaBlending();
}
// display results of the synthesis // display results of the synthesis
cout << "ShadowScapesAnalysis = STATE_DISPLAY_RESULTS...\n";
_RUN_DONE = true; _RUN_DONE = true;
break; break;
} }

View File

@ -21,7 +21,9 @@ public:
void setup(int camWidth, int camHeight); void setup(int camWidth, int camHeight);
void acquire(); void acquire();
void synthesise(); void synthesise();
void displayresults();
void draw(); void draw();
void save_cb(Poco::Timer& timer); void save_cb(Poco::Timer& timer);
@ -37,4 +39,9 @@ protected:
int _run_cnt, _save_cnt, _anim_cnt; int _run_cnt, _save_cnt, _anim_cnt;
float c, _frame_cnt, _frame_cnt_max, _anim_cnt_max; float c, _frame_cnt, _frame_cnt_max, _anim_cnt_max;
bool _show_image, _image_shown;
ofImage image1;
ofImage image2;
}; };

View File

@ -32,7 +32,8 @@ void ShapeFromShadingAnalysis::setup(int camWidth, int camHeight)
_show_image = false; _show_image = false;
_image_shown = false; _image_shown = false;
image2.allocate(RefractiveIndex::_vid_w, RefractiveIndex::_vid_h); //for an ofxOpenCv.h image i would like to use..."
//image3.allocate(RefractiveIndex::_vid_w, RefractiveIndex::_vid_h);
image1.setUseTexture(false); image1.setUseTexture(false);
image2.setUseTexture(true); image2.setUseTexture(true);
@ -105,11 +106,13 @@ void ShapeFromShadingAnalysis::displayresults()
//cout << "!_image_shown" << endl; //cout << "!_image_shown" << endl;
} }
if(!image1.loadImage(_saved_filenames[i])){ if(!image1.loadImage(_saved_filenames[i])){
//couldn't load image //couldn't load image
cout << "didn't load image" << endl; cout << "didn't load image" << endl;
} }
if(image1.loadImage(_saved_filenames[i])){ if(image1.loadImage(_saved_filenames[i])){
image1.loadImage(_saved_filenames[i]); image1.loadImage(_saved_filenames[i]);
//cout << "_show_image = true;" << endl; //cout << "_show_image = true;" << endl;
@ -442,10 +445,8 @@ void ShapeFromShadingAnalysis::draw()
image2.draw(0,0, ofGetWidth(), ofGetHeight()); image2.draw(0,0, ofGetWidth(), ofGetHeight());
ofDisableAlphaBlending(); ofDisableAlphaBlending();
} }
// display results of the synthesis // display results of the synthesis
_RUN_DONE = true; _RUN_DONE = true;
break; break;

View File

@ -6,7 +6,6 @@
#pragma once #pragma once
#include "AbstractAnalysis.h" #include "AbstractAnalysis.h"
#include "Poco/Timer.h" #include "Poco/Timer.h"
@ -51,10 +50,9 @@ protected:
int _run_cnt, _save_cnt, _anim_cnt; int _run_cnt, _save_cnt, _anim_cnt;
float c, _frame_cnt, _frame_cnt_max, _anim_cnt_max; float c, _frame_cnt, _frame_cnt_max, _anim_cnt_max;
bool _show_image, _image_shown;
bool _show_image, _image_shown;
ofImage image1; ofImage image1;
ofxCvImage image2; ofImage image2;
}; };

View File

@ -29,6 +29,15 @@ void StrobeAnalysis::setup(int camWidth, int camHeight)
int anim_time = 5; // 5 seconds for the animation int anim_time = 5; // 5 seconds for the animation
_anim_cnt_max = anim_time*ofGetFrameRate(); // e.g.: 30 frames per second = 150 frames _anim_cnt_max = anim_time*ofGetFrameRate(); // e.g.: 30 frames per second = 150 frames
_show_image = false;
_image_shown = false;
//for an ofxOpenCv.h image i would like to use..."
//image3.allocate(RefractiveIndex::_vid_w, RefractiveIndex::_vid_h);
image1.setUseTexture(false);
image2.setUseTexture(true);
} }
@ -71,6 +80,35 @@ void StrobeAnalysis::synthesise()
Thread::sleep(3); Thread::sleep(3);
} }
void StrobeAnalysis::displayresults()
{
for(float i=1;i<_saved_filenames.size();i++){
cout << "_saved_filenames[i]" << _saved_filenames[i] << endl;
while(!_image_shown){
Thread::sleep(2);
//cout << "!_image_shown" << endl;
}
if(!image1.loadImage(_saved_filenames[i])){
//couldn't load image
cout << "didn't load image" << endl;
}
if(image1.loadImage(_saved_filenames[i])){
image1.loadImage(_saved_filenames[i]);
//cout << "_show_image = true;" << endl;
_show_image = true;
_image_shown = false;
}
}
}
// this runs at frame rate = 33 ms for 30 FPS // this runs at frame rate = 33 ms for 30 FPS
void StrobeAnalysis::draw() void StrobeAnalysis::draw()
{ {
@ -220,9 +258,30 @@ void StrobeAnalysis::draw()
case STATE_DISPLAY_RESULTS: case STATE_DISPLAY_RESULTS:
{ {
if (_frame_cnt > 2)
{
_image_shown = true;
_frame_cnt=0;
}
_frame_cnt++;
if (_show_image)
{
ofEnableAlphaBlending();
ofSetColor(255, 255, 255, 255);
image2.setFromPixels(image1.getPixels(),image1.width,image1.height, OF_IMAGE_COLOR);
image2.draw(0,0, ofGetWidth(), ofGetHeight());
ofDisableAlphaBlending();
}
// display results of the synthesis // display results of the synthesis
_RUN_DONE = true; _RUN_DONE = true;
break; break;
} }

View File

@ -20,7 +20,9 @@ public:
void setup(int camWidth, int camHeight); void setup(int camWidth, int camHeight);
void acquire(); void acquire();
void synthesise(); void synthesise();
void displayresults();
void draw(); void draw();
void save_cb(Poco::Timer& timer); void save_cb(Poco::Timer& timer);
@ -35,4 +37,9 @@ protected:
int _run_cnt, _save_cnt, _anim_cnt; int _run_cnt, _save_cnt, _anim_cnt;
float c, _frame_cnt, _frame_cnt_max, _anim_cnt_max; float c, _frame_cnt, _frame_cnt_max, _anim_cnt_max;
bool _show_image, _image_shown;
ofImage image1;
ofImage image2;
}; };