From 3fa630639f86047912b923b0faf162a537479c0c Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Mon, 26 Nov 2012 19:45:56 +0400 Subject: [PATCH] fixed bayer2bgra in case when size.width <= 2 --- modules/imgproc/src/demosaicing.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/modules/imgproc/src/demosaicing.cpp b/modules/imgproc/src/demosaicing.cpp index d78f4fb045..38ec17e03a 100644 --- a/modules/imgproc/src/demosaicing.cpp +++ b/modules/imgproc/src/demosaicing.cpp @@ -355,9 +355,17 @@ public: // in case of when size.width <= 2 if( size.width <= 0 ) { - // ? - dst[-4] = dst[-3] = dst[-2] = dst[size.width*3-1] = - dst[size.width*3] = dst[size.width*3+1] = 0; + if (dcn == 3) + { + dst[-4] = dst[-3] = dst[-2] = dst[size.width*dcn-1] = + dst[size.width*dcn] = dst[size.width*dcn+1] = 0; + } + else + { + dst[-5] = dst[-4] = dst[-3] = dst[size.width*dcn-1] = + dst[size.width*dcn] = dst[size.width*dcn+1] = 0; + dst[-2] = dst[size.width*dcn+2] = alpha; + } continue; }