Converting Raster img to Vector img and vice versa

BlitzMax Forums/BlitzMax Programming/Converting Raster img to Vector img and vice versa

gameshastra(Posted 2007) [#1]
Could anyone explain me how to convert a raster image to vector image. I have created a pixmap and saved that pixmap as a png using "grabpixmap()" and "savepixmappng" commands. But i could like to know how can we convert that raster image into vector image and again make it to raster from vector. Any idea appreciated.


Vertex(Posted 2007) [#2]
Raster image to vector image? Thats not possible!
There are algortihms for it but they have virgin not good results.


Perturbatio(Posted 2007) [#3]
It is [a http://www.google.co.uk/search?hl=en&client=firefox-a&rls=org.mozilla%3Aen-GB%3Aofficial&hs=sv3&q=convert+raster+image+to+vector+algorithm&btnG=Search]possible[/a] but you're not likely to get someone doing all your work for you.


Brucey(Posted 2007) [#4]
Use Flash. It has some "crude" functionality to do it.

I've used it in the past to convert scanned logos into vector images.

Doubtless there are other softwares out there too.


gameshastra(Posted 2007) [#5]
thanks


LAB[au](Posted 2007) [#6]
Depending the complexity of your raster image it could require more steps ... but the simpliest/crude method is using first Laplace filter (3x3 or more), followed by edge detection, I was using OpenCV lib to do that.


Grey Alien(Posted 2007) [#7]
but they have virgin not good results.
that's an interesting turn of phrase...


Damien Sturdy(Posted 2007) [#8]
I expect it translated from "but they have bad results the first time"


ImaginaryHuman(Posted 2007) [#9]
You'll have to `process the image` by going through it a pixel at a time, searching for `edges` (areas of contrast?) and seeing if there is a correlation between surrounding pixels, and whether the angle that the edge suggests is within a given threshold, and then gradually construct polygons from it. OR maybe convert the image to black and white with a given threshold and use that as an outline?


Russell(Posted 2007) [#10]
There have been programs capable of doing raster->vector (and vise-versa) since the Amiga days, but with widely varying results (from terrible to amazingly good). With smart resizing options out there for raster images, though, I can't really think of a good reason why you'd need to do it anymore, but it's surely possible.

Russell


gameshastra(Posted 2007) [#11]
Thank u. Can anyone explain me how can we do this conversion in Blitzmax. Is it possible....?


ziggy(Posted 2007) [#12]
@bb-miler: It is possible if you create a program to do it, or investigate existing open source code that helps you with that issue, and port it to BlitzMax.

If you're looking for a VectorToBitmap or BitmapToVector functions, they doesn't exist in the official BlitzMax modules. You can create them and we all will be very happy to use them where needed.

Are you a graphic designer? you can use Adobe Ilustrator or Freehand to make this sort of convertion with awesome results.