We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Handle `normed` to `density` deprecations in `histogram` 
## Description
See https://github.com/scikit-image/scikit-image/pull/3427 and the related issues.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `doc/examples/features_detection/plot_local_binary_pattern.py`
Content:
```
1 """
2 ===============================================
3 Local Binary Pattern for texture classification
4 ===============================================
5 
6 In this example, we will see how to classify textures based on LBP (Local
7 Binary Pattern). LBP looks at points surrounding a central point and tests
8 whether the surrounding points are greater than or less than the central point
9 (i.e. gives a binary result).
10 
11 Before trying out LBP on an image, it helps to look at a schematic of LBPs.
12 The below code is just used to plot the schematic.
13 """
14 import numpy as np
15 import matplotlib.pyplot as plt
16 
17 
18 METHOD = 'uniform'
19 plt.rcParams['font.size'] = 9
20 
21 
22 def plot_circle(ax, center, radius, color):
23     circle = plt.Circle(center, radius, facecolor=color, edgecolor='0.5')
24     ax.add_patch(circle)
25 
26 
27 def plot_lbp_model(ax, binary_values):
28     """Draw the schematic for a local binary pattern."""
29     # Geometry spec
30     theta = np.deg2rad(45)
31     R = 1
32     r = 0.15
33     w = 1.5
34     gray = '0.5'
35 
36     # Draw the central pixel.
37     plot_circle(ax, (0, 0), radius=r, color=gray)
38     # Draw the surrounding pixels.
39     for i, facecolor in enumerate(binary_values):
40         x = R * np.cos(i * theta)
41         y = R * np.sin(i * theta)
42         plot_circle(ax, (x, y), radius=r, color=str(facecolor))
43 
44     # Draw the pixel grid.
45     for x in np.linspace(-w, w, 4):
46         ax.axvline(x, color=gray)
47         ax.axhline(x, color=gray)
48 
49     # Tweak the layout.
50     ax.axis('image')
51     ax.axis('off')
52     size = w + 0.2
53     ax.set_xlim(-size, size)
54     ax.set_ylim(-size, size)
55 
56 
57 fig, axes = plt.subplots(ncols=5, figsize=(7, 2))
58 
59 titles = ['flat', 'flat', 'edge', 'corner', 'non-uniform']
60 
61 binary_patterns = [np.zeros(8),
62                    np.ones(8),
63                    np.hstack([np.ones(4), np.zeros(4)]),
64                    np.hstack([np.zeros(3), np.ones(5)]),
65                    [1, 0, 0, 1, 1, 1, 0, 0]]
66 
67 for ax, values, name in zip(axes, binary_patterns, titles):
68     plot_lbp_model(ax, values)
69     ax.set_title(name)
70 
71 ######################################################################
72 # The figure above shows example results with black (or white) representing
73 # pixels that are less (or more) intense than the central pixel. When
74 # surrounding pixels are all black or all white, then that image region is
75 # flat (i.e. featureless). Groups of continuous black or white pixels are
76 # considered "uniform" patterns that can be interpreted as corners or edges.
77 # If pixels switch back-and-forth between black and white pixels, the pattern
78 # is considered "non-uniform".
79 #
80 # When using LBP to detect texture, you measure a collection of LBPs over an
81 # image patch and look at the distribution of these LBPs. Lets apply LBP to a
82 # brick texture.
83 
84 from skimage.transform import rotate
85 from skimage.feature import local_binary_pattern
86 from skimage import data
87 from skimage.color import label2rgb
88 
89 # settings for LBP
90 radius = 3
91 n_points = 8 * radius
92 
93 
94 def overlay_labels(image, lbp, labels):
95     mask = np.logical_or.reduce([lbp == each for each in labels])
96     return label2rgb(mask, image=image, bg_label=0, alpha=0.5)
97 
98 
99 def highlight_bars(bars, indexes):
100     for i in indexes:
101         bars[i].set_facecolor('r')
102 
103 
104 image = data.brick()
105 lbp = local_binary_pattern(image, n_points, radius, METHOD)
106 
107 
108 def hist(ax, lbp):
109     n_bins = int(lbp.max() + 1)
110     return ax.hist(lbp.ravel(), normed=True, bins=n_bins, range=(0, n_bins),
111                    facecolor='0.5')
112 
113 
114 # plot histograms of LBP of textures
115 fig, (ax_img, ax_hist) = plt.subplots(nrows=2, ncols=3, figsize=(9, 6))
116 plt.gray()
117 
118 titles = ('edge', 'flat', 'corner')
119 w = width = radius - 1
120 edge_labels = range(n_points // 2 - w, n_points // 2 + w + 1)
121 flat_labels = list(range(0, w + 1)) + list(range(n_points - w, n_points + 2))
122 i_14 = n_points // 4            # 1/4th of the histogram
123 i_34 = 3 * (n_points // 4)      # 3/4th of the histogram
124 corner_labels = (list(range(i_14 - w, i_14 + w + 1)) +
125                  list(range(i_34 - w, i_34 + w + 1)))
126 
127 label_sets = (edge_labels, flat_labels, corner_labels)
128 
129 for ax, labels in zip(ax_img, label_sets):
130     ax.imshow(overlay_labels(image, lbp, labels))
131 
132 for ax, labels, name in zip(ax_hist, label_sets, titles):
133     counts, _, bars = hist(ax, lbp)
134     highlight_bars(bars, labels)
135     ax.set_ylim(top=np.max(counts[:-1]))
136     ax.set_xlim(right=n_points + 2)
137     ax.set_title(name)
138 
139 ax_hist[0].set_ylabel('Percentage')
140 for ax in ax_img:
141     ax.axis('off')
142 
143 
144 ######################################################################
145 # The above plot highlights flat, edge-like, and corner-like regions of the
146 # image.
147 #
148 # The histogram of the LBP result is a good measure to classify textures.
149 # Here, we test the histogram distributions against each other using the
150 # Kullback-Leibler-Divergence.
151 
152 # settings for LBP
153 radius = 2
154 n_points = 8 * radius
155 
156 
157 def kullback_leibler_divergence(p, q):
158     p = np.asarray(p)
159     q = np.asarray(q)
160     filt = np.logical_and(p != 0, q != 0)
161     return np.sum(p[filt] * np.log2(p[filt] / q[filt]))
162 
163 
164 def match(refs, img):
165     best_score = 10
166     best_name = None
167     lbp = local_binary_pattern(img, n_points, radius, METHOD)
168     n_bins = int(lbp.max() + 1)
169     hist, _ = np.histogram(lbp, density=True, bins=n_bins, range=(0, n_bins))
170     for name, ref in refs.items():
171         ref_hist, _ = np.histogram(ref, density=True, bins=n_bins,
172                                    range=(0, n_bins))
173         score = kullback_leibler_divergence(hist, ref_hist)
174         if score < best_score:
175             best_score = score
176             best_name = name
177     return best_name
178 
179 
180 brick = data.brick()
181 grass = data.grass()
182 gravel = data.gravel()
183 
184 refs = {
185     'brick': local_binary_pattern(brick, n_points, radius, METHOD),
186     'grass': local_binary_pattern(grass, n_points, radius, METHOD),
187     'gravel': local_binary_pattern(gravel, n_points, radius, METHOD)
188 }
189 
190 # classify rotated textures
191 print('Rotated images matched against references using LBP:')
192 print('original: brick, rotated: 30deg, match result: ',
193       match(refs, rotate(brick, angle=30, resize=False)))
194 print('original: brick, rotated: 70deg, match result: ',
195       match(refs, rotate(brick, angle=70, resize=False)))
196 print('original: grass, rotated: 145deg, match result: ',
197       match(refs, rotate(grass, angle=145, resize=False)))
198 
199 # plot histograms of LBP of textures
200 fig, ((ax1, ax2, ax3), (ax4, ax5, ax6)) = plt.subplots(nrows=2, ncols=3,
201                                                        figsize=(9, 6))
202 plt.gray()
203 
204 ax1.imshow(brick)
205 ax1.axis('off')
206 hist(ax4, refs['brick'])
207 ax4.set_ylabel('Percentage')
208 
209 ax2.imshow(grass)
210 ax2.axis('off')
211 hist(ax5, refs['grass'])
212 ax5.set_xlabel('Uniform LBP values')
213 
214 ax3.imshow(gravel)
215 ax3.axis('off')
216 hist(ax6, refs['gravel'])
217 
218 plt.show()
219
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/doc/examples/features_detection/plot_local_binary_pattern.py b/doc/examples/features_detection/plot_local_binary_pattern.py
--- a/doc/examples/features_detection/plot_local_binary_pattern.py
+++ b/doc/examples/features_detection/plot_local_binary_pattern.py
@@ -107,7 +107,7 @@
 
 def hist(ax, lbp):
     n_bins = int(lbp.max() + 1)
-    return ax.hist(lbp.ravel(), normed=True, bins=n_bins, range=(0, n_bins),
+    return ax.hist(lbp.ravel(), density=True, bins=n_bins, range=(0, n_bins),
                    facecolor='0.5')

{"golden_diff": "diff --git a/doc/examples/features_detection/plot_local_binary_pattern.py b/doc/examples/features_detection/plot_local_binary_pattern.py\n--- a/doc/examples/features_detection/plot_local_binary_pattern.py\n+++ b/doc/examples/features_detection/plot_local_binary_pattern.py\n@@ -107,7 +107,7 @@\n \n def hist(ax, lbp):\n     n_bins = int(lbp.max() + 1)\n-    return ax.hist(lbp.ravel(), normed=True, bins=n_bins, range=(0, n_bins),\n+    return ax.hist(lbp.ravel(), density=True, bins=n_bins, range=(0, n_bins),\n                    facecolor='0.5')\n", "issue": "Handle `normed` to `density` deprecations in `histogram` \n## Description\r\nSee https://github.com/scikit-image/scikit-image/pull/3427 and the related issues.\r\n\n", "before_files": [{"content": "\"\"\"\n===============================================\nLocal Binary Pattern for texture classification\n===============================================\n\nIn this example, we will see how to classify textures based on LBP (Local\nBinary Pattern). LBP looks at points surrounding a central point and tests\nwhether the surrounding points are greater than or less than the central point\n(i.e. gives a binary result).\n\nBefore trying out LBP on an image, it helps to look at a schematic of LBPs.\nThe below code is just used to plot the schematic.\n\"\"\"\nimport numpy as np\nimport matplotlib.pyplot as plt\n\n\nMETHOD = 'uniform'\nplt.rcParams['font.size'] = 9\n\n\ndef plot_circle(ax, center, radius, color):\n    circle = plt.Circle(center, radius, facecolor=color, edgecolor='0.5')\n    ax.add_patch(circle)\n\n\ndef plot_lbp_model(ax, binary_values):\n    \"\"\"Draw the schematic for a local binary pattern.\"\"\"\n    # Geometry spec\n    theta = np.deg2rad(45)\n    R = 1\n    r = 0.15\n    w = 1.5\n    gray = '0.5'\n\n    # Draw the central pixel.\n    plot_circle(ax, (0, 0), radius=r, color=gray)\n    # Draw the surrounding pixels.\n    for i, facecolor in enumerate(binary_values):\n        x = R * np.cos(i * theta)\n        y = R * np.sin(i * theta)\n        plot_circle(ax, (x, y), radius=r, color=str(facecolor))\n\n    # Draw the pixel grid.\n    for x in np.linspace(-w, w, 4):\n        ax.axvline(x, color=gray)\n        ax.axhline(x, color=gray)\n\n    # Tweak the layout.\n    ax.axis('image')\n    ax.axis('off')\n    size = w + 0.2\n    ax.set_xlim(-size, size)\n    ax.set_ylim(-size, size)\n\n\nfig, axes = plt.subplots(ncols=5, figsize=(7, 2))\n\ntitles = ['flat', 'flat', 'edge', 'corner', 'non-uniform']\n\nbinary_patterns = [np.zeros(8),\n                   np.ones(8),\n                   np.hstack([np.ones(4), np.zeros(4)]),\n                   np.hstack([np.zeros(3), np.ones(5)]),\n                   [1, 0, 0, 1, 1, 1, 0, 0]]\n\nfor ax, values, name in zip(axes, binary_patterns, titles):\n    plot_lbp_model(ax, values)\n    ax.set_title(name)\n\n######################################################################\n# The figure above shows example results with black (or white) representing\n# pixels that are less (or more) intense than the central pixel. When\n# surrounding pixels are all black or all white, then that image region is\n# flat (i.e. featureless). Groups of continuous black or white pixels are\n# considered \"uniform\" patterns that can be interpreted as corners or edges.\n# If pixels switch back-and-forth between black and white pixels, the pattern\n# is considered \"non-uniform\".\n#\n# When using LBP to detect texture, you measure a collection of LBPs over an\n# image patch and look at the distribution of these LBPs. Lets apply LBP to a\n# brick texture.\n\nfrom skimage.transform import rotate\nfrom skimage.feature import local_binary_pattern\nfrom skimage import data\nfrom skimage.color import label2rgb\n\n# settings for LBP\nradius = 3\nn_points = 8 * radius\n\n\ndef overlay_labels(image, lbp, labels):\n    mask = np.logical_or.reduce([lbp == each for each in labels])\n    return label2rgb(mask, image=image, bg_label=0, alpha=0.5)\n\n\ndef highlight_bars(bars, indexes):\n    for i in indexes:\n        bars[i].set_facecolor('r')\n\n\nimage = data.brick()\nlbp = local_binary_pattern(image, n_points, radius, METHOD)\n\n\ndef hist(ax, lbp):\n    n_bins = int(lbp.max() + 1)\n    return ax.hist(lbp.ravel(), normed=True, bins=n_bins, range=(0, n_bins),\n                   facecolor='0.5')\n\n\n# plot histograms of LBP of textures\nfig, (ax_img, ax_hist) = plt.subplots(nrows=2, ncols=3, figsize=(9, 6))\nplt.gray()\n\ntitles = ('edge', 'flat', 'corner')\nw = width = radius - 1\nedge_labels = range(n_points // 2 - w, n_points // 2 + w + 1)\nflat_labels = list(range(0, w + 1)) + list(range(n_points - w, n_points + 2))\ni_14 = n_points // 4            # 1/4th of the histogram\ni_34 = 3 * (n_points // 4)      # 3/4th of the histogram\ncorner_labels = (list(range(i_14 - w, i_14 + w + 1)) +\n                 list(range(i_34 - w, i_34 + w + 1)))\n\nlabel_sets = (edge_labels, flat_labels, corner_labels)\n\nfor ax, labels in zip(ax_img, label_sets):\n    ax.imshow(overlay_labels(image, lbp, labels))\n\nfor ax, labels, name in zip(ax_hist, label_sets, titles):\n    counts, _, bars = hist(ax, lbp)\n    highlight_bars(bars, labels)\n    ax.set_ylim(top=np.max(counts[:-1]))\n    ax.set_xlim(right=n_points + 2)\n    ax.set_title(name)\n\nax_hist[0].set_ylabel('Percentage')\nfor ax in ax_img:\n    ax.axis('off')\n\n\n######################################################################\n# The above plot highlights flat, edge-like, and corner-like regions of the\n# image.\n#\n# The histogram of the LBP result is a good measure to classify textures.\n# Here, we test the histogram distributions against each other using the\n# Kullback-Leibler-Divergence.\n\n# settings for LBP\nradius = 2\nn_points = 8 * radius\n\n\ndef kullback_leibler_divergence(p, q):\n    p = np.asarray(p)\n    q = np.asarray(q)\n    filt = np.logical_and(p != 0, q != 0)\n    return np.sum(p[filt] * np.log2(p[filt] / q[filt]))\n\n\ndef match(refs, img):\n    best_score = 10\n    best_name = None\n    lbp = local_binary_pattern(img, n_points, radius, METHOD)\n    n_bins = int(lbp.max() + 1)\n    hist, _ = np.histogram(lbp, density=True, bins=n_bins, range=(0, n_bins))\n    for name, ref in refs.items():\n        ref_hist, _ = np.histogram(ref, density=True, bins=n_bins,\n                                   range=(0, n_bins))\n        score = kullback_leibler_divergence(hist, ref_hist)\n        if score < best_score:\n            best_score = score\n            best_name = name\n    return best_name\n\n\nbrick = data.brick()\ngrass = data.grass()\ngravel = data.gravel()\n\nrefs = {\n    'brick': local_binary_pattern(brick, n_points, radius, METHOD),\n    'grass': local_binary_pattern(grass, n_points, radius, METHOD),\n    'gravel': local_binary_pattern(gravel, n_points, radius, METHOD)\n}\n\n# classify rotated textures\nprint('Rotated images matched against references using LBP:')\nprint('original: brick, rotated: 30deg, match result: ',\n      match(refs, rotate(brick, angle=30, resize=False)))\nprint('original: brick, rotated: 70deg, match result: ',\n      match(refs, rotate(brick, angle=70, resize=False)))\nprint('original: grass, rotated: 145deg, match result: ',\n      match(refs, rotate(grass, angle=145, resize=False)))\n\n# plot histograms of LBP of textures\nfig, ((ax1, ax2, ax3), (ax4, ax5, ax6)) = plt.subplots(nrows=2, ncols=3,\n                                                       figsize=(9, 6))\nplt.gray()\n\nax1.imshow(brick)\nax1.axis('off')\nhist(ax4, refs['brick'])\nax4.set_ylabel('Percentage')\n\nax2.imshow(grass)\nax2.axis('off')\nhist(ax5, refs['grass'])\nax5.set_xlabel('Uniform LBP values')\n\nax3.imshow(gravel)\nax3.axis('off')\nhist(ax6, refs['gravel'])\n\nplt.show()\n", "path": "doc/examples/features_detection/plot_local_binary_pattern.py"}], "after_files": [{"content": "\"\"\"\n===============================================\nLocal Binary Pattern for texture classification\n===============================================\n\nIn this example, we will see how to classify textures based on LBP (Local\nBinary Pattern). LBP looks at points surrounding a central point and tests\nwhether the surrounding points are greater than or less than the central point\n(i.e. gives a binary result).\n\nBefore trying out LBP on an image, it helps to look at a schematic of LBPs.\nThe below code is just used to plot the schematic.\n\"\"\"\nimport numpy as np\nimport matplotlib.pyplot as plt\n\n\nMETHOD = 'uniform'\nplt.rcParams['font.size'] = 9\n\n\ndef plot_circle(ax, center, radius, color):\n    circle = plt.Circle(center, radius, facecolor=color, edgecolor='0.5')\n    ax.add_patch(circle)\n\n\ndef plot_lbp_model(ax, binary_values):\n    \"\"\"Draw the schematic for a local binary pattern.\"\"\"\n    # Geometry spec\n    theta = np.deg2rad(45)\n    R = 1\n    r = 0.15\n    w = 1.5\n    gray = '0.5'\n\n    # Draw the central pixel.\n    plot_circle(ax, (0, 0), radius=r, color=gray)\n    # Draw the surrounding pixels.\n    for i, facecolor in enumerate(binary_values):\n        x = R * np.cos(i * theta)\n        y = R * np.sin(i * theta)\n        plot_circle(ax, (x, y), radius=r, color=str(facecolor))\n\n    # Draw the pixel grid.\n    for x in np.linspace(-w, w, 4):\n        ax.axvline(x, color=gray)\n        ax.axhline(x, color=gray)\n\n    # Tweak the layout.\n    ax.axis('image')\n    ax.axis('off')\n    size = w + 0.2\n    ax.set_xlim(-size, size)\n    ax.set_ylim(-size, size)\n\n\nfig, axes = plt.subplots(ncols=5, figsize=(7, 2))\n\ntitles = ['flat', 'flat', 'edge', 'corner', 'non-uniform']\n\nbinary_patterns = [np.zeros(8),\n                   np.ones(8),\n                   np.hstack([np.ones(4), np.zeros(4)]),\n                   np.hstack([np.zeros(3), np.ones(5)]),\n                   [1, 0, 0, 1, 1, 1, 0, 0]]\n\nfor ax, values, name in zip(axes, binary_patterns, titles):\n    plot_lbp_model(ax, values)\n    ax.set_title(name)\n\n######################################################################\n# The figure above shows example results with black (or white) representing\n# pixels that are less (or more) intense than the central pixel. When\n# surrounding pixels are all black or all white, then that image region is\n# flat (i.e. featureless). Groups of continuous black or white pixels are\n# considered \"uniform\" patterns that can be interpreted as corners or edges.\n# If pixels switch back-and-forth between black and white pixels, the pattern\n# is considered \"non-uniform\".\n#\n# When using LBP to detect texture, you measure a collection of LBPs over an\n# image patch and look at the distribution of these LBPs. Lets apply LBP to a\n# brick texture.\n\nfrom skimage.transform import rotate\nfrom skimage.feature import local_binary_pattern\nfrom skimage import data\nfrom skimage.color import label2rgb\n\n# settings for LBP\nradius = 3\nn_points = 8 * radius\n\n\ndef overlay_labels(image, lbp, labels):\n    mask = np.logical_or.reduce([lbp == each for each in labels])\n    return label2rgb(mask, image=image, bg_label=0, alpha=0.5)\n\n\ndef highlight_bars(bars, indexes):\n    for i in indexes:\n        bars[i].set_facecolor('r')\n\n\nimage = data.brick()\nlbp = local_binary_pattern(image, n_points, radius, METHOD)\n\n\ndef hist(ax, lbp):\n    n_bins = int(lbp.max() + 1)\n    return ax.hist(lbp.ravel(), density=True, bins=n_bins, range=(0, n_bins),\n                   facecolor='0.5')\n\n\n# plot histograms of LBP of textures\nfig, (ax_img, ax_hist) = plt.subplots(nrows=2, ncols=3, figsize=(9, 6))\nplt.gray()\n\ntitles = ('edge', 'flat', 'corner')\nw = width = radius - 1\nedge_labels = range(n_points // 2 - w, n_points // 2 + w + 1)\nflat_labels = list(range(0, w + 1)) + list(range(n_points - w, n_points + 2))\ni_14 = n_points // 4            # 1/4th of the histogram\ni_34 = 3 * (n_points // 4)      # 3/4th of the histogram\ncorner_labels = (list(range(i_14 - w, i_14 + w + 1)) +\n                 list(range(i_34 - w, i_34 + w + 1)))\n\nlabel_sets = (edge_labels, flat_labels, corner_labels)\n\nfor ax, labels in zip(ax_img, label_sets):\n    ax.imshow(overlay_labels(image, lbp, labels))\n\nfor ax, labels, name in zip(ax_hist, label_sets, titles):\n    counts, _, bars = hist(ax, lbp)\n    highlight_bars(bars, labels)\n    ax.set_ylim(top=np.max(counts[:-1]))\n    ax.set_xlim(right=n_points + 2)\n    ax.set_title(name)\n\nax_hist[0].set_ylabel('Percentage')\nfor ax in ax_img:\n    ax.axis('off')\n\n\n######################################################################\n# The above plot highlights flat, edge-like, and corner-like regions of the\n# image.\n#\n# The histogram of the LBP result is a good measure to classify textures.\n# Here, we test the histogram distributions against each other using the\n# Kullback-Leibler-Divergence.\n\n# settings for LBP\nradius = 2\nn_points = 8 * radius\n\n\ndef kullback_leibler_divergence(p, q):\n    p = np.asarray(p)\n    q = np.asarray(q)\n    filt = np.logical_and(p != 0, q != 0)\n    return np.sum(p[filt] * np.log2(p[filt] / q[filt]))\n\n\ndef match(refs, img):\n    best_score = 10\n    best_name = None\n    lbp = local_binary_pattern(img, n_points, radius, METHOD)\n    n_bins = int(lbp.max() + 1)\n    hist, _ = np.histogram(lbp, density=True, bins=n_bins, range=(0, n_bins))\n    for name, ref in refs.items():\n        ref_hist, _ = np.histogram(ref, density=True, bins=n_bins,\n                                   range=(0, n_bins))\n        score = kullback_leibler_divergence(hist, ref_hist)\n        if score < best_score:\n            best_score = score\n            best_name = name\n    return best_name\n\n\nbrick = data.brick()\ngrass = data.grass()\ngravel = data.gravel()\n\nrefs = {\n    'brick': local_binary_pattern(brick, n_points, radius, METHOD),\n    'grass': local_binary_pattern(grass, n_points, radius, METHOD),\n    'gravel': local_binary_pattern(gravel, n_points, radius, METHOD)\n}\n\n# classify rotated textures\nprint('Rotated images matched against references using LBP:')\nprint('original: brick, rotated: 30deg, match result: ',\n      match(refs, rotate(brick, angle=30, resize=False)))\nprint('original: brick, rotated: 70deg, match result: ',\n      match(refs, rotate(brick, angle=70, resize=False)))\nprint('original: grass, rotated: 145deg, match result: ',\n      match(refs, rotate(grass, angle=145, resize=False)))\n\n# plot histograms of LBP of textures\nfig, ((ax1, ax2, ax3), (ax4, ax5, ax6)) = plt.subplots(nrows=2, ncols=3,\n                                                       figsize=(9, 6))\nplt.gray()\n\nax1.imshow(brick)\nax1.axis('off')\nhist(ax4, refs['brick'])\nax4.set_ylabel('Percentage')\n\nax2.imshow(grass)\nax2.axis('off')\nhist(ax5, refs['grass'])\nax5.set_xlabel('Uniform LBP values')\n\nax3.imshow(gravel)\nax3.axis('off')\nhist(ax6, refs['gravel'])\n\nplt.show()\n", "path": "doc/examples/features_detection/plot_local_binary_pattern.py"}]}