From 7cc92aaeae48d0afa0b5535e6684d7ad1f971bdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergi=20Hern=C3=A0ndez=20Juan?= <shernand@iri.upc.edu> Date: Fri, 22 Mar 2013 18:45:28 +0000 Subject: [PATCH] Added the feature to change the framerate of the ladybug camera externally. --- src/examples/ladybug.cpp | 3 ++- src/ladybug.cpp | 14 +++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/examples/ladybug.cpp b/src/examples/ladybug.cpp index 7f4d202..e047645 100755 --- a/src/examples/ladybug.cpp +++ b/src/examples/ladybug.cpp @@ -43,7 +43,8 @@ int main(int argc, char *argv[]) event_server=CEventServer::instance(); ladybug->get_config(&left_off,&top_off,&width,&height,&framerate,&depth,&coding); std::cout << "Fremerate: " << framerate << std::endl; - coding=MONO; +// coding=MONO; + framerate=30; ladybug->set_config(&left_off,&top_off,&width,&height,&framerate,depth,coding); ladybug->get_new_frame_event_id(new_frame); events.push_back(new_frame); diff --git a/src/ladybug.cpp b/src/ladybug.cpp index 8bc0ead..5ae1909 100755 --- a/src/ladybug.cpp +++ b/src/ladybug.cpp @@ -8,7 +8,7 @@ CLadyBug::CLadyBug(dc1394_t *firewire,uint64_t camera_id):CPTGCamera(firewire,camera_id) { unsigned int left_off=0,top_off=0,rows=4608,cols=1024; - float framerate=3.75; + float framerate=7; dc1394error_t error; if(strncmp(this->camera_handle->model,"Compressor",strlen("Compressor"))!=0) @@ -34,13 +34,17 @@ CLadyBug::CLadyBug(dc1394_t *firewire,uint64_t camera_id):CPTGCamera(firewire,ca void CLadyBug::set_config(unsigned int *left_off,unsigned int *top_off,unsigned int *width,unsigned int *height, float *framerate, depths_t depth, codings_t coding) { - /* do nothing, just avoid the base class function to be called */ + unsigned int rows=4608,cols=1024; + + DEBUG_INFO("Configuring camera %d ...\n",this->camera_id); + this->set_mode(*left_off,*top_off,cols,rows,*framerate,DEPTH8,MONO); + this->set_video_mode(left_off,top_off,&cols,&rows,DEPTH8,MONO); + this->set_framerate(framerate); + this->set_num_DMA_buffers(4); if(coding==RGB || coding==MONO) this->multi_coding=coding; else - { - /* handle exceptions */ - } + this->multi_coding=RGB; } void CLadyBug::get_images(char **front, char **front_right, char **rear_right, char **rear_left, char **front_left, char **top) -- GitLab