Semi Causal Nonparametric Markov Random Field Texture Synthesis

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.

Source Code

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.

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 Tests

Min Run Time

Max Run Time

Mean Run Time

Stdev Run Time

1

165

0 00:31:23

0 01:35:03

0 00:35:18

0 00:07:47

1 -c

165

0 00:31:13

0 01:34:16

0 00:34:53

0 00:07:15

1 -s

165

0 01:03:56

0 01:54:10

0 01:12:46

0 00:11:28

1 -s -c

165

0 01:04:13

0 02:15:02

0 01:11:47

0 00:10:26

2

165

0 01:04:36

0 03:21:20

0 01:13:41

0 00:15:17

2 -c

165

0 01:03:30

0 03:13:31

0 01:13:40

0 00:14:46

2 -s

165

0 03:21:20

0 11:19:55

0 04:02:32

0 00:46:22

2 -s -c

165

0 03:23:22

0 07:21:36

0 04:08:01

0 00:41:17

3

165

0 01:03:54

0 03:13:10

0 01:16:12

0 00:17:47

3 -c

165

0 01:04:33

0 02:04:17

0 01:13:36

0 00:13:18

3 -s

165

0 06:56:41

0 19:40:29

0 08:57:25

0 01:54:24

3 -s -c

165

0 06:58:14

1 07:17:52

0 09:02:56

0 02:39:20

4

165

0 01:37:10

0 05:20:45

0 02:00:02

0 00:34:48

4 -c

165

0 01:36:24

0 05:04:11

0 01:57:59

0 00:27:19

4 -s

165

0 11:46:22

1 15:45:23

0 15:21:18

0 04:45:01

4 -s -c

165

0 11:56:31

1 12:23:21

0 15:21:07

0 03:28:20

Limitations

This algorithm works well for natural textures which have a pixelwise
noise distribution. However unwanted noise appears in textures
that don't have a substantial pixel noise distribution (like
artificial textures). The noise seems to appear at pixel points
that have been synthesised at the higher grid levels (lower
resolution). There are various reasons for this, but it results
from modifying the update function pUpdateFn() in order to speed
up the algorithm. One possible solution would be to multiply the
probability image by say 0.9 after each grid level is
synthesised and before the next lower grid level begins its
synthesis. However this will inevitable lead to longer synthesis
times.

Additional Information

To compare this algorithm with other algorithms, it is necessary to
use the same neighbourhood for each.