| Environments | PYTHON :: EASI :: MODELER |
| Quick links | Description :: Parameters :: Parameter descriptions :: Details :: Example :: Algorithm :: References :: Related |
| Back to top |
| Back to top |
histex(file, dbic, texture, dboc, flsz, mask, fillpct)
| Name | Type | Caption | Length | Value range |
|---|---|---|---|---|
| FILE * | str | Input file name | 1 - | |
| DBIC * | List[int] | Input channel | 1 - 1 | |
| TEXTURE * | str | Texture measures | 1 - | |
| DBOC * | List[int] | Texture-measure channels | 1 - 12 | |
| FLSZ | List[int] | Filter size (pixels, lines) | 0 - 2 | 3 - 101 Default: 3,3 |
| MASK | List[int] | Area mask | 0 - 4 | |
| FILLPCT | List[float] | Percentage of brightest fill pixels | 0 - 1 | 100 Default: 5 |
| Back to top |
FILE
The PCIDSK file that contains the channel to analyze for a specific texture measure.
The file also contains the output channels.
DBIC
The channel in the input file to analyze.
TEXTURE
The list of texture measures to create.
Do not specify duplicate texture measures.
For more information about the measures, see Algorithm.
DBOC
The output channels to which to write the texture measures. Output channels must be 32-bit real.
The total number of output channels must equal the number of texture measures you specify.
Do not use the input channel as an output channel.
Do not specify duplicate channels.
FLSZ
The size of the window, in pixels (x) and lines (y), to use for extracting the texture measures for each input pixel.
The window size must be odd so that the pixel to process is centered in the window. The value must be an odd integer between 3 and 101. The default value is 3,3.
MASK
The window or bitmap that defines the area of the input raster to process.
If you specify a single value, it represents the channel number of the bitmap segment in the input file. Only pixels under the bitmap are processed. The rest of the image remains unchanged.
If you specify four values, they define the x and y offsets and the x and y dimensions of a rectangular window identifying the area to process. Xoffset, Yoffset define the upper-left starting pixel coordinates of the window. Xsize is the number of pixels that define the window width. Ysize is the number of lines that define the window height.
If you do not specify a value, the entire channel is processed.
FILLPCT
The percentage of brightest pixels to compute the weighted-rank fill-ratio measure. The value must be greater than zero (0) and less than or equal to 100.
The percentage value specified is converted to the number of pixel values (depending on the size of window), rounded to the nearest-integer value.
| Back to top |
HISTEX creates a set of texture images from a single channel in an input image. The measures are based on histogram statistics in a window surrounding each pixel. If necessary, you can use the extracted texture measures as input features with CATALYST Professional classification algorithms.
Texture is an important characteristic used to identify objects or regions of interest in an image. Unlike spectral features, which describe the average tonal variation in the various bands of an image, textural features contain information about the spatial distribution of tonal variations within a band.
It is essential that filtering has not been applied previously on the input channel, because filtering smoothes out an image, and eliminates or alters its textural properties.
For each selected texture measure, HISTEX creates an image in which gray levels represent the value of the measure in the input image. The textural measures are derived from a histogram of pixel values in a rectangular window you specify. The window slides over the input image, and computed texture measures are assigned to the central pixel of the consecutive positions of the window.
The output images contain the raw texture measures, which may vary in ranges of values. To avoid loss of important information, always save in 32-bit real channels. After assessing the distribution of texture-measure values by running the HIS algorithm, you can scale the images to the range you want by running the SCALE algorithm.
With the MASK parameter, you specify the area within the input channel to process.
If you specify a single value, it represents the channel number of the bitmap segment in the input file.
Only the pixels under the bitmap are processed. The rest of the image remains unchanged.
If you specify four values, they define the x and y offsets and the x and y dimensions of a rectangular window identifying the area to process. Xoffset, Yoffset define the upper-left starting pixel coordinates of the window. Xsize is the number of pixels that define the window width. Ysize is the number of lines that define the window height.
If you do not specify a value, the entire channel is processed. If the specified bitmap is empty (all pixels set to zero), a warning is displayed and processing does not occur.
HISTEX cannot process pixels on or near the edges of the image, because all the required pixels are not within it. Therefore, when an entire image is processed with a rectangular window that is x-pixels by y-lines, the first and last (X+1)/2 pixels per line will be the same and the first and last (Y+1)/2 lines in the output image will be the same. Each will contain a replicated value of the closest processed pixel. Avoid these regions when selecting training data for supervised classification. If a partial image is processed, the input image buffers are extended towards the margins as far as possible, so that all pixels in the selected area receive computed textures; however, pixels closer than a half-window to the image edge will contain replicated values.
The texture measures extracted by HISTEX are based on statistics of pixel values in the window. They complement measures extracted by running the TEX algorithm, based on a gray-level co-occurrence matrix (GLCM), and with the HISTEX algorithm, based on the histogram of pixel values in a window. To conduct additional analysis, such as standard segmentation and classification of the image, you can combine the three types of measures.
| Back to top |
Create all 12 32-bit real texture-measure images from a 16-bit ERS-1 image on channel 11 of the irvine.pix file. Use exactly 50 pixels to compute the weighted-rank fill-ratio measure (50 pixels in a window with 25*25 pixels is equivalent to 50*100%/625 = 8%).
from pci.pcimod import pcimod from pci.histex import histex file='irvine.pix' pciop='ADD' pcival=[0,0,0,12] #Add 12 32R channels pcimod(file,pciop,pcival) dbic = [11] #Radar image texture = range(1,12+1) #Select required texture dboc = range(12,23+1) flsz = [25,25] #Filter Size in pixels mask = [12] #Process under bitmap fillpct = [8] #Percent of brightest fill pixels histex (file,dbic,texture,dboc,flsz,mask,fillpct)
| Back to top |
In the description of images, pixel color and brightness are parameters used commonly. A parameter used less often is the texture (graininess). As opposed to color and brightness, which are associated with one pixel, texture describes relationships between values of different pixels. Textures can be derived from global statistics of pixel values in a window, or from statistics of differences between pixel values.
HISTEX derives the measures derived from global statistics or a histogram of pixel values. The TEX algorithm derives measures from the statistics of differences or a global co-occurrence matrix.
Most of the texture measures HISTEX computes are based on the paper by Dekker cited in References.
The measures are extracted in a window with pixels (K) and lines (L), sliding over successive pixels of the image.
1: Mean
An arithmetic mean of all values in the texture window.
[SUM(i,j)(x_i,j)] / M
2: Median
The median is middle value in the texture window. Half the values in the window are less than or equal to it, and half are greater than or equal to it. With an odd number of values, the median is determined uniquely, although other values may be equal to it.
[SUM(i,j)(x_i,j)] / M
3: Mean Deviation from Mean
An arithmetic mean of absolute differences between pixel values in the window, and the mean. This is a measure of dispersion of values in the window.
[SUM(i,j)(|x_i,j - Mean|)] / M
4: Mean Deviation from Median
An arithmetic mean of absolute differences between pixel values in the window and the median. This is also a measure of dispersion of values in the window. It is less than or equal to Mean Deviation from Mean.
[SUM(i,j)(|x_i,j - Median|)] / M
5: Mean Euclidian Distance
A a measure of the scatter of pixel values in the texture window about the central pixel value. If the computed value is negative due to rounding errors, it is set to zero (0).
SQRT([SUM (i,j)(x_i,j - x_c)^2]) / (M - 1)
6: Variance
An unbiased estimate of sample variance of values in the texture window. If the computed value is negative due to rounding errors, it is set to zero (0).
[SUM(i,j)(x_i,j - Mean)^2] / (M - 1)
7: Normalized Coefficient of Variation
A measure of variability of window values normalized by their mean. The measure is well suited to analyzing synthetic-aperture radar (SAR) images, because it models statistical properties of SAR speckle.
SQRT( Var ) / Mean
8: Skewness
Skewness is the third standardized moment. This measure describes the degree of asymmetry of a distribution. If the distribution has a longer-left tail, the skewness is negative. Symmetric distributions, including Gaussian and constant, have skewness equal to zero (0); otherwise, the skewness is positive.
[SUM(i,j)(x_i,j - Mean)^3] / [(M - 1) * Var^(3/2)]
9: Kurtosis
Kurtosis is the fourth standardized moment. The measure describes the degree of peakedness of a distribution. If the distribution has a high-and-narrow peak, its kurtosis is greater than three. Gaussian distribution has a kurtosis equal to three. If the peak is broad and flat, the kurtosis value is less than three. Constant-valued windows have a kurtosis equal to zero (0).
[SUM(i,j)(x_i,j - Mean)^4] / [(M - 1) * Var^2]
10: Energy
The total magnitude of the signal in the window. Due to its large value, it may be not suitable with SAR images.
[SUM(i,j)(x_i,j)^2]
11: Entropy
The measure of disorder of the values within the window. It is large for windows with Gaussian (highly disordered) distribution of values, and small for windows with values concentrated tightly around one or several values.
-[SUM(i,j)(p_i,j * LOG2(p_i,j))] with p_i,j = x_i,j / [SUM(i,j)(x_i,j)] If x_i,j <= 0, its contribution is set to 0.
12: Weighted-rank fill ratio
This measure indicates how much the brightest pixels in the window dominate other pixels. It can be useful to detect forward or layover slopes in SAR images.
[SUM(p% brightest pixels)] / [SUM(i,j)(x_i,j)]
The preceding textural measures describe general characteristics of pixel values in the window. Each measure by itself contains little specific information. When combined with other information, however, the results of classification or segmentation of the underlying image may be improved. If necessary, you can combine these textural measures with those extracted by running the TEX algorithm. The best and most effective combination depends on the sensor type (optical, SAR) and the land-cover type. Some experimentation may be required to produce satisfactory results.
| Back to top |
Dekker, R.J. (2003). Texture Analysis and Classification of ERS SAR Images for Map Updating of Urban Areas in The Nederlands. IEEE Trans. Geosci. Remote Sensing, Vol. 41, No. 9, 1950-1958.
Beyer, W.H., editor (1984). CRC Standard Mathematical Tables, 27th Edition. CRC Press, Inc. Boca Raton, Florida.
© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.