moved multiblocl_local_binary_pattern in python file in order for sphinx to be able to correctly creat documentation.

This commit is contained in:
dan
2015-06-11 07:52:06 +02:00
parent d20eae7cd1
commit cc81bdb26b
3 changed files with 55 additions and 52 deletions
+1 -1
View File
@@ -3,9 +3,9 @@ from ._daisy import daisy
from ._hog import hog
from .texture import (greycomatrix, greycoprops,
local_binary_pattern,
multiblock_local_binary_pattern,
draw_multiblock_lbp)
from ._texture import multiblock_local_binary_pattern
from .peak import peak_local_max
from .corner import (corner_kitchen_rosenfeld, corner_harris,
corner_shi_tomasi, corner_foerstner, corner_subpix,
+5 -50
View File
@@ -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])
cdef int _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_local_binary_pattern(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
@@ -354,49 +354,4 @@ cdef int _multiblock_local_binary_pattern(float[:, ::1] int_image,
return lbp_code
def multiblock_local_binary_pattern(int_image, x, y, width, height):
"""Multi-block local binary pattern.
The features are calculated similarly to local binary patterns (LBPs),
except that summed blocks are used instead of individual pixel values.
MB-LBP is an extension of LBP that can be computed on multiple scales
in constant time using the integral image.
9 equally-sized rectangles are used to compute a feature.
For each rectangle, the sum of the pixel intensities is computed.
Comparisons of these sums to that of the central rectangle determine
the feature, similarly to LBP.
Parameters
----------
int_image : (N, M) array
Integral image.
x : int
X-coordinate of top left corner of a rectangle containing feature.
y : int
Y-coordinate of top left corner of a rectangle containing feature.
width : int
Width of one of 9 equal rectangles that will be used to compute
a feature.
height : int
Height of one of 9 equal rectangles that will be used to compute
a feature.
Returns
-------
output : int
8-bit MB-LBP feature descriptor.
References
----------
.. [1] Face Detection Based on Multi-Block LBP
Representation. Lun Zhang, Rufeng Chu, Shiming Xiang, Shengcai Liao,
Stan Z. Li
http://www.cbsr.ia.ac.cn/users/scliao/papers/Zhang-ICB07-MBLBP.pdf
"""
int_image = np.ascontiguousarray(int_image, dtype=np.float32)
lbp_code = _multiblock_local_binary_pattern(int_image, x, y, width, height)
return lbp_code
+49 -1
View File
@@ -5,7 +5,9 @@ Methods to characterize image textures.
import numpy as np
from .._shared.utils import assert_nD
from ..util import img_as_float
from ._texture import _glcm_loop, _local_binary_pattern
from ._texture import (_glcm_loop,
_local_binary_pattern,
_multiblock_local_binary_pattern)
def greycomatrix(image, distances, angles, levels=256, symmetric=False,
@@ -294,6 +296,52 @@ def local_binary_pattern(image, P, R, method='default'):
return output
def multiblock_local_binary_pattern(int_image, x, y, width, height):
"""Multi-block local binary pattern.
The features are calculated similarly to local binary patterns (LBPs),
except that summed blocks are used instead of individual pixel values.
MB-LBP is an extension of LBP that can be computed on multiple scales
in constant time using the integral image.
9 equally-sized rectangles are used to compute a feature.
For each rectangle, the sum of the pixel intensities is computed.
Comparisons of these sums to that of the central rectangle determine
the feature, similarly to LBP.
Parameters
----------
int_image : (N, M) array
Integral image.
x : int
X-coordinate of top left corner of a rectangle containing feature.
y : int
Y-coordinate of top left corner of a rectangle containing feature.
width : int
Width of one of 9 equal rectangles that will be used to compute
a feature.
height : int
Height of one of 9 equal rectangles that will be used to compute
a feature.
Returns
-------
output : int
8-bit MB-LBP feature descriptor.
References
----------
.. [1] Face Detection Based on Multi-Block LBP
Representation. Lun Zhang, Rufeng Chu, Shiming Xiang, Shengcai Liao,
Stan Z. Li
http://www.cbsr.ia.ac.cn/users/scliao/papers/Zhang-ICB07-MBLBP.pdf
"""
int_image = np.ascontiguousarray(int_image, dtype=np.float32)
lbp_code = _multiblock_local_binary_pattern(int_image, x, y, width, height)
return lbp_code
def draw_multiblock_lbp(img,
x,
y,