ai chuyển hộ mình sang ngôn ngữ C# với
void Gradient(Mat imgin, Mat imgout)
{
Mat gx = Mat(imgin.size(),CV_32F);
Mat gy = Mat(imgin.size(),CV_32F);
Sobel(imgin,gx,CV_32F,1,0);
Sobel(imgin,gy,CV_32F,0,1);
int M = imgin.size().height;
int N = imgin.size().width;
int x, y;
float r;
for (x=0; x(x,y)) + abs(gy.at(x,y));
if (r > L-1)
r = L-1;
imgout.at(x,y) = (uchar)r;
}
return;
}