[Fawkes Git] branch/timn/vis-colormap: created (0.5.0-3084-g1f49050)

Tim Niemueller niemueller at kbsg.rwth-aachen.de
Wed Mar 9 00:46:02 CET 2016


Changes have been pushed for the project "Fawkes Robotics Software Framework".

Gitweb: http://git.fawkesrobotics.org/fawkes.git
Trac:   http://trac.fawkesrobotics.org

The branch, timn/vis-colormap has been created
        at  1f49050201631bc7bfb01bbd8f8b2f0dc08f0d01 (commit)

http://git.fawkesrobotics.org/fawkes.git/timn/vis-colormap

- *Log* ---------------------------------------------------------------
commit 081821c2b39eabc19342c20ee2dfaea1326e968c
Author:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
AuthorDate: Wed Mar 9 00:42:24 2016 +0100
Commit:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
CommitDate: Wed Mar 9 00:45:44 2016 +0100

    fvmodels: move color LUT model's determine to cpp
    
    The method could not be inlined anyway since it is a virtual one.

http://git.fawkesrobotics.org/fawkes.git/commit/081821c
http://trac.fawkesrobotics.org/changeset/081821c

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit 3484b0f204b7a6a06ec1ed685d29e0f1d717791f
Author:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
AuthorDate: Wed Mar 9 00:43:25 2016 +0100
Commit:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
CommitDate: Wed Mar 9 00:45:44 2016 +0100

    fvutils: fix too narrow variable
    
    Counter was uint8, but limit uint16, hence overflow if 256 blocks in a
    file, which is precisely the case if the depth of a colormap is 256.

http://git.fawkesrobotics.org/fawkes.git/commit/3484b0f
http://trac.fawkesrobotics.org/changeset/3484b0f

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit 76cd2b7c2e4736abf116de0bfc41f4bf0cdb6896
Author:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
AuthorDate: Wed Mar 9 00:44:26 2016 +0100
Commit:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
CommitDate: Wed Mar 9 00:45:45 2016 +0100

    fvcams: add simple BufferCamera
    
    This camera just holds a buffer to pass around with a Camera interface
    and can be handy from time to time.

http://git.fawkesrobotics.org/fawkes.git/commit/76cd2b7
http://trac.fawkesrobotics.org/changeset/76cd2b7

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit 1f49050201631bc7bfb01bbd8f8b2f0dc08f0d01
Author:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
AuthorDate: Wed Mar 9 00:44:56 2016 +0100
Commit:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
CommitDate: Wed Mar 9 00:45:45 2016 +0100

    fvviewer: support stepping through Y value of colormaps

http://git.fawkesrobotics.org/fawkes.git/commit/1f49050
http://trac.fawkesrobotics.org/changeset/1f49050

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


- *Summary* -----------------------------------------------------------
 src/libs/fvcams/Makefile                   |    1 +
 src/libs/fvcams/buffer.cpp                 |  160 ++++++++++++++++++++++++++++
 src/libs/fvcams/{fileloader.h => buffer.h} |   53 +++-------
 src/libs/fvutils/fileformat/fvfile.cpp     |    2 +-
 src/tools/vision/viewer.cpp                |   35 ++++++-
 5 files changed, 207 insertions(+), 44 deletions(-)
 create mode 100644 src/libs/fvcams/buffer.cpp
 copy src/libs/fvcams/{fileloader.h => buffer.h} (57%)


- *Diffs* -------------------------------------------------------------

- *commit* 081821c2b39eabc19342c20ee2dfaea1326e968c - - - - - - - - - -
Author:  Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
Date:    Wed Mar 9 00:42:24 2016 +0100
Subject: fvmodels: move color LUT model's determine to cpp

 src/libs/fvmodels/color/lookuptable.cpp |    5 +++++
 src/libs/fvmodels/color/lookuptable.h   |    7 -------
 2 files changed, 5 insertions(+), 7 deletions(-)

