Mat Sobel_gradient(Mat img, int direction) {
Mat oriImage = img;
Mat newImage_x = Mat(img.size(), CV_8UC1, Scalar(0));
Mat newImage_y = Mat(img.size(), CV_8UC1, Scalar(0));
Mat newImage_xy = Mat(img.size(), CV_8UC1, Scalar(0));
int this_direction = direction;
//对x方向求Sobel算子梯度
int width = img.cols;
int hight = img.rows;
int max_sobel_x = 0;//记录最大x方向梯度值
for(int i = 1;i<hight-1;i++)
for (int j = 1; j < width - 1; j++)
{
int nav_value = oriImage.at<uchar
C++自定义sobel求梯度
最新推荐文章于 2022-11-28 16:49:56 发布