Environments | PYTHON :: EASI :: MODELER |
Quick links | Description :: Parameters :: Parameter descriptions :: Details :: Examples :: Algorithm :: Related |
Back to top |
Back to top |
Name | Type | Caption | Length | Value range |
---|---|---|---|---|
FILE* | String | Input file name | 1 - 192 | |
DBIC* | Integer | Input channels or layers | 3 - 3 | |
DBOC* | Integer | Output channel or layer | 1 - 1 | |
DBPCT* | Integer | Input pseudocolor segment or layer | 1 - 1 | |
MONITOR | String | Monitor mode | 0 - 3 | ON, OFF Default: ON |
Back to top |
FILE
Specifies the name of the PCIDSK image file that contains the imagery to be compressed.
DBIC
Specifies the three 8-bit channels or layers that contain the RGB image to be compressed.
DBOC
Specifies the single 8-bit black and white channel or layer that receives the compressed image.
DBPCT
Specifies the PCT segment or layer that supplies the set of available colors to which the image is compressed.
MONITOR
The program progress can be monitored by printing the percentage of processing completed. A system parameter, MONITOR, controls this activity.
Available options are:
Back to top |
ERRDIFF compresses a 24-bit color (RGB) image into a single 8-bit channel, based on a PCT (segment type: 171) that you provide. The PCT is used to color a compressed image so that it looks similar to the original 24-bit color image. This capability can be used when preparing color images for exporting to other third-party software (for example, a GIS system with limited color capability).
ERRDIFF can be used when color images must be exported to other hardware or software systems without 24-bit color support.
CMPRSS8 is based on selecting the nearest color in the PCT to represent each RGB pixel, based on the euclidean distance in the red, green, and blue dimensions. This is acceptable for some image types, but for RGB images with gradually changing colors, this method leads to noticeable banding effects. The error diffusion algorithm used by ERRDIFF attempts to select a nearby color in the PCT, (but not always the nearest one) in proportions such that, at a distance (as the pixels merge visually), a better approximation of the color of a region is achieved.
The input file contains the input RGB channels and the channel to which to write the compressed result. If the imagery is to be enhanced with a lookup table (LUT), apply it to the RGB channels ahead of time with the LUT function.
The input RGB channels and the output compressed channel must be 8-bit because of the nature of a PCT. Although any type of image channel can be used, values are internally converted to 8-bit data. Using non 8-bit data can result in unexpected or poor results.
Back to top |
Transfer a 24-bit color image to a GIS system to be used as a backdrop for digitizing vectors. The GIS system can only use 8-bit images in SUN Rasterfile format. Export the contents of /demo/map100.pix with the most appropriate PCT possible.
The ADAPT function generates a PCT well distributed to represent this particular image.
EASI>FILE = "map100.pix" EASI>DBIC = 1,2,3 EASI>RUN ADAPT
ERRDIFF is then used to transform the RGB image into a pseudocolor image, based on the adaptive PCT.
EASI>DBIC = 1,2,3 EASI>DBOC = 1 ! Overwrites channel 1. EASI>DBPCT=LASC ! Uses the newly created segment. EASI>RUN ERRDIFF
The 8-bit image is now made into a SUN Rasterfile.
EASI>FILI = FILE! map100.pix EASI>FILO = "map100.im8" EASI>DBIC = 1 EASI>DBIW = EASI>FTYPE="SUN" EASI>RUN FEXPORT
The file map100.im8 can now be used by the GIS system.
Back to top |
The error diffusion algorithm used by ERRDIFF is based on the concept of remembering the cumulative error in approximating the error for each pixel and attempting to err in the opposite direction in red, green, and blue image space for the next pixel.
For each pixel, the following process takes place.
P1 -- P2 / | \ / | \ P3 P4 P5
Finding the nearest color in the PCT to an RGB color is performed by building a large three-dimensional table with red, green, and blue values as the indices. This table is populated in advance with the nearest color for each possible RGB value to avoid computing by exhaustive comparison for each pixel in the image.
© PCI Geomatics Enterprises, Inc.®, 2024. All rights reserved.