From e027979474123254be5ec860749e58496a91e603 Mon Sep 17 00:00:00 2001 From: Josh Klontz Date: Wed, 20 Mar 2013 23:09:50 -0400 Subject: [PATCH] fix Bin transform to correctly round integral types --- openbr/plugins/hist.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openbr/plugins/hist.cpp b/openbr/plugins/hist.cpp index 3c879e0..ccbc654 100644 --- a/openbr/plugins/hist.cpp +++ b/openbr/plugins/hist.cpp @@ -83,7 +83,8 @@ class BinTransform : public UntrainableTransform void project(const Template &src, Template &dst) const { - src.m().convertTo(dst, bins > 256 ? CV_16U : CV_8U, bins/(max-min), -0.5 /* floor */); + const double floor = ((src.m().depth() == CV_32F) || (src.m().depth() == CV_64F)) ? -0.5 : 0; + src.m().convertTo(dst, bins > 256 ? CV_16U : CV_8U, bins/(max-min), floor); if (!split) return; Mat input = dst; -- libgit2 0.21.4