vietnh1009 / Tetris-deep-Q-learning-pytorch

Deep Q-learning for playing tetris game
MIT License
470 stars 109 forks source link

Blurry Tetris Pieces #3

Open Kontra21 opened 4 years ago

Kontra21 commented 4 years ago

Found that when running this on my machine the Tetris pieces were incredibly blurry.

image

Changing Line 242 in src/tetris.py from

img = img.resize((self.width * self.block_size, self.height * self.block_size))

to

img = img.resize((self.width * self.block_size, self.height * self.block_size),0)

solved the issue by forcing 0 antialiasing on resize.

Python 3.8 Mac OS 10.15.3

titulebolide commented 4 years ago

I faced the same issue on Python 3.8; Debian 10.3

2197808908a commented 2 years ago

Because of what? Why is that? I spent a few days on it!!!

Kontra21 commented 2 years ago

Because you need to force antialiasing to 0 as per my code example above

kwin1412 commented 1 year ago

Because the default filter of image resize function is' PIL.Image.BICUBIC ', the image produced by resize is blurred, so force filter 4 to be changed to 'PIL.Image.BOX' Changing Line 242 in src/tetris.py from

img = img.resize((self.width * self.block_size, self.height * self.block_size))

to

img = img.resize((self.width * self.block_size, self.height * self.block_size),Image.BOX)