From 9b6d8c3963fed02c582daa1f8446a183cae85da6 Mon Sep 17 00:00:00 2001 From: Vadim Pisarevsky Date: Fri, 17 Jun 2011 19:03:26 +0000 Subject: [PATCH] added reduce(..., CV_REDUCE_MIN/CV_REDUCE_MAX, ...) for 16u/16s (ticket #1145) --- modules/core/src/matrix.cpp | 68 ++++++++++++++++++++++++++++----------------- 1 file changed, 42 insertions(+), 26 deletions(-) diff --git a/modules/core/src/matrix.cpp b/modules/core/src/matrix.cpp index 0d9fa80..987b57a 100644 --- a/modules/core/src/matrix.cpp +++ b/modules/core/src/matrix.cpp @@ -1888,41 +1888,49 @@ void cv::reduce(InputArray _src, OutputArray _dst, int dim, int op, int dtype) { if(sdepth == CV_8U && ddepth == CV_32S) func = reduceR_ >; - if(sdepth == CV_8U && ddepth == CV_32F) + else if(sdepth == CV_8U && ddepth == CV_32F) func = reduceR_ >; - if(sdepth == CV_8U && ddepth == CV_64F) + else if(sdepth == CV_8U && ddepth == CV_64F) func = reduceR_ >; - if(sdepth == CV_16U && ddepth == CV_32F) + else if(sdepth == CV_16U && ddepth == CV_32F) func = reduceR_ >; - if(sdepth == CV_16U && ddepth == CV_64F) + else if(sdepth == CV_16U && ddepth == CV_64F) func = reduceR_ >; - if(sdepth == CV_16S && ddepth == CV_32F) + else if(sdepth == CV_16S && ddepth == CV_32F) func = reduceR_ >; - if(sdepth == CV_16S && ddepth == CV_64F) + else if(sdepth == CV_16S && ddepth == CV_64F) func = reduceR_ >; - if(sdepth == CV_32F && ddepth == CV_32F) + else if(sdepth == CV_32F && ddepth == CV_32F) func = reduceR_ >; - if(sdepth == CV_32F && ddepth == CV_64F) + else if(sdepth == CV_32F && ddepth == CV_64F) func = reduceR_ >; - if(sdepth == CV_64F && ddepth == CV_64F) + else if(sdepth == CV_64F && ddepth == CV_64F) func = reduceR_ >; } else if(op == CV_REDUCE_MAX) { if(sdepth == CV_8U && ddepth == CV_8U) func = reduceR_ >; - if(sdepth == CV_32F && ddepth == CV_32F) + else if(sdepth == CV_16U && ddepth == CV_16U) + func = reduceR_ >; + else if(sdepth == CV_16S && ddepth == CV_16S) + func = reduceR_ >; + else if(sdepth == CV_32F && ddepth == CV_32F) func = reduceR_ >; - if(sdepth == CV_64F && ddepth == CV_64F) + else if(sdepth == CV_64F && ddepth == CV_64F) func = reduceR_ >; } else if(op == CV_REDUCE_MIN) { if(sdepth == CV_8U && ddepth == CV_8U) func = reduceR_ >; - if(sdepth == CV_32F && ddepth == CV_32F) + else if(sdepth == CV_16U && ddepth == CV_16U) + func = reduceR_ >; + else if(sdepth == CV_16S && ddepth == CV_16S) + func = reduceR_ >; + else if(sdepth == CV_32F && ddepth == CV_32F) func = reduceR_ >; - if(sdepth == CV_64F && ddepth == CV_64F) + else if(sdepth == CV_64F && ddepth == CV_64F) func = reduceR_ >; } } @@ -1932,41 +1940,49 @@ void cv::reduce(InputArray _src, OutputArray _dst, int dim, int op, int dtype) { if(sdepth == CV_8U && ddepth == CV_32S) func = reduceC_ >; - if(sdepth == CV_8U && ddepth == CV_32F) + else if(sdepth == CV_8U && ddepth == CV_32F) func = reduceC_ >; - if(sdepth == CV_8U && ddepth == CV_64F) + else if(sdepth == CV_8U && ddepth == CV_64F) func = reduceC_ >; - if(sdepth == CV_16U && ddepth == CV_32F) + else if(sdepth == CV_16U && ddepth == CV_32F) func = reduceC_ >; - if(sdepth == CV_16U && ddepth == CV_64F) + else if(sdepth == CV_16U && ddepth == CV_64F) func = reduceC_ >; - if(sdepth == CV_16S && ddepth == CV_32F) + else if(sdepth == CV_16S && ddepth == CV_32F) func = reduceC_ >; - if(sdepth == CV_16S && ddepth == CV_64F) + else if(sdepth == CV_16S && ddepth == CV_64F) func = reduceC_ >; - if(sdepth == CV_32F && ddepth == CV_32F) + else if(sdepth == CV_32F && ddepth == CV_32F) func = reduceC_ >; - if(sdepth == CV_32F && ddepth == CV_64F) + else if(sdepth == CV_32F && ddepth == CV_64F) func = reduceC_ >; - if(sdepth == CV_64F && ddepth == CV_64F) + else if(sdepth == CV_64F && ddepth == CV_64F) func = reduceC_ >; } else if(op == CV_REDUCE_MAX) { if(sdepth == CV_8U && ddepth == CV_8U) func = reduceC_ >; - if(sdepth == CV_32F && ddepth == CV_32F) + else if(sdepth == CV_16U && ddepth == CV_16U) + func = reduceC_ >; + else if(sdepth == CV_16S && ddepth == CV_16S) + func = reduceC_ >; + else if(sdepth == CV_32F && ddepth == CV_32F) func = reduceC_ >; - if(sdepth == CV_64F && ddepth == CV_64F) + else if(sdepth == CV_64F && ddepth == CV_64F) func = reduceC_ >; } else if(op == CV_REDUCE_MIN) { if(sdepth == CV_8U && ddepth == CV_8U) func = reduceC_ >; - if(sdepth == CV_32F && ddepth == CV_32F) + else if(sdepth == CV_16U && ddepth == CV_16U) + func = reduceC_ >; + else if(sdepth == CV_16S && ddepth == CV_16S) + func = reduceC_ >; + else if(sdepth == CV_32F && ddepth == CV_32F) func = reduceC_ >; - if(sdepth == CV_64F && ddepth == CV_64F) + else if(sdepth == CV_64F && ddepth == CV_64F) func = reduceC_ >; } } -- 2.7.4