Introduction: non-standard gradient fills

When I'm writing "advanced math", I mean all, what is at least slightly more sophisticate than""bicubic interpolation". Looking at what the most popular progs for image processing do, I always try to understand, which algorithms they use. In fact, I didn't find something really intricate. There are lots of really sophisticated methods, used in science: computer tomography, holography and so on. I believe, that some of such methods could be used in common progs for image processing with a great benefit. Raster to vector conversion of photorealistic images is just the same case. It is traditionally considered as a rather difficult task. Methods, what one is using, trying to solve some problem, must be adequate to this problem. What actually presents in some raster? Set of contours and areas, painted with non-constant, but relatively slowly changing color (to say nothing about hi-frequency texture). Therefore, one must have tools for describing curves and regions with gradient fills. Meanwhile using of Bezier curves is enough efficient way to convert an edge between differently colored regions to vector object, situation with gradient fills is lots worse. I know none of vectorizers with gradient fills support. All of what I've seen makes the same thing- they decrease number of colors, actually presents in a source raster image, create edges, enclosing each constantly colored part of the source image. It means numerous contours, what are absent in a source raster. This is why all existing vectorizers offer alternative: either ugly looking image, reminds of a cheap Japanese cartoon, or a huge file repeatedly surpassing an initial raster in the sizes. In result the vector file similar to the raster prototype, deserves only one thing: "Exit without saving". On the other hand, tools for creation vector images support gradient fills. They offer gradient meshes for it. Not the best variant, I dare to say. This situation can be compared to drawing curves with the aid of only polylines. Really, they provide better control to drawing line than Bezier curves and are simpler. But if one wants to draw a circle with the same predeterminated quality, this one must use much more control points, if he choses polylines. For manual drawing and editing small number of control points is crucial. Therefore, using gradient meshes for gradient fills one meets at least two problems. This one must create these gradient meshes, and, be created, gradient meshes forces him to set color at each node- wants he to do it or not. I think, that gradient meshes are used so widely only because programmers know math not enough well. There are more efficient methods for describing non-constantly colored areas using as few info as possible. Here two different methods for gradient fills are presented, borrowed from the theory of elasticity, and results of raster to vector conversion, based on them. No gradient meshes at all. I'm trying to incorporate them into vector graphic. Look at what could be done, using non-standard gradient fills.

warped face    Warping

You can warp images without meshes at all. Put some control points onto an image to be distorted and move them. No problem at all. The only thing, what should be kept in mind, is that if one control point is moved, the whole image will be distorted. This fact could be treated as a defect, in comparison with mesh-based methods, or as an advantage. On the other hand, if you want to restrict distortion of some area of an image, put there some anchor points and do not move them. Or select a rectangular part of the whole image and warp it, leaving the rest untouched. Fix result of warping inside this rectangular area, select another area, warp it and so on. You may repeat it as much times as you need. One can put a lot of control points, hundreds in fact, but for demo its number is limited to six. Load photo of your beloved boss and go ahead. 

Download WarperDemo.zip(469 Kb) Download WarperDemo.7z(377 Kb)

Buy warper for $25

contour image    Outliner

This program detects edges, separating differently colored regions of an image and converts them to scalable vector curves. It takes a raster and transforms it to contour image. Output can be saved as vector (AI, EMF, SVG) or raster (PNG) graphic (For demo output image can be saved only as EMF- Enhanced Meta File.). This program is designed mostly for photorealistic true color rasters, not for technical illustration. It can convert them too, but for such kind of images another converters are better. One may set contour width, change size and proportions of an output and delete short lines. Try demo. Compare this prog with its analogues. My goal was to write a prog, what makes small and accurate vector images. Try and check by youself, if I did it. (A mountain above has been drawn with outliner too.)  

Download Outliner.zip(424 Kb) Download Outliner.7z(329 Kb)

Buy OutlinerPro

vector image         Raster to vector conversion

