Commit e15a2ea9 authored by Vadim Pisarevsky's avatar Vadim Pisarevsky

fixed remap with transparent border (ticket #582)

parent e6b2efeb
...@@ -513,6 +513,7 @@ IplConvKernelFP; ...@@ -513,6 +513,7 @@ IplConvKernelFP;
/* extra border mode */ /* extra border mode */
#define IPL_BORDER_REFLECT_101 4 #define IPL_BORDER_REFLECT_101 4
#define IPL_BORDER_TRANSPARENT 5
#define IPL_IMAGE_MAGIC_VAL ((int)sizeof(IplImage)) #define IPL_IMAGE_MAGIC_VAL ((int)sizeof(IplImage))
#define CV_TYPE_NAME_IMAGE "opencv-image" #define CV_TYPE_NAME_IMAGE "opencv-image"
......
...@@ -60,9 +60,10 @@ namespace cv ...@@ -60,9 +60,10 @@ namespace cv
//! various border interpolation methods //! various border interpolation methods
enum { BORDER_REPLICATE=IPL_BORDER_REPLICATE, BORDER_CONSTANT=IPL_BORDER_CONSTANT, enum { BORDER_REPLICATE=IPL_BORDER_REPLICATE, BORDER_CONSTANT=IPL_BORDER_CONSTANT,
BORDER_REFLECT=IPL_BORDER_REFLECT, BORDER_REFLECT_101=IPL_BORDER_REFLECT_101, BORDER_REFLECT=IPL_BORDER_REFLECT, BORDER_WRAP=IPL_BORDER_WRAP,
BORDER_REFLECT101=BORDER_REFLECT_101, BORDER_WRAP=IPL_BORDER_WRAP, BORDER_REFLECT_101=IPL_BORDER_REFLECT_101, BORDER_REFLECT101=BORDER_REFLECT_101,
BORDER_TRANSPARENT, BORDER_DEFAULT=BORDER_REFLECT_101, BORDER_ISOLATED=16 }; 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. //! 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 ); 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, ...@@ -2175,9 +2175,7 @@ static void remapBicubic( const Mat& _src, Mat& _dst, const Mat& _xy,
else else
{ {
int x[4], y[4]; int x[4], y[4];
if( borderType == BORDER_TRANSPARENT && if( borderType == BORDER_TRANSPARENT )
((unsigned)(sx+1) >= (unsigned)ssize.width ||
(unsigned)(sy+1) >= (unsigned)ssize.height) )
continue; continue;
if( borderType == BORDER_CONSTANT && if( borderType == BORDER_CONSTANT &&
...@@ -2277,9 +2275,7 @@ static void remapLanczos4( const Mat& _src, Mat& _dst, const Mat& _xy, ...@@ -2277,9 +2275,7 @@ static void remapLanczos4( const Mat& _src, Mat& _dst, const Mat& _xy,
else else
{ {
int x[8], y[8]; int x[8], y[8];
if( borderType == BORDER_TRANSPARENT && if( borderType == BORDER_TRANSPARENT )
((unsigned)(sx+3) >= (unsigned)ssize.width ||
(unsigned)(sy+3) >= (unsigned)ssize.height) )
continue; continue;
if( borderType == BORDER_CONSTANT && if( borderType == BORDER_CONSTANT &&
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment