All Projects → victorqribeiro → pixelRestorer

victorqribeiro / pixelRestorer

Licence: MIT license
Using statistics to restore pixel art images.

Programming Languages

HTML
75241 projects

Projects that are alternatives of or similar to pixelRestorer

pixel-art-supplies
Wholesale Pixel-Art resources (for free!) …
Stars: ✭ 31 (+34.78%)
Mutual labels:  pixel-art
VariantRetriever
VariantRetriever is a minimalist package for feature flagging
Stars: ✭ 23 (+0%)
Mutual labels:  experiment
Pulp-Fiction-ARKit
An experiment using Volume to reconstruct Pulp Fiction's dance scene in Augmented Reality
Stars: ✭ 46 (+100%)
Mutual labels:  experiment
pixelit
Create pixel art from an image
Stars: ✭ 692 (+2908.7%)
Mutual labels:  pixel-art
pixelm
A pixel art editor written in Elm
Stars: ✭ 34 (+47.83%)
Mutual labels:  pixel-art
metal camera
iOS metal camera with GPU shaders.
Stars: ✭ 68 (+195.65%)
Mutual labels:  pixel-art
ColorByNumber-iOS
Color by Number: a pixel coloring game on iOS.
Stars: ✭ 50 (+117.39%)
Mutual labels:  pixel-art
bevy retrograde
Plugin pack for making 2D games with Bevy
Stars: ✭ 212 (+821.74%)
Mutual labels:  pixel-art
Pixel
A real-time collaborative canvas, inspired by Reddit Place
Stars: ✭ 26 (+13.04%)
Mutual labels:  pixel-art
labml
🔎 Monitor deep learning model training and hardware usage from your mobile phone 📱
Stars: ✭ 1,213 (+5173.91%)
Mutual labels:  experiment
console-web-ui
Examples to show case how to build web based UI (that can be invoked using curl) for console applications using Javascript(NodeJS)
Stars: ✭ 28 (+21.74%)
Mutual labels:  experiment
yii2-wizflow
The wizard UI pattern implemented using yii2-workflow
Stars: ✭ 14 (-39.13%)
Mutual labels:  experiment
piskel
A simple web-based tool for Spriting and Pixel art.
Stars: ✭ 9,109 (+39504.35%)
Mutual labels:  pixel-art
TypeEdge
TypeEdge is a strongly-typed development experience for Azure IoT Edge.
Stars: ✭ 15 (-34.78%)
Mutual labels:  experiment
pixas-editor
Isometric pixel graphics editor
Stars: ✭ 24 (+4.35%)
Mutual labels:  pixel-art
vscode-luna-paint
A raster image editor extension for VS Code
Stars: ✭ 235 (+921.74%)
Mutual labels:  pixel-art
mcSIM
Code for running a multicolor structured illumination microscopy (SIM) experiment using a DLP6500 digital micromirror device (DMD) and performing SIM reconstruction.
Stars: ✭ 19 (-17.39%)
Mutual labels:  experiment
frontend-park
哈喽大家好~我是荣顶!这是一个有趣的前端趣味知识公园~该项目是我平时捣鼓前端相关技术的一些案例集合。
Stars: ✭ 66 (+186.96%)
Mutual labels:  pixel-art
ld47-fortLoop
Fort Loop: a 48h puzzle game for Ludum Dare 47
Stars: ✭ 24 (+4.35%)
Mutual labels:  pixel-art
ab-react-hook
🧪A/B-Testing React Hook
Stars: ✭ 19 (-17.39%)
Mutual labels:  experiment

pixelRestorer

Using statistics to restore pixel art images.

pixelRestorer

A live version of it is hosted here

How to use

Select the image, the way of redrawing it (mean, mode or median) and click Run or Hit Enter on the keyboard.

The processing is animated so you can see the algorithm working (it's not slow it was programmed like that).

About

This is a project I've been idealizing from some time now. Is it possible to reconstruct a pixel art image that has been corrupted by scaling or compression, using statistics? Well, lets give it a shot.

The Algorithm

The first step is to determine the image's "pixel size". The algorithm does that by diving the image in windows and calculating the probability of that window being the pixel size.

window = imageSize / 2
window = imageSize / 4
window = imageSize / 6
...

The window is a square matrix. 3x3, 6x6, 8x8...

It stores all the probabilities in a dictionary then returns the most likely to be the right pixel size - the greater value.

The algorithm calculates the probability of the window by getting the mean - sum of pixels divided by total pixels - of the area and comparing it to the median - element on the center of the array - plus some threshold. That's a way I found to calculate the entropy of the window. A window with low entropy must mean that the pixels in there are smiliar, right?!

The second step is to redraw the image pixelSize by pixelSize getting the mean, mode or median of each pixelSize. E.g.: The algorithm determined that the pixelSize is 8x8. So, it gets a 8x8 patch of the image, take the mean, the mode or the median and redraw every real pixel (1x1) with that value. So now the pixelSize - the window of 8x8 - is now filled with pixels of the same value.

Here's a comparison:

pixelRestorer

It got rid of most artefacts caused by scaling or compressing the original image.

Known problems

The algorithm does not work 100% of the cases nor with every possible image. For example, it doesn't work if the pixelSize is offsetted or if the image has a large area of the same color - as a background for instance.

If most of the image is similar, like a image with a large solid white color as background and just a small portion of it being the pixel art, it can't figure out the right size of the pixelSize. Cause every window will have a low entropy value (since its most white, no matter what).

It also blurs the images sometimes (most of the times), due to the fact that the image was scaled to some odd value (and the pixel seize its no a integer - like, it guessed the pixel size would be 6,5x6,5).

Also the code is a mess and has a lot of hard coded values in it. Sorry, I'll might refactor it later.

Disclaimer

I do not own the images used in the examples, I googled them. If you are or know the authors, contact me and will give proper credit.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].