int lvfractal(
xvimage *img,
int region,
int lo_size,
int step)
D = 3 - H where, D - is the resulting fractal dimension H - is the computed Hurst coefficient 3 - constant related to the Euclidian geometry
The fractal dimension operation is computed, using overlapping windows, over the entire image. A range of window sizes up to one third of the size of the fractal region are used to compute the fractal dimension. The center pixel in each fractal region is updated based on the Hurst coefficient and subsequent fractal dimension calculation for that region.
The input image, which MUST be of data storage type FLOAT, corresponds to the -i argument. The output image, which corresponds to the -o argument, is stored as data type FLOAT. The resulting output image will be a single band image, and will have a border consisting of pixels of value 0, since the window operation does not calculate values for border pixels.
The size of the window for the "fractal region" is specified by the -r region size argument. The region size argument cannot be an even number. This means that the region dimensions must be odd (ie. 15x15, 17x17, etc.), since the center pixel is replaced with the computed value of the window data. The default region size is 15x15.
The initial size of the sliding window in the fractal region is specified by the -w initial sliding window size argument. The size of the sliding window cannot be less than 2 and cannot exceed 2 minus the upper window size. The upper window size is determined by the region size, and cannot exceed one-third of the region size. The size of the lower window cannot exceed 2 minus the upper window size, because at least two points are needed to calculate the slope of the best fit line.
The step size specifies the increment to use when incrementing the sliding window size from the initial size (-w argument) to the upper window size (determined from the region size). The step size cannot exceed a value that would prevent at least two points from being used to calculate the slope of the best fit line. The step size is specified by the -s step size argument.
Each pixel in the image is updated with a computed value except the border pixels. A 15x15 window will result in a border of seven pixels, a 17x17 window will result in a border of eight pixels, etc.
The resulting feature vector will contain one band of data, which contains the computed fractal dimension "D" of the image intensity data for the particular region size selected. Note that different results may be obtained by varying the region size and initial size of the sliding window.
Comments - To calculate the overall fractal dimension of an image, set the region size to be the same size as the image (Note: region size must be odd), and use an initial sliding window size about one-fourth to one-third of the region size. This will result in one value for the fractal dimension of the image, which can be obtained from running vstats.
When running this algorithm on a large image using a wide range of sliding window sizes, it may be helpful to use a generous step size to speed up the processing of the image. For example, if a 256 by 256 image is being processed with a region size of 65 and an initial sliding window size of 3, it may be helpful to select a step size of about 6. The following window sizes would be used in the calculation of the Hurst coefficient (slope of best fit line): window sizes --> 3 9 15 21
If finer resolution is needed, a smaller step size should be used at the expense of processing time.
To view the resulting fractal dimension image in 3-D, use Xprism3 to plot the image as a surface plot.
The input image MUST be of data storage type FLOAT.
The output image is of data storage type FLOAT.
none
none
$RETRO/objects/library/vipl/src/lvfractal.c