Skip to content

Commit

Permalink
Ensure compatibility with "Python" 3.7.
Browse files Browse the repository at this point in the history
  • Loading branch information
KelSolaar committed Mar 24, 2019
1 parent 4857576 commit 0dc2407
Show file tree
Hide file tree
Showing 3 changed files with 393 additions and 292 deletions.
68 changes: 34 additions & 34 deletions colour_checker_detection/detection/segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,42 +207,42 @@ def as_8_bit_BGR_image(image):
>>> image = list(random_triplet_generator(8, random_state=prng))
>>> image = np.reshape(image, [4, 2, 3])
>>> print(image)
[[[ 0.96702984 0.54723225 0.97268436]
[ 0.71481599 0.69772882 0.2160895 ]]
[[[ 0.96702984 0.25298236 0.0089861 ]
[ 0.54723225 0.43479153 0.38657128]]
<BLANKLINE>
[[ 0.97627445 0.00623026 0.25298236]
[ 0.43479153 0.77938292 0.19768507]]
[[ 0.97268436 0.77938292 0.04416006]
[ 0.71481599 0.19768507 0.95665297]]
<BLANKLINE>
[[ 0.86299324 0.98340068 0.16384224]
[ 0.59733394 0.0089861 0.38657128]]
[[ 0.69772882 0.86299324 0.43614665]
[ 0.2160895 0.98340068 0.94897731]]
<BLANKLINE>
[[ 0.04416006 0.95665297 0.43614665]
[ 0.94897731 0.78630599 0.8662893 ]]]
[[ 0.97627445 0.16384224 0.78630599]
[ 0.00623026 0.59733394 0.8662893 ]]]
>>> image = as_8_bit_BGR_image(image)
>>> print(image)
[[[251 195 251]
[128 217 219]]
[[[ 23 137 251]
[167 176 195]]
<BLANKLINE>
[[137 18 252]
[122 228 176]]
[[ 59 228 251]
[250 122 219]]
<BLANKLINE>
[[112 253 238]
[167 23 203]]
[[176 238 217]
[249 253 128]]
<BLANKLINE>
[[176 250 59]
[239 229 249]]]
[[229 112 252]
[239 203 18]]]
>>> as_8_bit_BGR_image(image)
array([[[251, 195, 251],
[128, 217, 219]],
array([[[ 23, 137, 251],
[167, 176, 195]],
<BLANKLINE>
[[137, 18, 252],
[122, 228, 176]],
[[ 59, 228, 251],
[250, 122, 219]],
<BLANKLINE>
[[112, 253, 238],
[167, 23, 203]],
[[176, 238, 217],
[249, 253, 128]],
<BLANKLINE>
[[176, 250, 59],
[239, 229, 249]]], dtype=uint8)
[[229, 112, 252],
[239, 203, 18]]], dtype=uint8)
"""

image = np.asarray(image)
Expand Down Expand Up @@ -278,17 +278,17 @@ def adjust_image(image, target_width=WORKING_WIDTH):
>>> image = list(random_triplet_generator(8, random_state=prng))
>>> image = np.reshape(image, [2, 4, 3])
>>> adjust_image(image, 5) # doctest: +ELLIPSIS
array([[[ 0.9823518..., 0.5380895..., 1.0186476...],
[ 0.7563578..., 0.731978 ..., 0.4231120...],
[ 0.8726642..., 0.2936055..., 0.1687892...],
[ 0.8540266..., 0.1457020..., 0.2416218...],
[ 0.4018965..., 0.8263517..., 0.1943257...]],
array([[[ 0.9925326..., 0.2419374..., -0.0139522...],
[ 0.6174496..., 0.3460755..., 0.3189758...],
[ 0.7447774..., 0.6786660..., 0.1652180...],
[ 0.9476451..., 0.6550805..., 0.2609945...],
[ 0.6991505..., 0.1623470..., 1.0120867...]],
<BLANKLINE>
[[ 0.8791320..., 1.0425965..., 0.1503114...],
[ 0.7324403..., 0.1763674..., 0.3189642...],
[ 0.2110148..., 0.4074382..., 0.3919139...],
[ 0.2356165..., 1.0136062..., 0.5616219...],
[ 1.0039447..., 0.7759574..., 0.8924203...]]])
[[ 0.7269885..., 0.8556784..., 0.4049920...],
[ 0.2666564..., 1.0401633..., 0.8238320...],
[ 0.6419699..., 0.5442698..., 0.9082210...],
[ 0.7894426..., 0.1944301..., 0.7906868...],
[-0.0526997..., 0.6236684..., 0.8711482...]]])
"""

width, height = image.shape[1], image.shape[0]
Expand Down
Loading

0 comments on commit 0dc2407

Please sign in to comment.