I am trying to implement the 2 convolution.
I am trying to calculate new x and y values for the a copy pf theoutput in opencv and then after the math calculations I copy the image into the original output image. When I compile and look at the new output picture no changes have been made Am I calculating the new values for the x and y axis correctly?
Could someone help me out ? Thank you in advance.
convolution(const Mat &input, Mat &output, const Mat &kernel) {
Mat copy_of_input = (Mat_<float>(3,3));
int border = 1;
Mat copy_out;
copyMakeBorder(input, copy_of_input, border, border,border,border, BORDER_REPLICATE);
for(int x=0; x < copy_of_input.rows; ++x)
{
for(int y=0; y < copy_of_input.cols; ++y)
{
for(int kx=0; kx < kernel.rows; ++kx)
{
for(int ky=0; ky < kernel.cols; ++ky)
{
x = copy_of_input.at<int>(x,y)*(y+ky-((kernel.rows-1)/2))*kernel.at<float>(ky,kx);
//new x value for copy_of_input
y = copy_of_input.at<int>(x,y)*(x+kx-((kernel.cols-1)/2))*kernel.at<float>(ky,kx);
//new y value for copy_of_input
}
}
}
}
copy_of_input.copyTo(output);
}
Please login or Register to submit your answer