I am bit unsure why this keep crashing.. Qt isn't providing me with an proper error message, but just states that it crashed.. I seems to me that the program crashes when I try to add the pixel values together.
here is the filter.
void filter(Mat src, Mat dst, int kernel, double P)
{
Mat temp = src.clone();
Mat output;
copyMakeBorder(temp,temp,kernel-1,kernel-1,kernel-1,kernel-1,BORDER_CONSTANT,Scalar(0,0,0));
int sum = 0;
for(int row = 0; row < temp.rows; row++)
{
for(int col = 0 ; col < temp.cols; col++)
{
for(int i = -floor(kernel/2); i <= floor(kernel/2) ; i++)
{
for(int j = -floor(kernel/2) ; j <= floor(kernel/2); j++)
{
sum += temp.at<int>(row+i,col+j);
}
}
output.at<uchar>(row,col) = pow(sum,P+1)/pow(sum,P);
sum = 0;
}
}
dst = output;
}