Discrepancy in Convolution Result between OpenCV and MATLAB

I am currently working on a project involving image processing, and I am encountering a discrepancy in the convolution result between OpenCV and MATLAB. I’m hoping to get some insights on what might be causing this difference.

cv::Mat wind = cv::Mat(10, 10, CV_64F, cv::Scalar(1.0));
cv::Mat result;
cv::filter2D(HiCoe, result, -1, wind, cv::Point(1, 1), 0, cv::BORDER_CONSTANT);

HiCoe is a CV_64F data type that I calculated previously. I have also verified that both the input image (HiCoe) and the convolution kernel (wind) have the same values in both OpenCV and MATLAB.

Can anyone provide insights into why this difference might be occurring? Are there any considerations or adjustments I should be aware of when performing convolutions using cv::filter2D in OpenCV?

Thank you in advance for your help!

This seems to be very difficult to debug. If I copy the values of HiCoe and use a small code to convolve with wind, everything seems to be fine. Any suggestion on how I can go about debugging this? After some testing, I only get the expected answer if I use

cv::filter2D(cv::abs(HiCoe), result, -1, wind, cv::Point(1, 1), 0, cv::BORDER_CONSTANT);

even though all elements in HiCoe and wind are positive