Microsoft has made something interesting...
Microsoft has made something interesting...
Pixel art to vector graphic!
http://research.microsoft.com/en-us/um/ ... index.html
Can this algorithm be implemented in FreeBasic?
http://research.microsoft.com/en-us/um/ ... index.html
Can this algorithm be implemented in FreeBasic?
-
- Posts: 88
- Joined: Apr 03, 2011 3:44
- Location: Inside the bomb
- Contact:
I notice their server isn't rendering the algorithm very fast, but the results are very important for anyone making games with size 32 tiles who want to use some classic size 16 tiles without making them all pixely or blurry. Most of the bicubic and other enlarging reimaging methods have been inadequate.
-
- Posts: 2655
- Joined: Aug 28, 2008 10:54
- Location: new york
I would like to do it in Freebasic, but would rather translate their code than try to follow their paper (the heuristics might be hard to program...).. can't really find any code there.
I liked this one too:
http://johanneskopf.de/publications/solid/index.html
PS: I once achieved the same effect with Photoshop, unfortunately I didn't save the actions to make it. I just didn't have any space in the margins...
I liked this one too:
http://johanneskopf.de/publications/solid/index.html
PS: I once achieved the same effect with Photoshop, unfortunately I didn't save the actions to make it. I just didn't have any space in the margins...
-
- Posts: 5494
- Joined: Sep 12, 2005 20:06
- Location: California
-
- Site Admin
- Posts: 6323
- Joined: Jul 05, 2005 17:32
- Location: Manchester, Lancs
One of the cool things about the MS algorithm seems to be that it preserves the original pixel data of the image (except where it does that blurring thing for regions of colours it deems to be similar) - if you shrink the image down, taking the centre point for each pixel, then you get almost the original image back.
Here's a rough look at arbitrary scaling. Though, perhaps unsurprisingly, it only looks particularly good at the exact original size, and then at much larger sizes, so perhaps that's not a particularly useful feature.It would be interesting to see what it looks like if the blurring were disabled. That might even result in a nice-looking vectorisation of the Marine sprite in the PDF, stylised but "clean". I think the blurring messes it up.
Here's a rough look at arbitrary scaling. Though, perhaps unsurprisingly, it only looks particularly good at the exact original size, and then at much larger sizes, so perhaps that's not a particularly useful feature.
Code: Select all
chdir "t:\"
const IMGFILE = "smw_mario_ours_16x.bmp"
const IW = 18*16 '288
const IH = 29*16 '464
screenres 640, 480, 32
dim as any ptr img = imagecreate(IW, IH)
bload IMGFILE, img
dim as integer mx, my
dim as integer x, y, x2, y2, w, h
dim as single scal
do
while getmouse(mx, my): sleep 1: wend
scal = (my - 8) / IH
h = IH * scal: w = IW * scal
screenlock: cls
print w & "*" & h, scal, " (1/" & 1f/scal & ")"
put (320, 8), img
for y = 0 to h-1
for x = 0 to w-1
x2 = (x + 0.5) / scal
y2 = (y + 0.5) / scal
pset (x2 + 320, y2 + 8), point(x2 + 320, y2 + 8) xor &h808080
pset (x, y + 8), point(x2, y2, img)
next x
next y
screenunlock: sleep 1
loop until len(inkey)
imagedestroy img
-
- Posts: 88
- Joined: Apr 03, 2011 3:44
- Location: Inside the bomb
- Contact:
Fermat ftw!anonymous1337 wrote:Yeah, I never have any space left in the margins when I solve impossible problems.
Yeah, it seems likely they're just sending pre-rendered images down the pipe, although they seem to load more slowly than my broadband. In any case, I only need real-time renders in emulation, for which hq3x has been sufficient. (Actually I prefer big pixels when emulating.)@Destructosoft: Sure they're just not pulling the images from the server? That would be much smarter than re-rendering the images every time. If the images don't change, cache them.