Semi Causal Nonparametric Markov Random Field Texture Synthesis
My Home Page
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.
- R. Paget and I. D. Longstaff, ``Texture synthesis via a noncausal
nonparametric multiscale Markov random field,'' IEEE Transactions
on Image Processing, vol. 7, n 6, pp. 925-931, June 1998.
However the basis of the algorithm first appeared in:
- R. Paget and I. D. Longstaff, ``A nonparametric multiscale Markov random
field model for synthesising natural textures,'' in Fourth International
Symposium on Signal Processing and its Applications, vol. 2, (Gold
Coast, Australia), pp. 744-747, ISSPA 96, August 1996.
- R. Paget and I. D. Longstaff, ``Texture synthesis via a nonparametric
Markov random field,'' in Proceedings of DICTA-95, Digital Image Computing:
Techniques and Applications (A. Maeder and B. Lovell, eds.), vol. 1,
(Brisbane, Australia), pp. 547-552, Australian Pattern Recognition Society,
December 1995.- Paget_DICTA_1995.pdf
The source code requires ImageMagick to be preinstalled. 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 and sgi machine, but I give no guarantees that they will work.
The program is executed with the following command
nonparaMRF [-l levels] [-n neighOrder] [-square] [-t treeMax] [-cyclic] [-x cols] [-y rows] [-help] texturefile
- levels =
- number of gray levels the image will be compacted to. Reducing the number from 255, will probably not improve the synthesis, and will most likely increase the run time.
- neighOrder =
- number to signify neighbourhood size. See neighbourhoods for schematics of the neighbourhoods used in the texture synthesis algorithm.
- square =
- if set, the neighbourhood becomes a square neighbourhood.
- treeMax =
- maximum quadtree height. The algorithm will not allow the quadtree height to be set to a value that will allow either the input image or output image to be reduced to less than a 2x2 pixel image.
- cyclic =
- if set, the output image is defined to be toroidal where each edge matches with its opposite edge.
- cols =
- number of columns in the output image. If undefined, number columns in the output image will equal number columns in the input image.
- rows =
- number of rows in the output image. If undefined, number rows in the output image will equal number rows in the input image.
- help =
- if set, will just display, usage and default values. This will also occur if no input values are given.
- texturefile =
- is a texture file or a list of texture files, that are to be synthesised one after the other.
Default values are : levels = 256, neighOrder = 1, square = 0, treeMax = 6 cyclic = 0, cols = 0, rows = 0
Synthesis run times for various input parameters
These times were compiled on SunBlades 100: 500 MHz, 256 MBytes RAM. The input textures were 128x128 pixel images, and the output synthesised textures were 256x256 pixel images. Although the run times are basically dependent on input image size, output image size, and neighbourhood size, the run times are also partly dependent on input texture type. This is due to the nearest neighbour search algorithm used in the code. In this table, is compiled the fastest run times, and slowest run times. But we found that the majority of the synthesis run times were close to the recorded fastest run times, and that the slowest run times were really just outliers.
|Neighbourhood||# of Tests||Fastest Run Time||Slowest Run Time||Mean Run Time||Std Run Time|
|1 ||165||0 0:06:39||0 0:20:06||0 0:07:26||0 0:00:07|
|1 -c ||165||0 0:10:16||0 0:31:22||0 0:11:50||0 0: 0:18|
|1 -s ||165||0 0:04:34||0 0:23:27||0 0:05:31||0 0: 0:11|
|1 -s -c||165||0 0:08:09||0 0:58:41||0 0:09:33||0 0: 0:22|
|2 ||165||0 0:04:34||0 0:19:35||0 0:05:12||0 0: 0:08|
|2 -c ||165||0 0:08:08||0 0:52:16||0 0:09:47||0 0: 0:22|
|2 -s ||165||0 0:04:39||0 1:08:02||0 0:06:17||0 0: 0:25|
|2 -s -c||165||0 0:08:13||0 1:02:28||0 0:10:14||0 0: 0:24|
|3 ||165||0 0:04:34||0 0:29:14||0 0:05:35||0 0: 0:12|
|3 -c ||165||0 0:08:09||0 0:39:29||0 0:09:33||0 0: 0:17|
|3 -s ||165||0 0:04:49||0 1:26:36||0 0:08:37||0 0: 0:42|
|3 -s -c||165||0 0:08:20||0 1:38:03||0 0:12:42||0 0: 0:44|
|4 ||165||0 0:04:35||0 0:28:50||0 0:05:32||0 0: 0:11|
|4 -c ||165||0 0:08:10||0 0:30:52||0 0:09:23||0 0: 0:14|
|4 -s ||165||0 0:05:00||0 2:39:57||0 0:14:02||0 0: 1:33|
|4 -s -c||165||0 0:08:29||0 2:55:30||0 0:16:48||0 0: 1:19|
For more information email: email@example.com
Texture Synthesis of Wei & Levoy's Textures
This site was proofread by
English Editing Experts.