Fast Version on a Gaussian Pyramid with K Nearest Search
This algorithm is a cut down version of the algorithm published in IEEE Transactions on Image Processing 1998. In this version, it has been rewritten for a single cpu machine. To maintain speed of synthesis, the update function pUpdateFn() has been set to return the maximum value. If this was modified to return a portion of the maximum value, then the synthesis would take longer, but there would be a gain in quality. If you do decide to modify the code, be careful, as I have not put in any safeguard checks. Best to fully understand the whole code, before modifying it.
This gaussian version implements the previous fast version on a Gaussian pyramid of the input image (instead of a decimated quadtree as in the fast version). As can be seen in the results, there is not a great improvement. But just a reduction in speed of synthesis, as about 1/3 more pixels need to be synthesised. However there does appear to be also a reduction in the speckle noise that was apparent in the images synthesised by the fast version.
Recently there has been quite an influx of nonparametric sampling techniques for texture synthesis (,here is a brief list). This is because it has been the nonparametric models that have had the greatest success at synthesising arbitrary textures. This technique uses a multiscale approach, which has the advantage that only a small neighbourhood is required.
However the basis of the algorithm first appeared in:
Download Source Code Last updated 21-11-02 | Copyright (C) 2002, by Rupert Paget, all rights reserved. |
The source code requires ImageMagick to be preinstalled. To compile the code, run gmake in the parent directory. There are two makefiles, one in parent directory, and in the src directory. If the code does not compile, both makefiles will need to be edited. I have written one for a sun (default) and one for an sgi machine, but I give no guarantees that they will work.
nonparaMRF_gaussian [-l levels] [-n neighOrder] [-s] [-t treeMax] [-c] [-x cols] [-y rows] [-m maskfile] [-h] texturefile
where
Default values are : levels = 256, neighOrder = 1, square = false, treeMax = 6, cyclic = false
These times were compiled on a distributed system of mainly SunBlades 100: 500 MHz, 256 MBytes RAM. The input textures were 128x128 pixel images, and the output synthesised textures were 256x256 pixel images. The run times are basically dependent on output image size and the type of input texture. This is due to the nearest neighbour search algorithm used in the code. If the input texture is fairly uniform in colour, then the search algorithm will be more of an exhaustive search, and therefore more dependent on input image size. Time stamps are in "Days Hours:Minutes:Seconds".
Neighbourhood | # of Tests | Min Run Time | Max Run Time | Mean Run Time | Stdev Run Time |
---|---|---|---|---|---|
1 | 165 | 0 0:04:10 | 0 0:13:10 | 0 0:04:53 | 0 0:01:12 |
1 -c | 165 | 0 0:04:10 | 0 0:13:44 | 0 0:04:47 | 0 0:01:04 |
1 -s | 165 | 0 0:04:15 | 0 0:15:59 | 0 0:05:22 | 0 0:02:02 |
1 -s -c | 165 | 0 0:04:16 | 0 0:13:32 | 0 0:05:10 | 0 0:01:30 |
2 | 165 | 0 0:04:20 | 0 0:13:55 | 0 0:05:18 | 0 0:01:32 |
2 -c | 165 | 0 0:04:19 | 0 0:13:47 | 0 0:05:14 | 0 0:01:24 |
2 -s | 165 | 0 0:04:29 | 0 0:40:36 | 0 0:08:07 | 0 0:05:14 |
2 -s -c | 165 | 0 0:04:29 | 0 0:37:20 | 0 0:08:23 | 0 0:05:46 |
3 | 165 | 0 0:04:22 | 0 0:16:24 | 0 0:05:32 | 0 0:01:45 |
3 -c | 165 | 0 0:04:21 | 0 0:14:55 | 0 0:05:45 | 0 0:01:56 |
3 -s | 165 | 0 0:04:50 | 0 2:39:09 | 0 0:21:17 | 0 0:24:48 |
3 -s -c | 165 | 0 0:00:04 | 0 2:52:35 | 0 0:20:37 | 0 0:23:52 |
4 | 165 | 0 0:04:24 | 0 0:17:59 | 0 0:06:01 | 0 0:02:12 |
4 -c | 165 | 0 0:04:24 | 0 0:17:55 | 0 0:06:04 | 0 0:02:24 |
4 -s | 165 | 0 0:05:00 | 0 7:34:32 | 0 0:49:32 | 0 1:05:53 |
4 -s -c | 165 | 0 0:05:03 | 0 6:52:57 | 0 0:51:45 | 0 1:10:05 |
Email Rupert Paget at: dr@rupertpaget.com
This site was proofread by
English Editing Experts.