[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libcvd-members] libcvd/cvd vision.h
From: |
Gerhard Reitmayr |
Subject: |
[libcvd-members] libcvd/cvd vision.h |
Date: |
Thu, 04 Dec 2008 14:46:05 +0000 |
CVSROOT: /cvsroot/libcvd
Module name: libcvd
Changes by: Gerhard Reitmayr <gerhard> 08/12/04 14:46:05
Modified files:
cvd : vision.h
Log message:
sample does proper conversion between datatypes now and transform can
write to different output format
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/vision.h?cvsroot=libcvd&r1=1.30&r2=1.31
Patches:
Index: vision.h
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd/vision.h,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- vision.h 12 Jun 2008 13:04:13 -0000 1.30
+++ vision.h 4 Dec 2008 14:46:05 -0000 1.31
@@ -230,12 +230,14 @@
template <class T, class S> inline void sample(const BasicImage<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;
x -= lx;
y -= ly;
for(unsigned int i = 0; i < Pixel::Component<T>::count; i++){
- Pixel::Component<T>::get(result,i) = static_cast<typename
Pixel::Component<T>::type>(
+ Pixel::Component<T>::get(result,i) = Pixel::scalar_convert<TComp,SComp>(
(1-y)*((1-x)*Pixel::Component<S>::get(im[ly][lx],i) +
x*Pixel::Component<S>::get(im[ly][lx+1], i)) +
y * ((1-x)*Pixel::Component<S>::get(im[ly+1][lx],i) +
x*Pixel::Component<S>::get(im[ly+1][lx+1],i)));
}
@@ -275,8 +277,8 @@
* @return the number of pixels not in the in image
* @Note: this will collide with transform in the std namespace
*/
-template <class T>
-int transform(const BasicImage<T>& in, BasicImage<T>& out, const
TooN::Matrix<2>& M, const TooN::Vector<2>& inOrig, const TooN::Vector<2>&
outOrig, const T defaultValue = T())
+template <class T, class S>
+int transform(const BasicImage<S>& in, BasicImage<T>& out, const
TooN::Matrix<2>& M, const TooN::Vector<2>& inOrig, const TooN::Vector<2>&
outOrig, const T defaultValue = T())
{
const int w = out.size().x, h = out.size().y, iw = in.size().x, ih =
in.size().y;
const TooN::Vector<2> across = M.T()[0];
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [libcvd-members] libcvd/cvd vision.h,
Gerhard Reitmayr <=