From 04ac6db04a07ceb95f3344ae9d936534bfea1891 Mon Sep 17 00:00:00 2001 From: Ilya Lysenkov Date: Thu, 12 Apr 2012 10:55:47 +0000 Subject: [PATCH] Added support of CV_16S depth in morphology operations --- modules/imgproc/src/morph.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/imgproc/src/morph.cpp b/modules/imgproc/src/morph.cpp index 06fd5ba..4488bc4 100644 --- a/modules/imgproc/src/morph.cpp +++ b/modules/imgproc/src/morph.cpp @@ -983,13 +983,14 @@ cv::Ptr cv::createMorphologyFilter( int op, int type, InputArr borderValue == morphologyDefaultBorderValue() ) { int depth = CV_MAT_DEPTH(type); - CV_Assert( depth == CV_8U || depth == CV_16U || depth == CV_32F ); + CV_Assert( depth == CV_8U || depth == CV_16U || depth == CV_16S || depth == CV_32F ); if( op == MORPH_ERODE ) borderValue = Scalar::all( depth == CV_8U ? (double)UCHAR_MAX : - depth == CV_16U ? (double)USHRT_MAX : (double)FLT_MAX ); + depth == CV_16U ? (double)USHRT_MAX : + depth == CV_16S ? (double)SHRT_MAX : (double)FLT_MAX ); else - borderValue = Scalar::all( depth == CV_8U || depth == CV_16U ? - 0. : (double)-FLT_MAX ); + borderValue = Scalar::all( depth == CV_8U || depth == CV_16U ? 0. : + depth == CV_16S ? (double)SHRT_MIN : (double)-FLT_MAX ); } return Ptr(new FilterEngine(filter2D, rowFilter, columnFilter, -- 2.7.4