# -*- coding: utf-8 -*-
import cv2
import numpy as np
import math
import os
import matplotlib.pyplot as plt
# 取得给定的LBP字符串的最小二进制值,实现旋转不变形
def Rotate_LBP_Min(str_lbp_input):
str_lbp_tmp = str_lbp_input
MinValue = int(str_lbp_tmp, 2) #转换二进制数
nLen = len(str_lbp_tmp)
for npos in range(nLen):
str_head = str_lbp_tmp[0]
str_tail = str_lbp_tmp[1:]
str_lbp_tmp = str_tail + str_head
CurrentValue = int(str_lbp_tmp, 2)
if CurrentValue<MinValue:
MinValue = CurrentValue
return MinValue
def LBP_Rotate(image):
H, W = image.shape[:2] #获得图像长宽
xx = [-1, 0, 1, 1, 1, 0, -1, -1]
yy = [-1, -1, -1, 0, 1, 1, 1, 0] #xx, yy 主要作用对应顺时针旋转时,相对中点的相对值.
#创建0数组,显而易见维度原始图像的长宽分别减去2,并且类型一定的是uint8,无符号8位,op