[Jderobot-admin] jderobot-r1194 - trunk/src/stable/libs/visionlib/colorspaces

rocapal en jderobot.org rocapal en jderobot.org
Lun Mar 17 16:24:34 CET 2014


Author: rocapal
Date: 2014-03-17 16:24:34 +0100 (Mon, 17 Mar 2014)
New Revision: 1194

Modified:
   trunk/src/stable/libs/visionlib/colorspaces/imagecv.cpp
   trunk/src/stable/libs/visionlib/colorspaces/imagecv.h
Log:
#196 added DEPTH8 format


Modified: trunk/src/stable/libs/visionlib/colorspaces/imagecv.cpp
===================================================================
--- trunk/src/stable/libs/visionlib/colorspaces/imagecv.cpp	2014-03-17 10:16:19 UTC (rev 1193)
+++ trunk/src/stable/libs/visionlib/colorspaces/imagecv.cpp	2014-03-17 15:24:34 UTC (rev 1194)
@@ -54,6 +54,7 @@
   //static definitions
   const Image::FormatPtr Image::FORMAT_NONE = Image::Format::createFormat("NONE",0,0,0);
   const Image::FormatPtr ImageRGB8::FORMAT_RGB8 = Image::Format::createFormat("RGB8",CV_8UC3,&ImageRGB8::createInstance,&ImageRGB8::imageCvt);
+  const Image::FormatPtr ImageRGB8::FORMAT_DEPTH8 = Image::Format::createFormat("DEPTH8",CV_8UC3,&ImageRGB8::createInstance,&ImageRGB8::imageCvt);
   const Image::FormatPtr ImageYUY2::FORMAT_YUY2 = Image::Format::createFormat("YUY2",CV_8UC2,&ImageYUY2::createInstance,&ImageYUY2::imageCvt);
   const Image::FormatPtr ImageGRAY8::FORMAT_GRAY8 = Image::Format::createFormat("GRAY8",CV_8UC1,&ImageGRAY8::createInstance,&ImageGRAY8::imageCvt);
   const Image::FormatPtr ImageHSV8::FORMAT_HSV8 = Image::Format::createFormat("HSV8",CV_8UC3,&ImageHSV8::createInstance,&ImageHSV8::imageCvt);
@@ -101,8 +102,8 @@
   }
 
   Image& ImageRGB8::imageCvt(const Image& src, Image& dst) throw(NoConversion){
-    assert(src.format() == FORMAT_RGB8 && "src is not a RGB8 image");
-    if (dst.format() == FORMAT_RGB8)
+    assert((src.format() == FORMAT_RGB8 || src.format() == FORMAT_DEPTH8 ) && "src is not a RGB8 image");
+    if (dst.format() == FORMAT_RGB8 || src.format() == FORMAT_DEPTH8)
       dst = src;
     else {
       const ImageRGB8 srcRgb8(src);//cast src to rgb image

Modified: trunk/src/stable/libs/visionlib/colorspaces/imagecv.h
===================================================================
--- trunk/src/stable/libs/visionlib/colorspaces/imagecv.h	2014-03-17 10:16:19 UTC (rev 1193)
+++ trunk/src/stable/libs/visionlib/colorspaces/imagecv.h	2014-03-17 15:24:34 UTC (rev 1194)
@@ -182,7 +182,7 @@
      */
     static Image* createInstance(const int width, const int height, void *const data);
     static Image& imageCvt(const Image& src, Image& dst) throw(NoConversion);
-    static const FormatPtr FORMAT_RGB8;
+    static const FormatPtr FORMAT_RGB8, FORMAT_DEPTH8;
   };
 
   /**



More information about the Jderobot-admin mailing list