Advertisement

用opencv-python提取图像的LBP特征

阅读量:

参考文献:

https://www.cnblogs.com/mikewolf2002/p/3438698.html

将C++语言转换为Python语言后的代码实现如下,其存在的不足之处在于执行效率较低,运行速度明显放缓。

复制代码
    import cv2
    from math import sin
    from math import cos
    from math import pi as PI
    from math import floor
    from math import ceil
    '''
    def elbp(src,dst,radius,neighbors):
    
      for n in range(0,neighbors):  # 0包括,neighbors不包括
    # 采样点的计算
    x = float(-radius * sin(2.0*PI*i/neighbors)) 
    y = float(radius * cos(2.0*PI*i/neighbors))
    
    # 上取整和下取整的值
    fx = int(floor(x))  # 返回一个小于传入参数的最大整数
    fy = int(floor(y))
    cx = int(ceil(x

全部评论 (0)

还没有任何评论哟~