Created
November 29, 2016 05:22
-
-
Save Gotoryoo/8f7bb3bdf6497e1c16e446525f1b7ac4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Created on Fri May 01 19:17:23 2015 | |
@author: jyoshida-sci | |
""" | |
import cv2 | |
import numpy as np | |
import itertools | |
height = 440 | |
width = 512 | |
#generating images################# | |
for i, j in itertools.product(range(4), range(4)): | |
img = np.ones((height,width,1), np.uint8)*255 | |
msg="{0}-{1}".format(i,j) | |
location=(100,200) | |
fontface=cv2.FONT_HERSHEY_PLAIN | |
fontscale=10.0 | |
color=(0,0,0)#black | |
cv2.putText(img,msg,location,fontface,fontscale,color) | |
cv2.imwrite("{0}-{1}.bmp".format(i,j), img) | |
#joining images#################### | |
bigimg = np.ones((height*4,width*4), np.uint8)*255 | |
for i, j in itertools.product(range(4), range(4)): | |
sx=i*width | |
sy=j*height | |
ex=(i+1)*width | |
ey=(j+1)*height | |
filename="{0}-{1}.bmp".format(i,j) | |
img = cv2.imread(filename,cv2.CV_LOAD_IMAGE_GRAYSCALE) | |
bigimg[sy:ey,sx:ex] = img.copy() | |
cv2.imwrite("bigimg.bmp",bigimg) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment