Merge branch 'master' of https://github.com/Dekker1/ResearchMethods
This commit is contained in:
commit
f2a4bb8d2c
@ -53,7 +53,7 @@ def is_Wally(trained_model_path, image, from_file=False):
|
||||
|
||||
if __name__ == '__main__':
|
||||
# Read image
|
||||
image = cv2.imread("10.jpg")
|
||||
image = cv2.imread("7.jpg")
|
||||
# Split image
|
||||
cuts = image_cut(image, 64, 64)
|
||||
for i in range(len(cuts)):
|
||||
@ -63,11 +63,18 @@ if __name__ == '__main__':
|
||||
block = color.hsv2rgb(hsv)
|
||||
block = np.rollaxis(block, -1)
|
||||
if is_Wally("Waldo.h5", block):
|
||||
# if True:
|
||||
# Border block
|
||||
GREEN = [0, 255, 0]
|
||||
cuts[i] = cv2.copyMakeBorder(cuts[i][1:61,1:61],2,2,2,2,cv2.BORDER_CONSTANT,value=GREEN)
|
||||
|
||||
# Stitch image TODO!
|
||||
# Stitch image
|
||||
width = int(image.shape[1]/64) # TODO: does not work if this is not actually an integer
|
||||
i = 0
|
||||
layers = []
|
||||
while i < len(cuts):
|
||||
filler = [ np.zeros((64,64,3)) for j in range(i+width - min(i+width, len(cuts))) ]
|
||||
layers.append(np.concatenate(([cuts[j] for j in range(i, min(i+width, len(cuts)))] + filler),axis=1))
|
||||
i = i + width
|
||||
image = np.concatenate(layers, axis=0)
|
||||
# Show image
|
||||
cv2.imwrite('output.png',image)
|
||||
|
Reference in New Issue
Block a user