_Diff for modified files_:
diff --git a/src/libs/fvmodels/color/lookuptable.cpp b/src/libs/fvmodels/color/lookuptable.cpp
index 7542679..e4c5a3f 100644
--- a/src/libs/fvmodels/color/lookuptable.cpp
+++ b/src/libs/fvmodels/color/lookuptable.cpp
@@ -131,6 +131,11 @@ ColorModelLookupTable::~ColorModelLookupTable()
   delete __colormap;
 }
 
+color_t
+ColorModelLookupTable::determine(unsigned int y, unsigned int u, unsigned int v) const
+{
+  return __colormap->determine(y, u, v);
+}
 
 const char *
 ColorModelLookupTable::get_name()
diff --git a/src/libs/fvmodels/color/lookuptable.h b/src/libs/fvmodels/color/lookuptable.h
index 566a4c9..471669b 100644
--- a/src/libs/fvmodels/color/lookuptable.h
+++ b/src/libs/fvmodels/color/lookuptable.h
@@ -64,13 +64,6 @@ class ColorModelLookupTable : public ColorModel
   YuvColormap *__colormap;
 };
 
-
-inline color_t
-ColorModelLookupTable::determine(unsigned int y, unsigned int u, unsigned int v) const
-{
-  return __colormap->determine(y, u, v);
-}
-
 } // end namespace firevision
 
 #endif

- *commit* 3484b0f204b7a6a06ec1ed685d29e0f1d717791f - - - - - - - - - -
Author:  Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
Date:    Wed Mar 9 00:43:25 2016 +0100
Subject: fvutils: fix too narrow variable

 src/libs/fvutils/fileformat/fvfile.cpp |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

_Diff for modified files_:
diff --git a/src/libs/fvutils/fileformat/fvfile.cpp b/src/libs/fvutils/fileformat/fvfile.cpp
index 1d3b2da..576cb6e 100644
--- a/src/libs/fvutils/fileformat/fvfile.cpp
+++ b/src/libs/fvutils/fileformat/fvfile.cpp
@@ -364,7 +364,7 @@ FireVisionDataFile::read(const char *file_name)
   }
 
   //printf("Reading %u blocks\n", __header->num_blocks);
