8000 compare: Use same histogram bins for all comparisons. · matplotlib/matplotlib@5af0f20 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5af0f20

Browse files
committed
compare: Use same histogram bins for all comparisons.
1 parent 77a6f9e commit 5af0f20

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/matplotlib/testing/compare.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,14 @@ def compare_images( expected, actual, tol, in_decorator=False ):
198198

199199
# compare the resulting image histogram functions
200200
rms = 0
8183 201+
bins = np.arange(257)
201202
for i in xrange(0, 3):
202203
h1p = expectedImage[:,:,i]
203204
h2p = actualImage[:,:,i]
204-
h1h = np.histogram(h1p, bins=256)[0]
205-
h2h = np.histogram(h2p, bins=256)[0]
205+
206+
h1h = np.histogram(h1p, bins=bins)[0]
207+
h2h = np.histogram(h2p, bins=bins)[0]
208+
206209
rms += np.sum(np.power((h1h-h2h), 2))
207210
rms = np.sqrt(rms / (256 * 3))
208211

0 commit comments

Comments
 (0)
0