我是初学者,正在学习如何编写过滤器。我一次又一次地尝试它,但还没有让它工作。谁能帮我找出我的代码有什么问题?
double alpha;
int beta;
int main( int argc, char** argv )
{
Mat image = imread("test.png",1 );
Mat new_image = Mat::zeros( image.size(), image.type() );
for( int y = 0; y < image.rows; y++ )
{
for( int x = 0; x < image.cols; x++ )
{
for( int ll = -1; ll < 1; ll++ )
{
for(int mm=-1; mm<1; mm++)
{
uchar ff1 = image.at<uchar>(x+ll,y+mm);
new_image.at<uchar>(x,y) +=ff1;
}
}
}
}
namedWindow("Original Image", 1);
namedWindow("New Image", 1);
imshow("Original Image", image);
imshow("New Image", new_image);
waitKey();
return 0;
}