libcvd-members
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libcvd-members] libcvd/cvd image.h vision.h


From: Gerhard Reitmayr
Subject: [libcvd-members] libcvd/cvd image.h vision.h
Date: Fri, 04 Mar 2011 09:40:47 +0000

CVSROOT:        /cvsroot/libcvd
Module name:    libcvd
Changes by:     Gerhard Reitmayr <gerhard>      11/03/04 09:40:47

Modified files:
        cvd            : image.h vision.h 

Log message:
        small fix in image.h for the IMAGE_ASSERT macros, made sample work on 
SubImages

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/image.h?cvsroot=libcvd&r1=1.52&r2=1.53
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/vision.h?cvsroot=libcvd&r1=1.37&r2=1.38

Patches:
Index: image.h
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd/image.h,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -b -r1.52 -r1.53
--- image.h     28 Feb 2011 10:57:49 -0000      1.52
+++ image.h     4 Mar 2011 09:40:46 -0000       1.53
@@ -84,7 +84,7 @@
        #define CVD_IMAGE_ASSERT2(X,Y,Z)  if(!(X)) throw Y(Z)
 #else
        #define CVD_IMAGE_ASSERT(X,Y)
-       #define CVD_IMAGE_ASSERT2(X,Y)
+       #define CVD_IMAGE_ASSERT2(X,Y,Z)
 #endif
 
 /// Fatal image errors (used for debugging). These are not included in the

Index: vision.h
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd/vision.h,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -b -r1.37 -r1.38
--- vision.h    12 Nov 2010 14:07:31 -0000      1.37
+++ vision.h    4 Mar 2011 09:40:46 -0000       1.38
@@ -270,12 +270,12 @@
 #endif
 
 
-template <class T, class S> inline void sample(const BasicImage<S>& im, double 
x, double y, T& result)
+template <class T, class S> inline void sample(const SubImage<S>& im, double 
x, double y, T& result)
 {
   typedef typename Pixel::Component<S>::type SComp;
   typedef typename Pixel::Component<T>::type TComp;
-  int lx = (int)x;
-  int ly = (int)y;
+  const int lx = (int)x;
+  const int ly = (int)y;
   x -= lx;
   y -= ly;
   for(unsigned int i = 0; i < Pixel::Component<T>::count; i++){
@@ -285,27 +285,27 @@
   }
  }
 
-template <class T, class S> inline T sample(const BasicImage<S>& im, double x, 
double y){
+template <class T, class S> inline T sample(const SubImage<S>& im, double x, 
double y){
     T result;
     sample( im, x, y, result);
     return result;
 }
 
-inline void sample(const BasicImage<float>& im, double x, double y, float& 
result)
-  {
-    int lx = (int)x;
-    int ly = (int)y;
-    int w = im.size().x;
+inline void sample(const SubImage<float>& im, double x, double y, float& 
result)
+{
+    const int lx = (int)x;
+    const int ly = (int)y;
+    const int w = im.row_stride();
     const float* base = im[ly]+lx;
-    float a = base[0];
-    float b = base[1];
-    float c = base[w];
-    float d = base[w+1];
-    float e = a-b;
+    const float a = base[0];
+    const float b = base[1];
+    const float c = base[w];
+    const float d = base[w+1];
+    const float e = a-b;
     x-=lx;
     y-=ly;
     result = (float)(x*(y*(e-c+d)-e)+y*(c-a)+a);
-  }
+}
 
 #if defined (CVD_HAVE_TOON)
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]