Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Where I was wrong in this row filtering code

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);

//Row filter for (int i = 0; i < rowPaddedImage.rows; i++) //For img { for (int j = h; j < rowPaddedImage.cols - h; j++) //For img { b = g = r = 0.0; for (int l = 0; l < f_size; l++) { colPaddedImage.at<vec3d>(Point(i + h, j - h))[0] += rowPaddedImage.at<vec3d>(Point(i, j - h + l))[0] * filter[l]; colPaddedImage.at<vec3d>(Point(i + h, j - h))[1] += rowPaddedImage.at<vec3d>(Point(i, j - h + l))[1] * filter[l]; colPaddedImage.at<vec3d>(Point(i + h, j - h))[2] += rowPaddedImage.at<vec3d>(Point(i, j - h + l))[2] * filter[l]; }//Kernel loop end } }

Where I was wrong in this row filtering code

Code :

 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);

value); //Row filter for (int i = 0; i < rowPaddedImage.rows; i++) //For img { for (int j = h; j < rowPaddedImage.cols - h; j++) //For img { b = g = r = 0.0; for (int l = 0; l < f_size; l++) { colPaddedImage.at<vec3d>(Point(i colPaddedImage.at<Vec3d>(Point(i + h, j - h))[0] += rowPaddedImage.at<vec3d>(Point(i, rowPaddedImage.at<Vec3d>(Point(i, j - h + l))[0] * filter[l]; colPaddedImage.at<vec3d>(Point(i colPaddedImage.at<Vec3d>(Point(i + h, j - h))[1] += rowPaddedImage.at<vec3d>(Point(i, rowPaddedImage.at<Vec3d>(Point(i, j - h + l))[1] * filter[l]; colPaddedImage.at<vec3d>(Point(i colPaddedImage.at<Vec3d>(Point(i + h, j - h))[2] += rowPaddedImage.at<vec3d>(Point(i, rowPaddedImage.at<Vec3d>(Point(i, j - h + l))[2] * filter[l]; }//Kernel loop end } }

}