put the RefractiveIndex::_vidGrabber.grabFrame(); // in each class

david's solution for the black frames...
This commit is contained in:
Jamie Allen 2012-02-20 20:24:25 +01:00
parent e1e4e15529
commit 2bd7704f38
9 changed files with 62 additions and 4 deletions

View File

@ -189,13 +189,15 @@ void RefractiveIndex::state_analysis()
void RefractiveIndex::update() void RefractiveIndex::update()
{ {
state_analysis(); state_analysis();
/*
RefractiveIndex::_vidGrabber.grabFrame(); // get a new frame from the camera RefractiveIndex::_vidGrabber.grabFrame(); // get a new frame from the camera
if (_vidGrabber.isFrameNew()) if (_vidGrabber.isFrameNew())
{ {
_pixels = _vidGrabber.getPixelsRef(); //get ofPixels from the camera _pixels = _vidGrabber.getPixelsRef(); //get ofPixels from the camera
} }
*/
} }
void RefractiveIndex::draw() void RefractiveIndex::draw()
@ -213,7 +215,8 @@ 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;

View File

@ -240,8 +240,14 @@ void CamNoiseAnalysis::draw()
// this runs at save_cb timer rate = DELTA_T_SAVE // this runs at save_cb timer rate = DELTA_T_SAVE
void CamNoiseAnalysis::save_cb(Timer& timer) void CamNoiseAnalysis::save_cb(Timer& timer)
{ {
_save_cnt++; _save_cnt++;
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 << "CamNoiseAnalysis::saving...\n"; cout << "CamNoiseAnalysis::saving...\n";

View File

@ -235,6 +235,13 @@ void ColorMultiAnalysis::save_cb(Timer& timer)
_save_cnt++; _save_cnt++;
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 << "ColorMultiAnalysis::saving...\n"; cout << "ColorMultiAnalysis::saving...\n";
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";

View File

@ -249,6 +249,13 @@ void ColorSingleAnalysis::save_cb(Timer& timer)
{ {
_save_cnt++; _save_cnt++;
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 << "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";

View File

@ -254,6 +254,13 @@ void DiffNoiseAnalysis::save_cb(Timer& timer)
{ {
_save_cnt++; _save_cnt++;
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 << "DiffNoiseAnalysis::saving...\n"; cout << "DiffNoiseAnalysis::saving...\n";
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";

View File

@ -220,6 +220,13 @@ void RelaxRateAnalysis::save_cb(Timer& timer)
{ {
_save_cnt++; _save_cnt++;
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 << "RelaxRateAnalysis::saving...\n"; cout << "RelaxRateAnalysis::saving...\n";
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";

View File

@ -271,6 +271,14 @@ void ShadowScapesAnalysis::save_cb(Timer& timer)
_save_cnt++; _save_cnt++;
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;

View File

@ -427,6 +427,13 @@ void ShapeFromShadingAnalysis::draw()
void ShapeFromShadingAnalysis::save_cb(Timer& timer) void ShapeFromShadingAnalysis::save_cb(Timer& timer)
{ {
_save_cnt++; _save_cnt++;
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 << "ShapeFromShadingAnalysis::saving...\n"; cout << "ShapeFromShadingAnalysis::saving...\n";

View File

@ -235,9 +235,15 @@ void StrobeAnalysis::draw()
// this runs at save_cb timer rate = DELTA_T_SAVE // this runs at save_cb timer rate = DELTA_T_SAVE
void StrobeAnalysis::save_cb(Timer& timer) void StrobeAnalysis::save_cb(Timer& timer)
{ {
_save_cnt++; _save_cnt++;
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 << "StrobeAnalysis::saving...\n"; cout << "StrobeAnalysis::saving...\n";
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";