Microsoft has made something interesting...

General FreeBASIC programming questions.
Post Reply
angros47
Posts: 2321
Joined: Jun 21, 2005 19:04

Microsoft has made something interesting...

Post by angros47 »

Pixel art to vector graphic!

http://research.microsoft.com/en-us/um/ ... index.html

Can this algorithm be implemented in FreeBasic?
KaraK
Posts: 72
Joined: Sep 13, 2006 19:01
Location: Argentina

Post by KaraK »

That's pretty impressive... I'm anxious to see that algorithm implemented in popular emulators.
Landeel
Posts: 777
Joined: Jan 25, 2007 10:32
Location: Brazil
Contact:

Post by Landeel »

Wow, that's really great.
Just imagine a shader that does that.
Destructosoft
Posts: 88
Joined: Apr 03, 2011 3:44
Location: Inside the bomb
Contact:

Post by Destructosoft »

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.
Westbeam
Posts: 239
Joined: Dec 22, 2009 9:24
Contact:

Post by Westbeam »

ImageImage
Mario looks really sad: :O
rolliebollocks
Posts: 2655
Joined: Aug 28, 2008 10:54
Location: new york

Post by rolliebollocks »

Mario looks something Picasso painted when he was 12.

Very cool though..
agamemnus
Posts: 1842
Joined: Jun 02, 2005 4:48

Post by agamemnus »

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...
anonymous1337
Posts: 5494
Joined: Sep 12, 2005 20:06
Location: California

Post by anonymous1337 »

Yeah, I never have any space left in the margins when I solve impossible problems.

@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.
relsoft
Posts: 1767
Joined: May 27, 2005 10:34
Location: Philippines
Contact:

Post by relsoft »

Wow!!! Just wow!!!
angros47
Posts: 2321
Joined: Jun 21, 2005 19:04

Post by angros47 »

A thing I'd like to do, is to use something like this (maybe the HQ4x alorithm, that is open source), with OpenGL (i.e. to build mipmaps, so a sprite could be zoomed and maintain a good quality)
Landeel
Posts: 777
Joined: Jan 25, 2007 10:32
Location: Brazil
Contact:

Post by Landeel »

I wrote my own scaler for my game.

Image

It's a combination of Scale2X, Eagle, and a few other tricks.
It's not fast enough to be used in realtime. I use it to generate scaled-up OpenGL textures.
counting_pine
Site Admin
Posts: 6323
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Post by counting_pine »

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.

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
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.
Destructosoft
Posts: 88
Joined: Apr 03, 2011 3:44
Location: Inside the bomb
Contact:

Post by Destructosoft »

anonymous1337 wrote:Yeah, I never have any space left in the margins when I solve impossible problems.
Fermat ftw!
@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.
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.)
Post Reply