Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion ga3c/Environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

from Config import Config
from GameManager import GameManager
import cv2


class Environment:
Expand All @@ -55,7 +56,10 @@ def _rgb2gray(rgb):
@staticmethod
def _preprocess(image):
image = Environment._rgb2gray(image)
image = misc.imresize(image, [Config.IMAGE_HEIGHT, Config.IMAGE_WIDTH], 'bilinear')
## Below method was deprecated in newer versions of scipy
# image = misc.imresize(image, [Config.IMAGE_HEIGHT, Config.IMAGE_WIDTH], 'bilinear')
## Alternative using cv2
image = cv2.resize(image, dsize=(Config.IMAGE_HEIGHT, Config.IMAGE_WIDTH), interpolation=cv2.INTER_LINEAR)
image = image.astype(np.float32) / 128.0 - 1.0
return image

Expand Down