Ask Your Question

filter2D in opencv-2.1 and opencv-2.4.3

asked 2013-03-12 15:59:23 -0500

rgadde gravatar image

updated 2013-03-12 16:25:46 -0500


Due to some reason I have to downgrade my opencv from 2.4.3 to 2.1. I observed that filter2D is not functioning properly in case of 2.1. Also the border type BORDER_REFLECT is giving error in some cases. The output for both the versions is different. Please suggest me an alternative for filter2d in opencv-2.1

edit retag flag offensive close merge delete


Just a remark, why the hell would someone choose to downgrade towards a lower version of openCV. Higher versions mean more bugs fixed, more problems solved, more functionality. You cannot expect that newer functionality will still work as good when downgrading.

I guess when considering why you downgraded, it will be easier to cope with that problem, than to cope with these kind of errors...

StevenPuttemans gravatar imageStevenPuttemans ( 2013-03-13 08:29:37 -0500 )edit

@steven Even I don't like downgrading. It's pain. But, I am in kind of situation where I "have to" use OPENCV - 2.1

rgadde gravatar imagergadde ( 2013-03-13 08:36:13 -0500 )edit

Found the solution. Will post in 23 hrs, as this forum is not letting me to post

rgadde gravatar imagergadde ( 2013-03-13 16:40:36 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2013-03-13 09:11:40 -0500

updated 2013-03-13 09:12:35 -0500

Some research in this showed me on the actual documentation of openCV2.1 this:

It is stated there that you should use border types declared at the interpolate function. Looking at that exact link:

I noticed that BORDER_REFLECT is defined there as BORDER_REFLECT_101

Could you see if that solves problems? And could you please post your complete C++ rule, so that I can take a look at the arguments.

edit flag offensive delete link more


@steven Thanks for the answer. I am not much concerned about the BORDER_REFLECT even, the output is not the same for both versions(No change in documentation for filter2d for both versions).

img.convertTo(img,CV_32F); Point anchor(-1,-1); filterkernel.convertTo(filterkernel,CV_32F); filter2D(img, result, -1,flippedkernel , anchor, 0, BORDER_REFLECT_101);

rgadde gravatar imagergadde ( 2013-03-13 10:05:20 -0500 )edit
Login/Signup to Answer

Question Tools


Asked: 2013-03-12 15:59:23 -0500

Seen: 354 times

Last updated: Mar 13 '13