Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/opencv/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 在cv2.Sobel中,尺度是什么意思?_Python_Opencv_Image Processing_Computer Vision_Sobel - Fatal编程技术网

Python 在cv2.Sobel中,尺度是什么意思?

Python 在cv2.Sobel中,尺度是什么意思?,python,opencv,image-processing,computer-vision,sobel,Python,Opencv,Image Processing,Computer Vision,Sobel,我试图理解中的比例参数。当scale设置为1/8时,我沿x轴获得如下输出: 但是,当scale=10或scale=100时,输出非常相似 上述两幅图像都是沿x轴的一阶梯度,比例分别为1/8和100 import cv2 filename = "./images/cube.jpg" img = cv2.imread(filename,0) sx = cv2.Sobel(img, cv2.CV_64F, 1,0, ksize=3, scale= 1/8) cv2.imshow("sx"

我试图理解中的
比例
参数。当
scale
设置为1/8时,我沿x轴获得如下输出:

但是,当scale=10或scale=100时,输出非常相似

上述两幅图像都是沿x轴的一阶梯度,比例分别为1/8和100

import cv2

filename = "./images/cube.jpg"

img = cv2.imread(filename,0)

sx = cv2.Sobel(img, cv2.CV_64F, 1,0, ksize=3, scale= 1/8)


cv2.imshow("sx", sx)

if cv2.waitKey(0) & 0xff == 27:
    cv2.destroyAllWindows()

参数
缩放
的作用是什么?如何有用?

见C++源于CV::OpenCV Sobel:< /P>
Mat kx, ky;
getDerivKernels( kx, ky, dx, dy, ksize, false, ktype );
if( scale != 1 )
{
    // usually the smoothing part is the slowest to compute,
    // so try to scale it instead of the faster differentiating part
    if( dx == 0 )
        kx *= scale;
    else
        ky *= scale;
}
所以,规模是Sobel核的一个因素。如果缩放!=1比kernell不会是(-10+1)(-20+2)(-10+1))。它将是((-scale 0+scale)(-2*scale 0+2*scale)(-scale 0+scale))