[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libcvd-members] libcvd/cvd vision.h
From: |
Dr. JJN |
Subject: |
[libcvd-members] libcvd/cvd vision.h |
Date: |
Mon, 15 Jan 2007 19:24:12 +0000 |
CVSROOT: /sources/libcvd
Module name: libcvd
Changes by: Dr. JJN <jjneubert> 07/01/15 19:24:12
Modified files:
cvd : vision.h
Log message:
fixed small error
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/vision.h?cvsroot=libcvd&r1=1.23&r2=1.24
Patches:
Index: vision.h
===================================================================
RCS file: /sources/libcvd/libcvd/cvd/vision.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- vision.h 9 Jan 2007 18:27:45 -0000 1.23
+++ vision.h 15 Jan 2007 19:24:12 -0000 1.24
@@ -385,13 +385,14 @@
* @param M the matrix used to map point in the out matrix to those in the in
matrix
* @param inOrig origin in the in image
* @param outOrig origin in the out image
+ * @return the number of pixels not in the in image
* @Note: this will collide with transform in the std namespace
*/
template <class T>
-void transform(const BasicImage<T>& in, BasicImage<T>& out, const
TooN::Matrix<2>& M, const TooN::Vector<2>& inOrig, const TooN::Vector<2>&
outOrig)
+int transform(const BasicImage<T>& in, BasicImage<T>& out, const
TooN::Matrix<2>& M, const TooN::Vector<2>& inOrig, const TooN::Vector<2>&
outOrig)
{
int i,j;
- int w = out.size().x, h = out.size().y, iw = in.size().x, ih = in.size().y;
+ const int w = out.size().x, h = out.size().y, iw = in.size().x, ih =
in.size().y;
TooN::Vector<2> base;
TooN::Vector<2> p;
@@ -412,7 +413,7 @@
//If the patch being extracted is completely in the image then no
//check is needed with each point.
- if ( p[0] < iw && p[1] < ih && base[0] >=0 && base[1] >=0 )
+ if ( p[0] < iw-1 && p[1] < ih-1 && base[0] >=0 && base[1] >=0 )
{
base = M * -outOrig + inOrig;
for (j=0;j<h;++j,base+=down)
@@ -422,6 +423,7 @@
sample(in,p[0],p[1],out[j][i]);
}
} else {
+ int tmp = 0;
base = M * -outOrig + inOrig;
for (j=0;j<h;++j,base+=down)
{
@@ -429,14 +431,17 @@
for (i=0;i<w;++i, p+=across)
{
//Make sure that we are extracting pixels in the image
- if ( p[0] < 0 || p[1] < 0 || p[0] >= iw || p[1] >= ih)
+ if ( p[0] < 0 || p[1] < 0 || p[0] >= iw-1 || p[1] >= ih-1)
{
zeroPixel(out[j][i]);
+ tmp++;
} else
sample(in,p[0],p[1],out[j][i]);
}
}
+ return tmp;
}
+ return 0;
}
template <class T> void transform(const BasicImage<T>& in, BasicImage<T>&
out, const TooN::Matrix<3>& Minv /* <-- takes points in "out" to points in "in"
*/)