當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。