1
0

Add some steps

This commit is contained in:
Jip J. Dekker 2018-05-25 14:37:32 +10:00
parent 9b4c4bf909
commit 2a00c812fb

View File

@ -3,6 +3,7 @@ from keras.models import Model, load_model
from keras.utils import to_categorical from keras.utils import to_categorical
import cv2 import cv2
from skimage import color, exposure from skimage import color, exposure
from _cutter import image_cut
def man_result_check(): def man_result_check():
pred_y = np.load("predicted_results.npy") pred_y = np.load("predicted_results.npy")
@ -50,5 +51,22 @@ def is_Wally(trained_model_path, image, from_file=False):
# Mark Wally image somehow (colour the border) # Mark Wally image somehow (colour the border)
# Stitch original image back together # Stitch original image back together
if __name__ == '__main__':
# Read image
image = cv2.imread("10.jpg")
# Split image
cuts = image_cut(image, 64, 64)
for i in len(cuts):
# Transform block
hsv = color.rgb2hsv(cuts[i])
hsv[:, :, 2] = exposure.equalize_hist(hsv[:, :, 2])
block = color.hsv2rgb(hsv)
block = np.rollaxis(block, -1)
if is_Wally("Waldo.h5", block):
# Border block
cuts[i] = cv2.copyMakeBorder(cuts[i],5,5,5,5,cv2.BORDER_CONSTANT,value=RED)
is_Wally("Waldo.h5", image) # Stitch image TODO!
# Show image
cv.imshow('Image', image)
cv.waitKey(0)