rlcode / reinforcement-learning

Minimal and Clean Reinforcement Learning Examples
MIT License
3.37k stars 728 forks source link

Giving image as input in Gridworld #64

Closed akileshbadrinaaraayanan closed 7 years ago

akileshbadrinaaraayanan commented 7 years ago

Hi,

Is it possible to give image as input in Gridworld environment. Can you suggest ways in which this can be done? Are there ways of converting tkinter Canvas into a numpy array which can then be fed into a ConvNet?

Thanks, Akilesh

zzing0907 commented 7 years ago

Hi!! You can use ImageGrab function in PIL. I know only this way to capture image from tkinter canvas.

These links are helpful. Get image from canvas -> https://stackoverflow.com/questions/41940945/saving-canvas-from-tkinter-to-file Capture size doesn't fit -> https://stackoverflow.com/questions/24370228/python-imaging-library-fails-to-grab-whole-screen PIL image to numpy array -> https://stackoverflow.com/questions/384759/pil-and-numpy