From a4947465e6187053577039f8b19c87505b57ec1e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sergi=20Hern=C3=A0ndez=20Juan?= <shernand@iri.upc.edu>
Date: Wed, 27 Mar 2013 13:16:43 +0000
Subject: [PATCH] Added some new functions to the ladybug API to simplify its
 use.

---
 src/bumblebee.cpp          |  3 +--
 src/examples/bumblebee.cpp |  2 +-
 src/examples/ladybug.cpp   | 10 +++++-----
 src/ladybug.cpp            |  9 +++++++++
 src/ladybug.h              |  5 +++++
 5 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/src/bumblebee.cpp b/src/bumblebee.cpp
index 0ced744..08d50e8 100755
--- a/src/bumblebee.cpp
+++ b/src/bumblebee.cpp
@@ -46,7 +46,6 @@ void CBumblebee::set_config(unsigned int *left_off,unsigned int *top_off,unsigne
   dc1394error_t error;
   uint32_t min_bpp;
   uint32_t max_bpp;
-
   unsigned int bpp;
 
   // set the operation mode
@@ -58,7 +57,7 @@ void CBumblebee::set_config(unsigned int *left_off,unsigned int *top_off,unsigne
   }
   this->mode=DC1394_VIDEO_MODE_FORMAT7_3;
   // configure the camera
-  if(coding==MONO)
+  if(this->stereo_coding==MONO)
   {
     this->coding=MONO;
     dc1394_coding=DC1394_COLOR_CODING_MONO16;
diff --git a/src/examples/bumblebee.cpp b/src/examples/bumblebee.cpp
index 982fc0f..98ebb2b 100755
--- a/src/examples/bumblebee.cpp
+++ b/src/examples/bumblebee.cpp
@@ -7,7 +7,7 @@
 #include <sstream>
 #include <iostream>
 
-const int num_frames=10;
+const int num_frames=1000;
 
 int main(int argc, char *argv[])
 {
diff --git a/src/examples/ladybug.cpp b/src/examples/ladybug.cpp
index 965fe9c..3978fd8 100755
--- a/src/examples/ladybug.cpp
+++ b/src/examples/ladybug.cpp
@@ -24,8 +24,6 @@ int main(int argc, char *argv[])
   char *front=NULL,*front_right=NULL,*rear_right=NULL,*rear_left=NULL,*front_left=NULL,*top=NULL;
   std::string new_frame,filename;
   std::stringstream text;
-  uint64_t guid=0x0000b09d01006b6fb5;
-//  uint64_t guid=0x00B09D01007D6D85LL;
   std::list<std::string> events;
 
   try
@@ -36,16 +34,18 @@ int main(int argc, char *argv[])
     server->init();
     std::cout << "Num. Cam. : " << server->get_num_cameras() << std::endl;
     /* get the new camera with index 0 */
-    /* get the new camera with guid = 0x00B09D01007D6D85 */
-//    server->get_pgr_stereo_camera_guid(guid,&camera1);
     server->get_ladybug_camera(0,&ladybug);
     /* get the reference to the event server */
     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=RGB;
     framerate=10;
     ladybug->set_config(&left_off,&top_off,&width,&height,&framerate,depth,coding);
+    ladybug->get_multi_config(&width,&height,&framerate,&depth,&coding);
+    std::cout << "Image size: " << width << "x" << height << std::endl;
+    std::cout << "Fremerate: " << framerate << std::endl;
+    std::cout << "Color coding: " << (int)coding << "-" << (int)depth << std::endl;
     ladybug->get_new_frame_event_id(new_frame);
     events.push_back(new_frame);
     ladybug->start();
diff --git a/src/ladybug.cpp b/src/ladybug.cpp
index 5ae1909..21a6b17 100755
--- a/src/ladybug.cpp
+++ b/src/ladybug.cpp
@@ -47,6 +47,15 @@ void CLadyBug::set_config(unsigned int *left_off,unsigned int *top_off,unsigned
     this->multi_coding=RGB;
 }
 
+void CLadyBug::get_multi_config(unsigned int *width,unsigned int *height, float *framerate, depths_t *depth, codings_t *coding)
+{
+  (*width)=this->multi_width;
+  (*height)=this->multi_height;
+  (*framerate)=this->framerate;
+  (*depth)=this->multi_depth;
+  (*coding)=this->multi_coding;
+}
+
 void CLadyBug::get_images(char **front, char **front_right, char **rear_right, char **rear_left, char **front_left, char **top)
 {
   int depth;
diff --git a/src/ladybug.h b/src/ladybug.h
index a81c4e1..f485aeb 100755
--- a/src/ladybug.h
+++ b/src/ladybug.h
@@ -37,6 +37,11 @@ class CLadyBug : public CPTGCamera
      * 
      */
     void set_config(unsigned int *left_off,unsigned int *top_off,unsigned int *width,unsigned int *height, float *framerate, depths_t depth, codings_t coding);
+    /** 
+     * \brief
+     * 
+     */
+    void get_multi_config(unsigned int *width,unsigned int *height, float *framerate, depths_t *depth, codings_t *coding);
     /** 
      * \brief
      * 
-- 
GitLab