[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libcvd-members] libcvd/cvd/internal scalar_convert.h
From: |
Colin Starr |
Subject: |
[libcvd-members] libcvd/cvd/internal scalar_convert.h |
Date: |
Mon, 15 May 2006 16:37:41 +0000 |
CVSROOT: /cvsroot/libcvd
Module name: libcvd
Branch:
Changes by: Colin Starr <address@hidden> 06/05/15 16:37:41
Modified files:
cvd/internal : scalar_convert.h
Log message:
Added specialisation of ScalarConvert to fix incorrect image conversion
from Rgb<byte> to float.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/libcvd/libcvd/cvd/internal/scalar_convert.h.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
Patches:
Index: libcvd/cvd/internal/scalar_convert.h
diff -u libcvd/cvd/internal/scalar_convert.h:1.8
libcvd/cvd/internal/scalar_convert.h:1.9
--- libcvd/cvd/internal/scalar_convert.h:1.8 Fri May 5 16:42:21 2006
+++ libcvd/cvd/internal/scalar_convert.h Mon May 15 16:37:41 2006
@@ -131,13 +131,36 @@
return byte_to_float(from);
}
};
-
template <class D> struct ScalarConvert<byte,double,D,false> {
static inline double from(const D& from) {
return byte_to_double(from);
}
};
+ inline double byte_float_to_float(double d) {
+ return d *
traits<double>::max_intensity/traits<byte>::max_intensity;
+ }
+
+ template <> struct ScalarConvert<byte,float,float,false> {
+ static inline float from(const float& from) {
+ return byte_float_to_float(from);
+ }
+ };
+ template <> struct ScalarConvert<byte,double,float,false> {
+ static inline double from(const float& from) {
+ return byte_float_to_float(from);
+ }
+ };
+ template <> struct ScalarConvert<byte,float,double,false> {
+ static inline float from(const double& from) {
+ return byte_float_to_float(from);
+ }
+ };
+ template <> struct ScalarConvert<byte,double,double,false> {
+ static inline double from(const double& from) {
+ return byte_float_to_float(from);
+ }
+ };
}
- [libcvd-members] libcvd/cvd/internal scalar_convert.h,
Colin Starr <=