GeoExpress offers three methods, the weight, shift and mask methods, for encoding an area of interest with JP2 (JPEG 2000) as the output format. For a table describing the area of interest encoding switches, see Specifying an Area of Interest.
The weight method is not to be confused with the “weight” parameter in the advanced encoding options. Also, area of interest encoding using the weight method functions differently for MrSID and JP2 output. In JPEG 2000 encoding the weight value controls the image quality of the foreground relative to the background or vice versa (for more information see Inner and Outer Areas).
Use the -aoiweightinner
switch to preserve the quality of the foreground areas at the expense of the surrounding regions. Similarly, use the -aoiweightouter
switch to preserve the quality of the background at the expense of the foreground. Both switches take an unsigned integer.
Acceptable values are 0 – 1000.
Larger values will result in a greater differences in quality between foreground and background, and smaller values will result in less of a marked difference. (Note: a value of 1.0 will have essentially no AOI weighting effect.)
When using the weight method, the actual boundaries of the region are defined by the extents of the codeblocks within each resolution level. Because the spatial extent of the codeblocks varies by level, the actual encoded region may appear larger than the selected region, and a step-like fall-off in quality may be noticeable.
For important additional information see Notes on AOI Encoding and JPEG 2000 below.
The shift method, like the weight method, favors either the “inner” or “outer” area.
The shift method is an alternative way to express the encoding of an area of interest when JPEG 2000 is specified as the output format. Rather than affecting the amount of quality in a codeblock at encode time, the shift mode adjusts the “importance” of individual pixels by the specified shift amount. In other words, this function promotes the importance (or sharpness) of the data inside or outside the area of interest (see Inner and Outer Areas).
The shift value to be specified is the number of bit positions to “promote” the foreground region over and above the background. For 8-bit samples, an appropriate scaling factor would be 12. Images to be encoded with large bit-depths and/or a large number of levels may, under certain conditions, require a higher value.
Use the -aoishift
switch to specify a value. Acceptable values are 1 – 20. Default shift when using the 5-3 wavelet is 5. Default shift value when using the 9-7 wavelet is 6. Note: If you use the -aoishift
switch you must also use either the -aoishiftinneror
the -aoishiftouter
switch.
You may use the -aoishiftinner
or -aoishiftouter
switches without using the -aoishift
switch. In this case, GeoExpress uses the default shift values noted above.
While the shift method does not suffer the stepping effects of the weight method, less granularity of control between foreground and background is afforded. The differences between the two methods are subtle and technical; we recommend that the weight method be used unless large quality differences are desired.
Although with practice and experimentation the shift mode can be used to completely mask out a desired region, its purpose is “obscuring” areas of an image rather than masking them out. It is recommended that you use the Mask method if you wish to achieve a masking effect (for more information see The Mask Method).
For important additional information see Notes on AOI Encoding and JPEG 2000 below.
The mask method in JP2 is the same as in MrSID area of interest encoding. For information, see The Mask Method.
The -aoinumlevels
switch controls the number of resolution levels subject to the AOI encoder process in the shift and weight methods; this can be used to alleviate the “stepping” effect mentioned above. When number of levels is set to less than the total number of levels in the image, the lower-resolution levels will not undergo AOI processing; in this way, only the n highest resolutions are affected, so the icon image (and potentially other lower-resolutions) will appear as if no AOI had been selected.
By default all zoom levels are subject to the AOI encoder.
When using the weight method for area of interest encoding with JPEG 2000, it is recommended that you use a smaller codeblock size, such as width = 32, height = 32. This parameter can be set with the -cbs
or -codeblocksize
switch (for more information see Advanced Encoding Options).
The overall compression ratio chosen for the encode job can be as important to the appearance of the region as the actual weight or shift values chosen. The image quality at a given compression ratio may diverge dramatically from expected results when AOI encoding is enabled. Getting the desired effect in JP2 area of interest encoding may require a trial and revision process.
For more information on JPEG 2000 encoding, see JPEG 2000 Images.