fixed remap with transparent border (ticket #582)

pull/13383/head
Vadim Pisarevsky 14 years ago
parent e6b2efeb11
commit e15a2ea95a
  1. 1
      modules/core/include/opencv2/core/types_c.h
  2. 7
      modules/imgproc/include/opencv2/imgproc/imgproc.hpp
  3. 8
      modules/imgproc/src/imgwarp.cpp

@ -513,6 +513,7 @@ IplConvKernelFP;
/* extra border mode */
#define IPL_BORDER_REFLECT_101 4
#define IPL_BORDER_TRANSPARENT 5
#define IPL_IMAGE_MAGIC_VAL ((int)sizeof(IplImage))
#define CV_TYPE_NAME_IMAGE "opencv-image"

@ -60,9 +60,10 @@ namespace cv
//! various border interpolation methods
enum { BORDER_REPLICATE=IPL_BORDER_REPLICATE, BORDER_CONSTANT=IPL_BORDER_CONSTANT,
BORDER_REFLECT=IPL_BORDER_REFLECT, BORDER_REFLECT_101=IPL_BORDER_REFLECT_101,
BORDER_REFLECT101=BORDER_REFLECT_101, BORDER_WRAP=IPL_BORDER_WRAP,
BORDER_TRANSPARENT, BORDER_DEFAULT=BORDER_REFLECT_101, BORDER_ISOLATED=16 };
BORDER_REFLECT=IPL_BORDER_REFLECT, BORDER_WRAP=IPL_BORDER_WRAP,
BORDER_REFLECT_101=IPL_BORDER_REFLECT_101, BORDER_REFLECT101=BORDER_REFLECT_101,
BORDER_TRANSPARENT=IPL_BORDER_TRANSPARENT,
BORDER_DEFAULT=BORDER_REFLECT_101, BORDER_ISOLATED=16 };
//! 1D interpolation function: returns coordinate of the "donor" pixel for the specified location p.
CV_EXPORTS_W int borderInterpolate( int p, int len, int borderType );

@ -2175,9 +2175,7 @@ static void remapBicubic( const Mat& _src, Mat& _dst, const Mat& _xy,
else
{
int x[4], y[4];
if( borderType == BORDER_TRANSPARENT &&
((unsigned)(sx+1) >= (unsigned)ssize.width ||
(unsigned)(sy+1) >= (unsigned)ssize.height) )
if( borderType == BORDER_TRANSPARENT )
continue;
if( borderType == BORDER_CONSTANT &&
@ -2277,9 +2275,7 @@ static void remapLanczos4( const Mat& _src, Mat& _dst, const Mat& _xy,
else
{
int x[8], y[8];
if( borderType == BORDER_TRANSPARENT &&
((unsigned)(sx+3) >= (unsigned)ssize.width ||
(unsigned)(sy+3) >= (unsigned)ssize.height) )
if( borderType == BORDER_TRANSPARENT )
continue;
if( borderType == BORDER_CONSTANT &&

Loading…
Cancel
Save