Here the first method of raster to vector conversion is presented. Let's name it «method A». This method is based on one not well known (otherwise it would be widely used) method for 2D interpolation. Let's try to imagine a flat table with set of nails, hammered into it. Each nail's head has its own elevation above table's surface. Let's take thin flexible sheet of steel (tinfoil) and press it to these nails. After this op each point of curved tinfoil will have some elevation above table's surface. This elevation may be treated as one of color components. Therefore, this method require only bounding curve for each area to be painted and set of vertices. To make computations as simple as possible, the whole image should be parted for set of pieces. This is the problem: not all edges between differently colored regions a closed curves, many of them are open arcs. Thus, here some additional contours are necessary too. But, their number is much fewer than for usual methods of raster to vector conversion is required. And pieces of an image are much larger. This is why vectors, created with this kind of gradient fills are much smaller and have better quality than all what can produce another vectorizers. The girl on a picture does not look like a vector, does she? But, she is. Corresponding vector file even as a text is four times smaller than the source bitmap. Unfortunately, an opportunity of qualitative conversion a raster in a vector isn't the finish. This operation has only a sense if one is going in future to edit the received vector file. For manual editing the small size of the file is critical. More shortly, the editor is necessary, and it is not presents now. If you want to know, how can vector graphic with support of an advanced gradient fills be, load SVSDemo. This program represents viewer and some vector files. These files are similar to SVG files, but only with some non-standard types of records. Therefore, they could be opened with any text editor, if you want to see their structure.  

Download SVSViewer.zip(306 Kb) Download SVSViewer.7z(259 Kb)

sample image         Painting

Certainly, I'm trying to use this kind of gradient fills, to realize at least a subset of ops, what are necessary for full-functional editor. My goal was to create a tool for painting regions with non-constant color, a tool, more efficient and convenient than gradient meshes. Try to play with PaintingTool and realize yourself, whether I really did it. This prog offers a possibility to create a vector image «from zero level». It means, drawing curves, changing its shapes, if you need, and painting obtained regions. You may do these ops in any sequence. You may paint without contours at all, in such case the whole image will be painted. To paint some region you need put some control points (vertices) on it and set color (RGB triplet) of each vertex. A region, bounded by curves, what you have drawn, will be painted. It means, here Method A is realized. Free tails of these curves will be ignored. There are some restrictions. A vertex cannot be put too close to others ones and on a curve. I'm in doubt, whether this last restriction has a sense. May be, I'll cancel it later. Well, more detailed info you'll find in menu's help topic. What is the most interesting for me is if this method is as efficient, as I think and which enhancements should be added. This image is what I created with my PaintingTool. Sorry I'm not a painter to show you something more impressive made by myself, but, thanks to V.Kovaleff, you can see some images, created with PaintingTool. Yeah, this boy is obviously no Velaskes, but these images are much better than all of what I can produce myself. I've added some results of vectorization too. These ones differs from original painting, and I see no need to explain which image in particular is result of original painting. But both kind of these images illustrate, I hope, potentiality of advanced gradient fills.

Download PaintingToolDemo.zip(497 Kb) Download PaintingToolDemo.7z(377 Kb)

sample image       Painting Pen

There are another methods of painting, and really efficient ones. Look at what one can do without vertices nor enclosed regions at all. Let's try to imagine thin sheet of tinfoil. You may make a slash by an axe or knife. In such case both sides of this slash moves at the same direction: both up or both down. Scissors are the other case: one side of a slash moves up, the other down. Let's name this method for gradient fills Method B. This way to realize gradient fills and converter, based on it, doesn't require additional contours at all. There is a program, what illustrates Method B. I named this tool Painting pen: one need to draw lines, but the whole image is painted simultaneously. Now this is a draft, which is intended only to demonstrate method. One may try raster to vector conversion too: this op is included. Actually, vector is buried deep inside my prog and an user sees only raster image. There is one nuance: raster to vector conversion, based on described here method of gradient fills, isn't complete. Some additional info must be included into resulting vector. Complete method must be based on Method A plus Method B. Program, what is presented here, PaintingPen is intended for tablet's input, so one may set intensity of a line (the difference in brightness of sides of a slash) by pressing to tablet's surface with mutable force. In any event, serious drawing should be done with a tablet, not with a mouse. Grayscale images, placed at Gallery, could be created so. They are in fact result of raster to vector conversion, but all info, necessary to reproduce them, is set of contours and one parameter (intensity), distributed along theses lines. PaintingPenDemo is an simulator, what demonstrates you process of creation such images as if someone is drawing on a tablet.

Download PaintingPen2.0.zip(850 Kb) Download PaintingPenDemo.zip(687 Kb)

         Gallery. Here is the set of vector images, converted to raster. Click to enlarge.

Increase Increase IncreaseIncreaseIncreaseIncrease

         Contact

If you want to tell something, go ahead. 

Your name:

Your e-mail:

Commentary:


 

Andrew Matseevsky, Kluchi-1, Kamchatka, Russia. +79147864061 ;Copyright © 2007 All rights reserved.