mirror of
https://github.com/wassname/scikit-image.git
synced 2026-06-27 18:25:32 +08:00
the function name was shortened to multiblock_lbp
This commit is contained in:
@@ -23,7 +23,7 @@ upon which we then apply MB-LBP.
|
||||
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from skimage.feature import multiblock_local_binary_pattern
|
||||
from skimage.feature import multiblock_lbp
|
||||
import numpy as np
|
||||
from numpy.testing import assert_equal
|
||||
from skimage.transform import integral_image
|
||||
@@ -43,7 +43,7 @@ correct_answer = 0b10001000
|
||||
|
||||
int_img = integral_image(test_img)
|
||||
|
||||
lbp_code = multiblock_local_binary_pattern(int_img, 0, 0, 3, 3)
|
||||
lbp_code = multiblock_lbp(int_img, 0, 0, 3, 3)
|
||||
|
||||
assert_equal(correct_answer, lbp_code)
|
||||
|
||||
@@ -58,7 +58,7 @@ test_img = data.coins()
|
||||
|
||||
int_img = integral_image(test_img)
|
||||
|
||||
lbp_code = multiblock_local_binary_pattern(int_img, 0, 0, 90, 90)
|
||||
lbp_code = multiblock_lbp(int_img, 0, 0, 90, 90)
|
||||
|
||||
img = draw_multiblock_lbp(test_img, 0, 0, 90, 90,
|
||||
lbp_code=lbp_code, alpha=0.5)
|
||||
|
||||
@@ -3,7 +3,7 @@ from ._daisy import daisy
|
||||
from ._hog import hog
|
||||
from .texture import (greycomatrix, greycoprops,
|
||||
local_binary_pattern,
|
||||
multiblock_local_binary_pattern,
|
||||
multiblock_lbp,
|
||||
draw_multiblock_lbp)
|
||||
|
||||
from .peak import peak_local_max
|
||||
@@ -29,7 +29,7 @@ __all__ = ['canny',
|
||||
'greycomatrix',
|
||||
'greycoprops',
|
||||
'local_binary_pattern',
|
||||
'multiblock_local_binary_pattern',
|
||||
'multiblock_lbp',
|
||||
'draw_multiblock_lbp',
|
||||
'peak_local_max',
|
||||
'structure_tensor',
|
||||
|
||||
@@ -274,11 +274,11 @@ cdef:
|
||||
Py_ssize_t[::1] mlbp_x_offsets = np.asarray([-1, 0, 1, 1, 1, 0, -1, -1])
|
||||
Py_ssize_t[::1] mlbp_y_offsets = np.asarray([-1, -1, -1, 0, 1, 1, 1, 0])
|
||||
|
||||
def _multiblock_local_binary_pattern(float[:, ::1] int_image,
|
||||
Py_ssize_t x,
|
||||
Py_ssize_t y,
|
||||
Py_ssize_t width,
|
||||
Py_ssize_t height):
|
||||
def _multiblock_lbp(float[:, ::1] int_image,
|
||||
Py_ssize_t x,
|
||||
Py_ssize_t y,
|
||||
Py_ssize_t width,
|
||||
Py_ssize_t height):
|
||||
"""Multi-block local binary pattern.
|
||||
|
||||
Parameters
|
||||
|
||||
@@ -3,7 +3,7 @@ from skimage.feature import (
|
||||
greycomatrix,
|
||||
greycoprops,
|
||||
local_binary_pattern,
|
||||
multiblock_local_binary_pattern
|
||||
multiblock_lbp
|
||||
)
|
||||
|
||||
from skimage._shared.testing import test_parallel
|
||||
@@ -254,7 +254,7 @@ class TestMBLBP():
|
||||
|
||||
int_img = integral_image(test_img)
|
||||
|
||||
lbp_code = multiblock_local_binary_pattern(int_img, 0, 0, 3, 3)
|
||||
lbp_code = multiblock_lbp(int_img, 0, 0, 3, 3)
|
||||
|
||||
np.testing.assert_equal(lbp_code, correct_answer)
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ from ..util import img_as_float
|
||||
from ..color import gray2rgb
|
||||
from ._texture import (_glcm_loop,
|
||||
_local_binary_pattern,
|
||||
_multiblock_local_binary_pattern)
|
||||
_multiblock_lbp)
|
||||
|
||||
|
||||
def greycomatrix(image, distances, angles, levels=256, symmetric=False,
|
||||
@@ -297,7 +297,7 @@ def local_binary_pattern(image, P, R, method='default'):
|
||||
return output
|
||||
|
||||
|
||||
def multiblock_local_binary_pattern(int_image, x, y, width, height):
|
||||
def multiblock_lbp(int_image, x, y, width, height):
|
||||
"""Multi-block local binary pattern.
|
||||
|
||||
The features are calculated similarly to local binary patterns (LBPs),
|
||||
@@ -339,7 +339,7 @@ def multiblock_local_binary_pattern(int_image, x, y, width, height):
|
||||
"""
|
||||
|
||||
int_image = np.ascontiguousarray(int_image, dtype=np.float32)
|
||||
lbp_code = _multiblock_local_binary_pattern(int_image, x, y, width, height)
|
||||
lbp_code = _multiblock_lbp(int_image, x, y, width, height)
|
||||
return lbp_code
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user