函数原型

void Sobel(
    InputArray src,            
    OutputArray dst,
    int ddepth,                //图像深度
    int dx,                    //x,y方向的差分阶数
    int dy,
    int ksize=3,                //sobel核的大小,必须取1,3,5 or 7
    double scale=1,
    double delta=0,
    int borderType=BORDER_DEFAULT);

其中图像深度的取值支持如下组合

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。
  • 若src.depth()=CV_8U, 取ddepth=-1/CV_16S/CV_32F/CV_64F
  • 若src.depth()=CV_16U/CV_16S, 取ddepth=-1/CV_32F/CV_64F
  • 若src.depth()=CV_32F, 取ddepth=-1/CV_32F/CV_64F
  • 若src.depth()=CV_64F, 取ddepth=-1/CV_64F

在interface.h文件中定义

#define CV_8U   0
#define CV_8S   1
#define CV_16U  2
#define CV_16S  3
#define CV_32S  4
#define CV_32F  5
#define CV_64F  6
#define CV_16F  7
扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