Created
July 22, 2018 11:22
-
-
Save mdshopon/5c8f2d13fafa511dbb8fec8d3cf6222a to your computer and use it in GitHub Desktop.
This file contains 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
imgwide = 564 | |
from PIL import Image | |
strn = "testpage/01000" + str(i) + ".bin.png" | |
# img = Image.open('test2.png') | |
# img = img.resize((imgwide, 64), Image.ANTIALIAS) | |
img = cv2.imread(strn) | |
img = cv2.resize(img, (imgwide, 64)) | |
# # | |
img = np.asarray(img) | |
img = img[:, :, 0] # grab single channel | |
im = img | |
# plt.imshow(img,cmap='gray') | |
# plt.show() | |
# im = speckle(img) | |
# img = img.astype(np.float32) / 255 | |
img = cv2.adaptiveThreshold(img, 1, cv2.ADAPTIVE_THRESH_MEAN_C, \ | |
cv2.THRESH_BINARY, 11, 2) | |
# plt.imshow(img,cmap='gray') | |
# plt.show() | |
# a = a.astype(np.float32) / 255 | |
img = np.expand_dims(img, 0) | |
data = np.reshape(img, (1, 64, imgwide)) | |
X_data = np.ones([1, imgwide, 64, 1]) | |
X_data[0, 0:imgwide, :, 0] = data[0, :, :].T | |
# | |
decode_batch(test_func, X_data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment