-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfigure10.py
More file actions
20 lines (17 loc) · 625 Bytes
/
figure10.py
File metadata and controls
20 lines (17 loc) · 625 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# This code is supporting material for the book
# Building Machine Learning Systems with Python
# by Willi Richert and Luis Pedro Coelho
# published by PACKT Publishing
#
# It is made available under the MIT License
import numpy as np
import mahotas as mh
# This little script just builds an image with two examples, side-by-side:
text = mh.imread("../SimpleImageDataset/text21.jpg")
building = mh.imread("../SimpleImageDataset/building00.jpg")
h, w, _ = text.shape
canvas = np.zeros((h, 2 * w + 128, 3), np.uint8)
canvas[:, -w:] = building
canvas[:, :w] = text
canvas = canvas[::4, ::4]
mh.imsave('figure10.jpg', canvas)