当前位置: 首页>>代码示例>>Python>>正文


Python feature.local_binary_pattern方法代码示例

本文整理汇总了Python中skimage.feature.local_binary_pattern方法的典型用法代码示例。如果您正苦于以下问题:Python feature.local_binary_pattern方法的具体用法?Python feature.local_binary_pattern怎么用?Python feature.local_binary_pattern使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在skimage.feature的用法示例。


在下文中一共展示了feature.local_binary_pattern方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: objective

# 需要导入模块: from skimage import feature [as 别名]
# 或者: from skimage.feature import local_binary_pattern [as 别名]
def objective(trial):
    # Get Olivetti faces dataset.
    x_ref, x_valid, y_ref, y_valid = load_data()

    # We optimize parameters of local_binary_pattern function in skimage
    # and the choice of distance metric classes.
    P = trial.suggest_int("P", 1, 15)
    R = trial.suggest_uniform("R", 1, 10)
    method = trial.suggest_categorical("method", ["default", "uniform"])
    metric = trial.suggest_categorical("metric", ["kl", "cos", "euc"])

    x_ref_hist = img2hist(x_ref, P, R, method)
    x_valid_hist = img2hist(x_valid, P, R, method)
    dist = calc_dist(x_ref_hist, x_valid_hist, metric)

    y_pred = np.argmin(dist, axis=1)
    accuracy = sklearn.metrics.accuracy_score(y_valid, y_pred)
    return accuracy 
开发者ID:optuna,项目名称:optuna,代码行数:20,代码来源:skimage_lbp_simple.py

示例2: turn_lbp_desc

# 需要导入模块: from skimage import feature [as 别名]
# 或者: from skimage.feature import local_binary_pattern [as 别名]
def turn_lbp_desc(old: np.ndarray, radius: int = None) -> np.ndarray:
    if not radius:
        radius = 3
    n_points = 8 * radius

    grey = turn_grey(old)
    lbp = local_binary_pattern(grey, n_points, radius, method="default")
    return lbp 
开发者ID:williamfzc,项目名称:stagesepx,代码行数:10,代码来源:toolbox.py

示例3: demoLBP

# 需要导入模块: from skimage import feature [as 别名]
# 或者: from skimage.feature import local_binary_pattern [as 别名]
def demoLBP(fn):
    fn = Path(fn).expanduser()
    vid = cv2.VideoCapture(str(fn))
#    vidparam = getaviprop(vid)

    while True:
        ret, img = vid.read()
        if not ret:
            break
        if img.ndim == 3:
            img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
        lbp = local_binary_pattern(img, 8, 3, 'default')
        cv2.imshow('lbp', lbp)
        cv2.waitKey(delay=1) 
开发者ID:scivision,项目名称:pyimagevideo,代码行数:16,代码来源:Demo_localBinaryPattern.py

示例4: get_lbp_hist

# 需要导入模块: from skimage import feature [as 别名]
# 或者: from skimage.feature import local_binary_pattern [as 别名]
def get_lbp_hist(img, P, R, method):
    lbp = ft.local_binary_pattern(img, P, R, method)
    if method == "uniform":
        bin_max = P + 3
        range_max = P + 2
    elif method == "default":
        bin_max = 2 ** P
        range_max = 2 ** P - 1
    hist, _ = np.histogram(
        lbp.ravel(), density=True, bins=np.arange(0, bin_max), range=(0, range_max)
    )
    return hist 
开发者ID:optuna,项目名称:optuna,代码行数:14,代码来源:skimage_lbp_simple.py

示例5: compute_lbp

# 需要导入模块: from skimage import feature [as 别名]
# 或者: from skimage.feature import local_binary_pattern [as 别名]
def compute_lbp(img, params):
    lbp_radius = float(params.get("lbp_radius", 3))
    lbp_points = int(params.get("lbp_points", 24))  # example sets radius * 8
    lbp_method = params.get("lbp_method", "default")

    return local_binary_pattern(rgb2gray(img), P=lbp_points, R=lbp_radius, method=lbp_method)[:, :, None] 
开发者ID:choosehappy,项目名称:HistoQC,代码行数:8,代码来源:ClassificationModule.py


注:本文中的skimage.feature.local_binary_pattern方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。