c2cwsgiutils 6.2.0.dev52__py3-none-any.whl → 6.2.0.dev55__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -58,7 +58,7 @@ def normalize_image(image: NpNdarrayInt) -> NpNdarrayInt:
58
58
  return image
59
59
 
60
60
 
61
- def check_image(
61
+ def check_image( # pylint: disable=too-many-locals,too-many-statements
62
62
  result_folder: str,
63
63
  image_to_check: NpNdarrayInt,
64
64
  expected_filename: str,
@@ -109,6 +109,13 @@ def check_image(
109
109
 
110
110
  mask = None
111
111
  if mask_filename is not None:
112
+ background_color = [255, 255, 255]
113
+ for color in range(3):
114
+ img_hist, _ = skimage.exposure.histogram(
115
+ image_to_check[..., color], nbins=256, source_range="dtype"
116
+ )
117
+ background_color[color] = np.argmax(img_hist)
118
+
112
119
  mask = skimage.io.imread(mask_filename)
113
120
 
114
121
  assert mask is not None, "Wrong mask: " + mask_filename
@@ -131,7 +138,7 @@ def check_image(
131
138
  assert (
132
139
  mask.shape[0] == image_to_check.shape[0] and mask.shape[1] == image_to_check.shape[1]
133
140
  ), f"Mask and image should have the same shape ({mask.shape} != {image_to_check.shape})"
134
- image_to_check[mask] = [255, 255, 255]
141
+ image_to_check[mask] = background_color
135
142
 
136
143
  if not os.path.exists(result_folder):
137
144
  os.makedirs(result_folder)
@@ -149,7 +156,7 @@ def check_image(
149
156
  assert (
150
157
  expected.shape[0] == mask.shape[0] and expected.shape[1] == mask.shape[1]
151
158
  ), f"Mask and expected image should have the same shape ({mask.shape} != {expected.shape})"
152
- expected[mask] = [255, 255, 255]
159
+ expected[mask] = background_color
153
160
 
154
161
  assert (
155
162
  expected.shape == image_to_check.shape
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: c2cwsgiutils
3
- Version: 6.2.0.dev52
3
+ Version: 6.2.0.dev55
4
4
  Summary: Common utilities for Camptocamp WSGI applications
5
5
  Home-page: https://github.com/camptocamp/c2cwsgiutils
6
6
  License: BSD-2-Clause
@@ -1,7 +1,7 @@
1
1
  c2cwsgiutils/__init__.py,sha256=HVSc-4O8i2aB0ozEI4AI8Xsb-4S6fAwhl8uRhv-DsFg,4057
2
2
  c2cwsgiutils/acceptance/__init__.py,sha256=5PeqPHxAPMRbZpKk1XlC9RCyotegSsKVfPxADYAgG7w,1502
3
3
  c2cwsgiutils/acceptance/connection.py,sha256=A83v335e4s-_cePe-bqRcEHHTOdgguetzdAtVp19-Zk,9834
4
- c2cwsgiutils/acceptance/image.py,sha256=Tr_cdtQL6WhRq0qIS0P6ulLDwOprbcE1jc1Ft1Qi4OY,8956
4
+ c2cwsgiutils/acceptance/image.py,sha256=zKouNqU424rkWW43-NwIEVeXIXaqZxSwe04NSE-3174,9290
5
5
  c2cwsgiutils/acceptance/package-lock.json,sha256=jLvCfPizXSwqLXC_02w3Vbq6qi5XIYpcCJmwy08iUdk,42580
6
6
  c2cwsgiutils/acceptance/package.json,sha256=u0---w2SMjJ_ZsAQ3_4k2zopt4Wq-VfBOLN59rZPoRo,102
7
7
  c2cwsgiutils/acceptance/print.py,sha256=DOPDHUP9wfM75qiPYhFI1P3awQKIBH-edO_TmhCjT8k,2568
@@ -60,8 +60,8 @@ c2cwsgiutils/stats_pyramid/_db_spy.py,sha256=A61t6VKIrRRIjbyZTldmAUl_Q3ZDVFYqyxj
60
60
  c2cwsgiutils/stats_pyramid/_pyramid_spy.py,sha256=GnJRlLSAPl4PwQH5jfmc2OX5Hz9MSRRVJT2VcqkniVE,3518
61
61
  c2cwsgiutils/templates/index.html.mako,sha256=cK8qGBDeQG5SiJJCfvL0oKpgacr7dPKx634AAQivmjA,1416
62
62
  c2cwsgiutils/version.py,sha256=7H3URblj26Ql0bL3eXtP0LSRBeW4HbEsQ8O_BfWNr90,3124
63
- c2cwsgiutils-6.2.0.dev52.dist-info/LICENSE,sha256=6bEOU0n7ued3SA-DQCsHQaACONMMRzGHmH5XhDVeD-U,1304
64
- c2cwsgiutils-6.2.0.dev52.dist-info/METADATA,sha256=4sCW5yfcwGs5eIeHe5LQ1Xq3zC8IDLNBHlUaxiKGs_g,36359
65
- c2cwsgiutils-6.2.0.dev52.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
66
- c2cwsgiutils-6.2.0.dev52.dist-info/entry_points.txt,sha256=ujgqMTL1awN9qDg8WXmrF7m0fgR-hslUM6zKH86pvy0,703
67
- c2cwsgiutils-6.2.0.dev52.dist-info/RECORD,,
63
+ c2cwsgiutils-6.2.0.dev55.dist-info/LICENSE,sha256=6bEOU0n7ued3SA-DQCsHQaACONMMRzGHmH5XhDVeD-U,1304
64
+ c2cwsgiutils-6.2.0.dev55.dist-info/METADATA,sha256=E0fqvWWuMxOKCNMBhYW1JH1LP4we-N71OY0al1-EkPk,36359
65
+ c2cwsgiutils-6.2.0.dev55.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
66
+ c2cwsgiutils-6.2.0.dev55.dist-info/entry_points.txt,sha256=ujgqMTL1awN9qDg8WXmrF7m0fgR-hslUM6zKH86pvy0,703
67
+ c2cwsgiutils-6.2.0.dev55.dist-info/RECORD,,