Mat rowPaddedImage; //Row filter int filter_size = 7; int h = filter_size / 2; int top, bottom, left, right; top = bottom = left = right = h;
Scalar value(0, 0, 0);
copyMakeBorder(double_src, rowPaddedImage, 0, 0, left, right, BORDER_CONSTANT, value);
for (int i = 0; i < rowPaddedImage.rows; i++) //For img
{
for (int j = h; j < rowPaddedImage.cols - h; j++) //For img
{
for (int l = 0; l < f_size; l++)
{
colPaddedImage.at<vec3d>(i + h, j - h)[0] += rowPaddedImage.at<vec3d>(i, j - h + l)[0] * filter[l];
colPaddedImage.at<vec3d>(i + h, j - h)[1] += rowPaddedImage.at<vec3d>(i, j - h + l)[1] * filter[l];
colPaddedImage.at<vec3d>(i + h, j - h)[2] += rowPaddedImage.at<vec3d>(i, j - h + l)[2] * filter[l];
}
}
}
//The row "rowPaddedImage" is getting bigger and bigger after the row filter function is being called. If I called twice the padded row borders is 6 it is twice, if I call thrice it become three time the padded size.