-  for (uint8_t b = 0; b < __header->num_blocks && !feof(f); ++b) {
+  for (unsigned int b = 0; b < __header->num_blocks && !feof(f); ++b) {
     fvff_block_header_t bh;
     //printf("Reading %zu bytes for block header\n", sizeof(bh));
     if ( fread(&bh, sizeof(bh), 1, f) != 1 ) {

- *commit* 76cd2b7c2e4736abf116de0bfc41f4bf0cdb6896 - - - - - - - - - -
Author:  Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
Date:    Wed Mar 9 00:44:26 2016 +0100
Subject: fvcams: add simple BufferCamera

 src/libs/fvcams/Makefile                   |    1 +
 src/libs/fvcams/buffer.cpp                 |  160 ++++++++++++++++++++++++++++
 src/libs/fvcams/{fileloader.h => buffer.h} |   53 +++-------
 3 files changed, 174 insertions(+), 40 deletions(-)

_Diff for modified files_:
diff --git a/src/libs/fvcams/Makefile b/src/libs/fvcams/Makefile
index d26933a..4567bea 100644
--- a/src/libs/fvcams/Makefile
+++ b/src/libs/fvcams/Makefile
@@ -28,6 +28,7 @@ LDFLAGS_libfvcams = $(VISION_CAM_LDFLAGS)
 
 LIBS_libfvcams = $(VISION_CAM_LIBS) fawkescore fawkesutils fvutils fawkeslogging
 OBJS_libfvcams = camera.o          \
+                 buffer.o          \
                  control/control.o \
                  control/color.o   \
                  control/image.o   \

- *commit* 1f49050201631bc7bfb01bbd8f8b2f0dc08f0d01 - - - - - - - - - -
Author:  Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
Date:    Wed Mar 9 00:44:56 2016 +0100
Subject: fvviewer: support stepping through Y value of colormaps

 src/tools/vision/viewer.cpp |   35 ++++++++++++++++++++++++++++++++---
 1 files changed, 32 insertions(+), 3 deletions(-)

_Diff for modified files_:
diff --git a/src/tools/vision/viewer.cpp b/src/tools/vision/viewer.cpp
index f7712e6..c0b433b 100644
--- a/src/tools/vision/viewer.cpp
+++ b/src/tools/vision/viewer.cpp
@@ -25,6 +25,7 @@
 #include <utils/system/argparser.h>
 
 #include <fvcams/factory.h>
+#include <fvcams/buffer.h>
 #ifdef HAVE_SHMEM_CAM
 #include <fvcams/shmem.h>
 #endif
@@ -41,6 +42,9 @@
 #include <fvutils/rectification/rectinfo_block.h>
 #include <fvfilters/rectify.h>
 #endif
+#include <fvutils/colormap/colormap.h>
+#include <fvutils/colormap/cmfile.h>
+#include <fvutils/system/filetype.h>
 
 #include <cstring>
 #include <cstdio>
@@ -116,6 +120,8 @@ main(int argc, char **argv)
   SharedMemoryImageBuffer *buf = NULL;
   bool verbose = argp.has_arg("v");
   int delay = 0;
+  Colormap *colormap = NULL;
+  unsigned int colormap_y = 0;
 
   if ( argp.has_arg("d") ) {
     delay = atoi(argp.arg("d"));
@@ -134,8 +140,20 @@ main(int argc, char **argv)
 #endif
   } else if ( argp.has_arg("f") ) {
 #ifdef HAVE_FILELOADER_CAM
-    title = std::string("File: ").append(argp.arg("f"));
-    cam = new FileLoader(argp.arg("f"));
+    std::string filename = argp.arg("f");
+    title = std::string("File: ").append(filename);
+    std::string ft = fv_filetype_file(filename.c_str());
+
+    if (ft == "FvColormap") {
+	    ColormapFile cm_file;
+	    cm_file.read(filename.c_str());
+	    colormap = cm_file.get_colormap();
+
+	    cam = new BufferCamera(YUV422_PLANAR, 512, 512);
+	    colormap->to_image(cam->buffer(), colormap_y);
+    } else {
+	    cam = new FileLoader(filename.c_str());
+    }
 #else
     throw Exception("FileLoader not available at compile time");
 #endif
@@ -288,6 +306,16 @@ main(int argc, char **argv)
 	    delay = 0;
 	  }
 	  printf("New delay: %i ms\n", delay);
+	} else if ( event.key.keysym.sym == SDLK_UP ) {
+		colormap_y = std::min(255u, colormap_y + 5);
+		printf("Colormap new Y (+): %u\n", colormap_y);
+		colormap->to_image(cam->buffer(), colormap_y);
+	  SDL_PushEvent(&redraw_event);
+	} else if ( event.key.keysym.sym == SDLK_DOWN ) {
+		colormap_y = std::max(0, (int)colormap_y - 5);
+		printf("Colormap new Y (-): %u\n", colormap_y);
+		colormap->to_image(cam->buffer(), colormap_y);
+	  SDL_PushEvent(&redraw_event);
 	} else if ( event.key.keysym.sym == SDLK_r ) {
 #ifdef HAVE_GTKMM
 #  ifdef HAVE_RECTINFO
@@ -417,7 +445,8 @@ main(int argc, char **argv)
   cam->close();
   delete cam;
   delete display;
-
+  delete colormap;
+  
   return 0;
 }
 




-- 
Fawkes Robotics Framework                 http://www.fawkesrobotics.org


More information about the fawkes-commits mailing list