Semi Causal Nonparametric Markov Random Field Texture Synthesis

My Home Page

Fast Version

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.

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:

Source Code

Download Source Code 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.

The program is executed with the following command

nonparaMRF [-l levels] [-n neighOrder] [-s] [-t treeMax] [-c] [-x cols] [-y rows] [-h] texturefile

where

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.
s =
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.
c =
if set, the output image is defined to be toroidal (ie cyclic) where each border matches with its opposite border.
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.
h =
if set, will mean that just usage and default values will be displayed. This will also occur if no input values are given.
texturefile =
is the input texture image that is to be synthesised.

Default values are : levels = 256, neighOrder = 1, square = false, treeMax = 6, cyclic = false

Schematic of the neighbourhoods used in the texture synthesis algorithmSchematic of the neighbourhoods used in the texture synthesis algorithm

Synthesis run times for various input parameters

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. 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. Time stamps are in "Days Hours:Minutes:Seconds".

Neighbourhood# of TestsMin Run TimeMax Run TimeMean Run TimeStdev Run Time
1 1650 00:31:230 01:35:030 00:35:180 00:07:47
1 -c 1650 00:31:130 01:34:160 00:34:530 00:07:15
1 -s 1650 01:03:560 01:54:100 01:12:460 00:11:28
1 -s -c1650 01:04:130 02:15:020 01:11:470 00:10:26
2 1650 01:04:360 03:21:200 01:13:410 00:15:17
2 -c 1650 01:03:300 03:13:310 01:13:400 00:14:46
2 -s 1650 03:21:200 11:19:550 04:02:320 00:46:22
2 -s -c1650 03:23:220 07:21:360 04:08:010 00:41:17
3 1650 01:03:540 03:13:100 01:16:120 00:17:47
3 -c 1650 01:04:330 02:04:170 01:13:360 00:13:18
3 -s 1650 06:56:410 19:40:290 08:57:250 01:54:24
3 -s -c1650 06:58:141 07:17:520 09:02:560 02:39:20
4 1650 01:37:100 05:20:450 02:00:020 00:34:48
4 -c 1650 01:36:240 05:04:110 01:57:590 00:27:19
4 -s 1650 11:46:221 15:45:230 15:21:180 04:45:01
4 -s -c1650 11:56:311 12:23:210 15:21:070 03:28:20

Limitations

Additional Information

For More Information

Email Rupert Paget at: dr@rupertpaget.com

Valid HTML 4.01!

This site was proofread by
English Editing Experts.