首頁>Club>
4
回覆列表
  • 1 # 使用者354027096568

    Mat magX = Mat(src.rows, src.cols, CV_32F);

    Mat magY = Mat(src.rows, src.cols, CV_32F);

    Sobel(image, magX, CV_32F, 1, 0, 3);

    Sobel(image, magY, CV_32F, 0, 1, 3);

    // 計算斜率

    Mat slopes = Mat(image.rows, image.cols, CV_32F);

    divide(magY, magX, slopes);

    // 計算每個點的梯度

    Mat sum = Mat(image.rows, image.cols, CV_64F);

    Mat prodX = Mat(image.rows, image.cols, CV_64F);

    Mat prodY = Mat(image.rows, image.cols, CV_64F);

    multiply(magX, magX, prodX);

    multiply(magY, magY, prodY);

    sum = prodX + prodY;

    sqrt(sum, sum);

  • 中秋節和大豐收的關聯?
  • 一個哥們是我上級,處處為難我怎麼辦?