Different result with OPENCV C and C++ API (Border Interpolation difference)

Viewed 7160

I have performed Closing morphological operation and I am getting different result with the C and C++ API (OpenCV 2.4.2)

Input:

input

With OpenCV 'C':

//Set ROI
//Perform Gaussian smoothing
//Perform Canny edge analysis
cvMorphologyEx( src, dst, temp, Mat(), MORPH_CLOSE, 5 );

RESULT: http://i47.tinypic.com/33e0yfb.png

With Opencv C++

//Set ROI 
//Perform Gaussian smoothing 
//Perform Canny edge analysis
cv::morphologyEx( src, dst, cv::MORPH_CLOSE, cv::Mat(), cv::Point(-1,-1), 5 );

RESULT: http://i50.tinypic.com/i5vxjo.png

As you can see, the C++ API yields an output with White/Gray border color. Hence, the results are different for both of these APIs.

I have tried different borderType with the C++ API but it always yields the same result.

How can I get the same output as C API in C++? I need it because it affects the detected contours

Thanks in advance

3 Answers
Related