Microsoft has made something interesting...

General FreeBASIC programming questions.
angros47
Posts: 1636
Joined: Jun 21, 2005 19:04

Microsoft has made something interesting...

Postby angros47 » Jul 05, 2011 19:15

Pixel art to vector graphic!

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

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

Postby KaraK » Jul 05, 2011 19:43

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

Postby Landeel » Jul 05, 2011 20:22

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:

Postby Destructosoft » Jul 06, 2011 1:22

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:

Postby Westbeam » Jul 06, 2011 10:25

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

Postby rolliebollocks » Jul 06, 2011 13:47

Mario looks something Picasso painted when he was 12.

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

Postby agamemnus » Jul 07, 2011 15:46

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

Postby anonymous1337 » Jul 07, 2011 23:06

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:

Postby relsoft » Jul 08, 2011 3:57

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

Postby angros47 » Jul 08, 2011 10:40

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: 744
Joined: Jan 25, 2007 10:32
Location: Brazil
Contact:

Postby Landeel » Jul 08, 2011 11:50

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: 6211
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Postby counting_pine » Jul 08, 2011 12:19

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:

Postby Destructosoft » Jul 09, 2011 0:27

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.)

Return to “General”

Who is online

Users browsing this forum: No registered users and 3 guests