e filtering images...filtering images page 3 in photography, filters of various types can be placed...

24
Filtering Images page 1 Tutorial Filtering Images with TNTmips ® F I L T E R I N G

Upload: others

Post on 23-Apr-2020

9 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: E Filtering Images...Filtering Images page 3 In photography, filters of various types can be placed in front of the camera lens to alter and enhance the image that is recorded. Digital

Filtering Images

page 1

Tutorial

FilteringImages

with

TNTmips®

FILTERING

Page 2: E Filtering Images...Filtering Images page 3 In photography, filters of various types can be placed in front of the camera lens to alter and enhance the image that is recorded. Digital

Filtering Images

page 2

Before Getting Started

You can print or read this booklet in color from MicroImages’ web site. Theweb site is also your source for the newest Getting Started booklets on othertopics. You can download an installation guide, sample data, and the latestversion of TNTmips.

http://www.microimages.com

In working with digital forms of aerial photographs or satellite imagery, you willencounter many images that can be improved by the form of image enhancementknown as filtering. This booklet introduces you to two of the filter processes inTNTmips®. The Spatial Filters process includes a variety of filters designed toreduce noise content, sharpen details, or highlight edges or other aspects of theimage texture. The Locally Adaptive Contrast Enhancement (LACE) filter processcan improve the appearance of high-contrast grayscale or color images.

Prerequisite Skills This booklet assumes that you have completed the exercisesin the tutorial booklets entitled Displaying Geospatial Data and TNT ProductConcepts. Those exercises introduce essential skills and basic techniques thatare not covered again here. Please consult those booklets for any review youneed.

Sample Data The exercises presented in this booklet use sample data that isdistributed with the TNT products. If you do not have access to a TNT productsDVD, you can download the data from MicroImages’ web site. In particular, thisbooklet uses sample files in the FILTER, HAWAII, and CROPDATA data collections.

More Documentation This booklet is intended only as an introduction to filteringraster images. Details of the processes discussed can be found in a variety oftutorial booklets, Technical Guides, and Quick Guides, which are all availablefrom MicroImages’ web site (go to http://www.microimages.com/search to quicklysearch all available materials, or you can narrow your search to include onlytutorials or plates).

TNTmips® Pro and TNTmips Free TNTmips (the Map and Image ProcessingSystem) comes in three versions: the professional version of TNTmips (TNTmipsPro), the low-cost TNTmips Basic version, and the TNTmips Free version. Allversions run exactly the same code from the TNT products DVD and have nearlythe same features. If you did not purchase the professional version (which requiresa software license key) or TNTmips Basic, then TNTmips operates in TNTmipsFree mode. All the exercises can be completed in TNTmips Free using the samplegeodata provided.

Randall B. Smith, Ph.D., 5 January 2012©MicroImages, Inc., 1997-2012

Page 3: E Filtering Images...Filtering Images page 3 In photography, filters of various types can be placed in front of the camera lens to alter and enhance the image that is recorded. Digital

Filtering Images

page 3

In photography, filters of various types can be placedin front of the camera lens to alter and enhance theimage that is recorded. Digital image processingcan achieve an even wider range of imageenhancements using numerical procedures thatmanipulate the brightness values stored in a rasterobject. The term filter is also commonly used torefer to these image processing operations. Filteroperations can be used to sharpen or blur images, toselectively suppress image noise, to detect andenhance edges, or to alter the contrast of the image.

The variations in brightness at different spatialscales within a raster image can be thought of as acollection of spatial frequencies. Major changes inbrightness over a short distance represent a high-frequency component of the image.Conversely, more widely-spaced shifts inbrightness form a low-frequencycomponent. Many filters act to suppressa particular set of spatial frequencies,while leaving others unaltered.

Most of the filter operations discussed inthis booklet are included in the SpatialFilter process. The Spatial Filter operations calculatea new value for each raster cell using values in asurrounding group of cells. You specify the natureof this group by setting the shape and size of thefilter window. (The default filter window is squareand has an odd number of lines and columns). Asthe filter window is moved through the input rastercell by cell, the process reads the set of input cellvalues within the current window, applies a specificset of functions to calculate an output value for thecentral cell, and writes the new value to thecorresponding cell in the output raster. Thisprocedure is commonly referred to as spatialconvolution filtering.

Pages 4-10 introduce youto key features of the SpatialFilters process interface andto filters in the Generalclass. Noise Reductionfilters are discussed onpages 11-14, Enhancementfilters on pages 15-18, andTexture filters on page 19.The Locally AdaptiveContrast Enhancement(LACE) filter process isdescribed on pages 20-22.

Welcome to Filtering Images

Spatial convolutionfiltering

Raster

lines

columns

movingfilterwindow

currentoutput

cell

Idealized Spatial Frequency Patterns

Low-frequencyHigh-frequency

Page 4: E Filtering Images...Filtering Images page 3 In photography, filters of various types can be placed in front of the camera lens to alter and enhance the image that is recorded. Digital

Filtering Images

page 4

When you launch the Spatial Filter process, the RasterSpatial Filtering window appears. The spatial filtersare organized into six classes: General, EdgeDetection, Enhancement, Noise Reduction, Radar,and Texture. To select a filter, first choose theappropriate filter class from the Class option menu,then the specific filter from the Type option menu.

The Class option menu defaults to General whenyou enter the Spatial Filter process. The filters inthis class calculate a weighted average of the cellsin the filter window. The set of weighting coefficientsused in the calculations are called the filter kernel.The filter kernel always has the same dimensions asthe current filter window; the default size is 3 linesby 3 columns. Each filter in the General class has itsown set of filter kernels (for different kernel sizes)which produce characteristic results. The array tableon the left side of the Kernel tabbed panel displaysthe coefficients for the currently selected filter.

STEPSlaunch the Spatial Filterprocess (Image / Filter /Spatial Filter from theTNTmips menu)click [Rasters...] on theRaster Spatial Filteringwindowuse the standard File /Object Selectionprocedure to selectraster object TM3NOISY

from the NOISYTM ProjectFile in the FILTER datacollectionaccept the defaultselections on the Classand Type option menus

Use the standard displayprocess (Display / SpatialData) to view the input andoutput raster objects foreach of the exercises.

The Kernel tabbed panel displays the array of weighting coefficientsthat make up the current filter kernel (for filters in the General class).

With the Single / Composite toggle button turned on, thefilter can be applied individually to up to 50 raster objects.Press the Rasters button

to select an input raster.

Input rasters arelisted in thescrolled list.

Use the Classmenu to choosethe filter class.

Use the Typemenu to choosethe filter type.

General Filters

Page 5: E Filtering Images...Filtering Images page 3 In photography, filters of various types can be placed in front of the camera lens to alter and enhance the image that is recorded. Digital

Filtering Images

page 5

The default filter type in the General class is the LowPass / Average filter. The output cell value calculatedby this filter is the simple average (arithmetic mean)of the cells in the filter window. The averagingperformed by the Low Pass filter removes some ofthe higher frequency features, while allowing thelow-frequency features to “pass” through the filterunchanged (thus the term “low pass” filter). Thishas the effect of smoothing the raster image,emphasizing its larger-scale brightness trends.

Whether the smoothing produced by the low passfilter is beneficial or not depends on thecharacteristics of the input image. If the high-frequency features represent introduced “noise” thatdetracts from the overall image quality, the low-passsmoothing will improve the image. However,smoothing may also blurr edges, degrade usefulimage detail, and reduce contrast. In the exampleused in this exercise, the filter suppresses horizontalstriping noise in the image, but also reduces imagedetail.

STEPSaccept the defaultsettings and select Runfrom the Filter menuuse the File / ObjectSelection procedure toname a new Project FileFILTOUT, and accept thedefault name for theoutput raster objectclick [OK] on the File /Object Selection windowto close it and initiate thefilter process

The weighting coefficients(filter weights) for the LowPass / Average filter all havea default value of 1.00 (seeillustration on previouspage). The raw cell valuesare therefore used in theaveraging process, and theresulting output value is thesimple average (mean) ofthe cell values in the filterwindow.

Low Pass / Average Filter

Upper right part of raster object TM3NOISY

(input image), which shows horizontalstriping.

Same part of image with 3 x 3 low pass filterapplied (auto-normalized contrast). Stripingis reduced, but small features are slightlyblurred.

Page 6: E Filtering Images...Filtering Images page 3 In photography, filters of various types can be placed in front of the camera lens to alter and enhance the image that is recorded. Digital

Filtering Images

page 6

STEPSselect 7 x 7 from theSize menu of the RasterSpatial Filtering windowselect Run from the Filtermenu and direct theoutput raster to theFILTOUT Project File

The spatial filter process provides several predefinedfilter window sizes up to 11 x 11 cells. You cancreate a larger filter window by typing new values inthe Width and Length text boxes on the Kernel tabbedpanel.

Increasing the filter window size extends the filtereffects to lower spatial frequencies. For the LowPass filter, this means that the degree of smoothingincreases with increasing filter window size. Theboundary between high frequency features removedand low frequency features retained moves towardthe lower frequencies. The 7 x 7 Low Pass filterapplied in this exercise removes more details, andlarger-scale details, than the 3 x 3 filter applied inthe previous exercise. For the small, low-resolutionraster image we are using (28.5 meter cell size), the7 x 7 filter produces excessive blurring. Larger filterwindow sizes are generally more appropriate forhigher-resolution raster images.

Select a predefined filterwindow size from the Sizeoption menu.

You can type new values inthe Width and Length textboxes to create a filterwindow with a custom size.

The Circular Kernel optionchanges the weight values inthe corners of the filter kernelto 0. This restricts theaveraging process to aroughly circular window area.

When the filter window is larger than 3 x 3 cells, the scrollbars on the filter kernel array tables allow you to move thearray to inspect the full set of weighting coefficient values.

Upper right part of raster object TM3NOISY

with 7 x 7 Low Pass filter applied (auto-normalized contrast). Spatial averaginghas greatly reduced image detail.

Change the Filter Window Size

“Circular” kernel

Square kernel

Page 7: E Filtering Images...Filtering Images page 3 In photography, filters of various types can be placed in front of the camera lens to alter and enhance the image that is recorded. Digital

Filtering Images

page 7

The High Pass filter selectively enhances the small-scale features of an image (high-frequency spatialcomponents) while maintaining the larger-scalefeatures (low-frequency components) that constitutemost of the information in the image. The defaultfilter kernel for the High Pass filter has filter weightvalues of -0.5 for all cells except the center cell, whichhas a positive weight (its value depends on the sizeof the filter window). The filter calculationessentially amplifies the value of the center cell, thensubtracts from it half the average value of thesurrounding cells. If the center cell differs greatly inbrightness from its neighbors, this difference will beaccentuated in the output image, while areas ofuniform brightness are changed very little. The resultis enhanced contrast for edges and other small-scalefeatures in the image. The image appears sharper,and details obscured by atmospheric haze or poorfocus in the imaging system become more obvious.Increasing the filter window size extends theenhancement to increasingly larger features, whichat some point may make the output image appeartoo harsh.

STEPSclick [Rasters...] on theSpatial Filtering windowand select raster objectRED from the RGBCROP

Project File in theCROPDATA data collectionselect 5 x 5 from the Sizeoption menuselect High Pass fromthe Type option menuselect Run from the Filtermenu and direct theoutput raster to theFILTOUT Project File

Filter kernel for 3 x 3High Pass filter.

High Pass Filter

Upper left part of raster object RED (inputimage), which appears slightly blurred.

Same image with 5 x 5 High Pass filterapplied (auto-normalized contrast). Theimage appears sharper, with clearer edgesand enhanced details.

Page 8: E Filtering Images...Filtering Images page 3 In photography, filters of various types can be placed in front of the camera lens to alter and enhance the image that is recorded. Digital

Filtering Images

page 8

The Test mode allows you to preview filter resultsfor one or more selected parts of an image. Use theBox, Circle, or Polygon drawing tools on the TestDisplay window to outline a test area, which can beany size up to the dimensions of the input raster.Click the right mouse button or press the Apply iconbutton to apply the filter to the selected area andupdate the display. You can repeat the filter test onadjacent test areas or on the same test area to evaluatethe effects of different filter settings. The test processis not cumulative; each filter operation is performedon the original input raster. You can restore thecurrently selected area of the display to its originalappearance by pressing the Restore icon button.

STEPSchoose Test from theFilter menuclick the Box iconbutton in the TestDisplay windowplace the mouse pointernear the upper left cornerof the image areaclick and hold the leftmouse button as youdrag the mouse pointerdown and to the right tocreate a rectangle asillustrateddrag an edge or cornerof the box to resize it ifnecessarypress the right mousebutton to execute the testfilteringchoose Close from theFile menu on the TestDisplay window whenyou are finished testing

When you use the Testoperation with multiple grayscaleor RGB input rasters, only asingle selected raster isdisplayed for testing.

Polygon Tool

Circle Tool

Box Tool

Test Filter Results

When you test different areas,previous test results areretained in the display. ChooseRestore All from the File menuto restore the entire display tothe original unfiltered state.

The Save As option lets yousave the temporary rasterdisplayed in the Test Displaywindow with whatever filtereffects you have applied to partor all of the raster area.

Apply Restore

Page 9: E Filtering Images...Filtering Images page 3 In photography, filters of various types can be placed in front of the camera lens to alter and enhance the image that is recorded. Digital

Filtering Images

page 9

You can limit a filter to only a selected part of animage by applying a mask during the filter process.A mask is a binary raster used to control the displayor processing of a corresponding image. The maskhas a value of 1 for cells that will be processed, anda value of 0 for cells that will be excluded fromprocessing. When you apply a mask in the SpatialFilter process, the masked portions of the image arecopied without change to the output image. In thisexample wooded areas, fence rows, and roads aremasked, so the high-pass filter accentuates detail onlyin the cultivated fields. (You can create a mask easilyusing the Region-of-Interest tool in the FeatureMapping process.)

STEPSturn on the Apply Mask toOutput toggle button onthe Output tabbed panelclick [Mask...] and selectthe FLD_MASK raster objectfrom the RGBCROP ProjectFileselect Run from the Filtermenu and direct theoutput raster to theFILTOUT Project File

Apply a Mask

The Apply Mask to Output toggle buttonis turned off automatically when filterprocessing is complete, but the maskremains selected. To run additional filteroperations with the mask, turn on thetoggle button before running each filter.

Mask controls are on theOutput tabbed panel.

Lower right part of input image showingfields separated by strips of trees orgrass.

Same image area displayed with mask.

Output image. Masked areaswere not altered, but detail isincreased in fields.

You can also choose tocopy contrast tablesfrom the input raster tothe filtered image.

Page 10: E Filtering Images...Filtering Images page 3 In photography, filters of various types can be placed in front of the camera lens to alter and enhance the image that is recorded. Digital

Filtering Images

page 10

You can also restrict filtering to a portion of the imageby using drawing tools to outline the selected area.For example, you might want to enhance a singlefield in a farm scene. The Raster Area Selectionwindow provides Box, Circle, and Polygon drawingtools to let you select the area for filtering. Parts ofthe image outside the selected area are copied withoutalteration to the output image.

STEPSturn on the Filter:Polygon toggle button inthe upper right part of theRaster Spatial Filteringwindowpress the Select FilterPolygon button on theParameters tabbedpanelchange the Mode settingof the Line / Polygon EditControls window toStretchuse the Add Endoperation to add verticesto build a polygonoutlining the area forfiltering as illustrateduse the Drag Vertexoperation to adjust thepolygon shape asneededpress the right mousebutton to accept the area(or click [Apply] on theLine / Polygon Editcontrols window)click [OK] on the RasterArea Selection windowselect Run from the Filtermenu and direct theoutput raster to theFILTOUT Project File

Lower left portion of output image with High Passfiltered area surrounded by unaltered image.

Filter Part of an Image

Turn on the Filter: Polygon toggle button...

...then press the SelectFilter Polygon button.

The Line / Polygon Edit Controls aredescribed in detail in the tutorial bookletentitled Editing Vector Geodata.

Draw the selection polygon.

Add End Drag Vertex Stretch

Page 11: E Filtering Images...Filtering Images page 3 In photography, filters of various types can be placed in front of the camera lens to alter and enhance the image that is recorded. Digital

Filtering Images

page 11

Some images contain spurious cell values (muchbrighter or darker than their surroundings) thatrepresent “noise” imposed by the imaging system orby later processing. The filters in the NoiseReduction class provide several approaches toremoving image noise.

The Median filter ranks the input values from thecurrent filter window in numerical order and assignsthe median (middle) value to the output cell. Becausethe median value is not affected by the actual valueof the noise cells, the Median filter is particularlygood at removing isolated random noise, as in thisexample. It also preserves edges and line featuresbetter than the Low Pass / Average filter, but doesproduce some blurring.

STEPSturn on the Filter: Alltoggle buttonclick [Rasters...] on theSpatial Filtering windowand select raster objectTM3NOISY from the NOISYTM

Project File in the FILTER

data collectionselect 3 x 3 from the Sizeoption menuselect Noise Reductionfrom the Class optionmenu and accept thedefault selection ofMedian on the Typeoption menuselect Run from the Filtermenu and direct theoutput raster to theFILTOUT Project File

Median Filter (Noise Reduction)

The filters in the NoiseReduction, Enhancement,Radar, and Texture classes donot use a simple kernel ofweighting coefficients to performthe filter operation. The Kernelarray tables are dimmed andinoperative when you choose afilter in one of these classes.

Lower left portion of input image withrandom and horizontal line noise. Same area with 3 x 3 Median filter applied.

Choose Noise Reduction from the Class: option menu.

Page 12: E Filtering Images...Filtering Images page 3 In photography, filters of various types can be placed in front of the camera lens to alter and enhance the image that is recorded. Digital

Filtering Images

page 12

The Low Pass / Average filter discussed earlier canbe used to reduce image noise, but it is not an idealchoice for this purpose because the mean value forthe filter window (the filter output) can be skewedby the extreme values of noise cells. The Olympicfilter is a variant of the Low Pass filter which attemptsto correct this problem.

The Olympic filter is named for the system of scoringused in certain Olympic events, in which the highestand lowest scores are dropped and the remaining onesare averaged. The Olympic filter likewise discardsthe high and low values in the filter window beforedetermining the mean of the remaining values. Sincenoise cells are likely to rank as the highest or lowestvalues in the window, this procedure prevents thenoise cells from biasing the output value. In thisexample the 3 x 3 Olympic filter removes the imagenoise, but causes some loss of image detail.

STEPSselect Olympic from theType option menuuse the slider on theParameters tabbedpanel to set the value ofFilter Parameter A to 1select Run from the Filtermenu and direct theoutput raster to theFILTOUT Project File

Olympic Filter (Noise Reduction)

Parameter A for the Olympicfilter is an integer valuewhich determines thenumber of values discardedat each end of the rankedlist of values in the filterwindow. When Parameter Ais set to 1, the single highestand single lowest values arediscarded before averaging.

Lower left portion of noisy input image. Same area with 3 x 3 Olympic filter applied.

Page 13: E Filtering Images...Filtering Images page 3 In photography, filters of various types can be placed in front of the camera lens to alter and enhance the image that is recorded. Digital

Filtering Images

page 13

The P-Median filter is designed to suppress noisewhile preserving edge and line detail. The filtercalculates median values for two subsets of valuesin the filter window: 1) combined horizontal andvertical transects through the center cell, and 2) twodiagonal transects through the center cell. These twomedian values are then averaged. The output of thefilter is a weighted average of the averaged medianand the original center cell value. The weighting iscontrolled by Filter Parameter A, which can vary invalue from 0 to 1. The value of 0.20 for ParameterA in this exercise means that the original input valuecontributes 20% to the output cell value, and theaveraged median value contributes 80%. Decreasingthe value of Parameter A will increase thedegree of noise removal, at the expense ofincreasing degradation of edges and linefeatures.

In this example, the 3 x 3 P-Median filter preservesedges and linear features (roads and canals) betterthan the Median or Olympic filters. Isolated noisecells are effectively eliminated, but a few of thecontinuous horizontal noise lines are still present,though less visible.

STEPSselect P-Median (PM)from the Type optionmenuselect Run from theFilter menu and directthe output raster to theFILTOUT Project File

Filter Parameter A for the P-Median filter assigns theweights used in averagingthe input value and the P-Median filter value to createthe final output cell value.

You can also set parametervalues by typing the desiredvalue into the text field to theright of the slider.

P-Median Filter (Noise Reduction)

Lower left portion of noisy input image. Image with 3 x 3 P-Median filter applied.

Linear features such as thiscanal still appear sharp inthe P-Median filtered image.

Page 14: E Filtering Images...Filtering Images page 3 In photography, filters of various types can be placed in front of the camera lens to alter and enhance the image that is recorded. Digital

Filtering Images

page 14

The Automatic Classification process (Raster /Interpret / Auto-Classify) performs a cell-by-cellclassification using a multiband set of input rasters.The resulting Class raster is usually quite “noisy,”in that there are many isolated class areas consistingof only one or two cells, and one-cell wide fringes ofa “mixture” class may separate larger homogeneousclass areas.

You can use the Modal Noise Reduction filter tosmooth and simplify a noisy class raster. The Modal

filter finds the modal (mostfrequent) value within thefilter window and writes it tothe output raster. Since noaveraging is performed, thisfilter is appropriate to usewith a categorical (class)

raster, in which the cell values serve only as labelsand have no numerical significance.

STEPSclick [Rasters...] andselect raster objectCLS_ISODATA from theCB_CLASS Project File inthe FILTER data collectionchoose Modal from theType option menu, andretain the 3 x 3 windowsizeselect Run from the Filtermenu and direct theoutput raster to theFILTOUT Project File

Modal Filtering of Classification Results

Consult the tutorial bookletentitled Image Classifica-tion for an introduction toAutomatic Classification.

Upper right corner of color-mapped classraster with 40 classes. There are manyisolated cells or small groups of cells whoseclass is different from that of their neighbors.

Class raster after smoothing with the 3x 3 Modal filter. Many isolated single-cell class areas have been removed,and areas of intermixed classes aregreatly simplified.

Page 15: E Filtering Images...Filtering Images page 3 In photography, filters of various types can be placed in front of the camera lens to alter and enhance the image that is recorded. Digital

Filtering Images

page 15

The filters in the Enhancement class are designed toimprove the appearance of images by sharpeningedges, corners, and line detail. Most of them alsosuppress noise so that only real image content isaccentuated. The Comparison and Selection (CS)filter is one of the simpler enhancement filters.

The CS filter ranks the values in the filter window innumerical order, and calculates the mean value.Parameter A identifies a pair of rank numbers(measured inward from the top and bottom of therank list) whose corresponding raster values providethe two possible filter output values. If the centercell value is less than the window mean, the loweroutput value is assigned, and if it is greater than themean, the higher output value is used. The CS filtersharpens blurred edges while smoothing non-edgeareas. The sharpening effect increases with lowervalues of Parameter A (which move the filter outputvalues farther from the mean). The default valuefor Parameter A is 2.

STEPSclick [Rasters...] andselect raster object RED

from the CB_TM321Project File in the FILTER

data collectionselect Enhancementfrom the Class optionmenuchoose Comparison andSelection (CS) from theType option menu, andretain the 3 x 3 windowsizeselect Run from the Filtermenu and direct theoutput raster to theFILTOUT Project File

CS Filter (Enhancement)

The degree of edge-enhancement by the CSfilter also increases as thesize of the filter windowincreases (for constantvalues of Parameter A).

Upper left portion of input image with blurredfield boundaries.

Same area with 3 x 3 CS filter applied(displayed with auto-linear contrast). Fieldboundaries and linear features are clearer.

Page 16: E Filtering Images...Filtering Images page 3 In photography, filters of various types can be placed in front of the camera lens to alter and enhance the image that is recorded. Digital

Filtering Images

page 16

STEPSchoose WMMR-MEDfrom the Type optionmenu, and retain the 3 x3 window sizeset the value ofParameter A to 0.30select Run from the Filtermenu and direct theoutput raster to theFILTOUT Project File

The WMMR-MED (weighted majority with mini-mum range-median) filter combines considerablesmoothing (noise suppression) with mild edge en-hancement. The filter finds the subset of cells in thefilter window in which the cell values are mostclosely spaced, and calculates a median value fromit (the WMMR-MED value). This procedure tendsto exclude noise values during the determination ofthe median. The output of the filter is a weightedaverage of the input raster value and the WMMR-

MED value. The weighting iscontrolled by Filter ParameterA, which varies from 0(WMMR-MED value only) to1.0 (input value only). De-creasing the value forParameter A increases the en-

hancement in the final image (both smoothing andedge enhancement).

WMMR-MED Filter (Enhancement)

Same area with 3 x 3 WMMR-MED filterapplied (displayed with auto-linear contrast).The image has been smoothed while edgesare preserved and enhanced.

Lower left portion of input image.

Page 17: E Filtering Images...Filtering Images page 3 In photography, filters of various types can be placed in front of the camera lens to alter and enhance the image that is recorded. Digital

Filtering Images

page 17

Our ability to see a boundary marked by a fixedbrightness difference varies with the backgroundbrightness: the brighter the background, the moredifficult it is to see the boundary. For this reason,edge details in bright areas require moreenhancement than those in dark areas of an image.The Volterra / Unsharp filter addresses this problemby providing edge enhancement that is proportionalto the local image brightness.

The initial output of the Volterra filter process isapproximately equivalent to the product of the localmean and a high-pass filter. This result is scaled andadded to the original input image value to producethe final output. The scaling is controlled by FilterParameter A, which varies from 0.001 to 0.1, with adefault value of 0.005. Increasing the value ofParameter A increases the amount of edgeenhancement.

STEPSchoose Volterra /Unsharp from the Typeoption menu, and retainthe 3 x 3 window sizeset the value ofParameter A to 0.002select Run from the Filtermenu and direct theoutput raster to theFILTOUT Project File

Setting the value for VolterraFilter Parameter A close tothe minimum will usuallyproduce a realistic imagewith noticeable sharpening,but values higher than 0.005generally produce very high-contrast images which over-emphasize edges.

Volterra / Unsharp Filter (Enhancement)

Same image area with 3 x 3 Volterra /Unsharp filter applied (displayed with auto-linear contrast), providing significantenhancement of edges and line features.

Upper left portion of input image.

Page 18: E Filtering Images...Filtering Images page 3 In photography, filters of various types can be placed in front of the camera lens to alter and enhance the image that is recorded. Digital

Filtering Images

page 18

Any of the filters available in the Spatial Filtersprocess can be applied to an RGB raster set bychoosing the RGB (Intensity) option and selectingrasters for the Red, Green, and Blue components.The filter process converts the RGB components tothe Hue, Intensity, and Saturation color model, inwhich the Intensity component represents the averagebrightness of the color image. The process appliesthe selected filter to the Intensity raster, then usesthe filtered Intensity raster in the reconversion toRGB color space. This procedure maintains the colorbalance of the original image.

STEPSturn on the RGB(Intensity) toggle button;this clears the inputraster listclick [Rasters...] andselect raster objects RED,GREEN, and BLUE from theCB_TM321 Project Filekeep the value ofParameter A set at 0.002select Run from the Filtermenu and direct theoutput rasters to theFILTOUT Project File

Filtering RGB Images

Same area with 3 x 3 Volterra filterapplied (displayed with auto-linearcontrast), showing enhanced detail.

Upper right portion of RGB input image.

Choose the RGB (Intensity) option.

Choose the SelectHIS Contrastoption on theParameters panelto apply astandard contrast-enhancementfunction to theRGB rasters during conversion toHIS (use None for this exercise).

Page 19: E Filtering Images...Filtering Images page 3 In photography, filters of various types can be placed in front of the camera lens to alter and enhance the image that is recorded. Digital

Filtering Images

page 19

The filters in the Texture class use the local statisticalvariations in brightness in an image to revealelements of its texture. Image texture includes thelocal spatial pattern, scale, and magnitude ofbrightness variations, including the “smoothness” or“roughness” of the image. The output images mightbe used as the basis for further image analysis, suchas image segmentation, or as additional rastercomponents in automatic image classification.

The Range filter produces an image of one of thesimplest elements of texure, the local range of values.The output of the filter is the range of values in thefilter window (difference between maximum andminimum values) multiplied by an adjustable gainfactor to provide suitable brightness and contrast.Filter Parameter A determines the gainfactor: it can vary from 0.01 to 9.99,and has a default setting of 1.00.

STEPSturn on the Grayscaletoggle buttonclick [Rasters...] andselect raster object TM3from the NOISYTM ProjectFile in the FILTER datacollectionchoose Texture from theClass option menuselect Range from theType option menu, andretain the 3 x 3 windowsizeset the value ofParameter A to 2.00select Run from theFilter menu and directthe output raster to theFILTOUT Project File

Range Filter (Texture)

Choose Exit from the Filter menu onthe Spatial Filtering window whenyou have completed this exercise.

Same image with 3 x 3 Range filter applied(displayed with auto-normalized contrastenhancement). Brightness represents localrange of raster values.

Input image TM3.

You can also apply these spatial filterson-the-fly to raster images you aredisplaying. Simply use the controls onthe Filter tabbed panel of the RasterLayer Controls window to set the filter.

Page 20: E Filtering Images...Filtering Images page 3 In photography, filters of various types can be placed in front of the camera lens to alter and enhance the image that is recorded. Digital

Filtering Images

page 20

The Locally Adaptive Contrast Enhancement(LACE) filter process provides a spatially-varyingcontrast enhancement for grayscale, color, ormultiband images. The LACE filter is particularlyappropriate for images with both large bright areasand large dark areas, where global contrastenhancements (such as linear or normalized) cannotbring out adequate detail in both bright and darkareas. The LACE filter adjusts brightness values ineach local area so that the local mean and standarddeviation closely match output values that you specifyon the Parameters panel. This procedure improveslocal contrast while reducing the overall contrastbetween bright and dark areas.

The LACE filter can produce an enhanced image withgood local contrast and image detail throughout, soyou can more easily make visual interpretations ofsurface features. Because the process producessignificant, locally-variable changes in raster values,

a LACE-enhanced image is not appropriate foruse with quantitative classification or rasteranalysis processes.

STEPSlaunch the LACE filterprocess (Image / Filter /Locally AdaptiveContrast...)select Local Adaptivefrom the Method optionmenupress the Rasters buttonand select raster objectKIL12A01 from the KIL_IMG

Project File in the HAWAII

data collectionon the Parameterstabbed panel, set theFilter Window Size to 21and the Weighting Factorto 0.800, and accept theother default settingspress the Run button anddirect the output raster tothe FILTOUT Project File

Grayscale LACE Filter

Air photo of Kilauea Caldera, Hawaii. Input image(top) shows little detail in brighter areas. LACE-enhanced image (bottom) has better local contrast.

Page 21: E Filtering Images...Filtering Images page 3 In photography, filters of various types can be placed in front of the camera lens to alter and enhance the image that is recorded. Digital

Filtering Images

page 21

STEPSchange the Desired Std.Dev. parameter value to80.000press the Run buttonand direct the outputraster to the FILTOUT

Project File

The Desired Mean and Desired Standard Deviation(Std. Dev.) parameters are target values that controlthe brightness and contrast of the output image. Thedefault value for the Desired Mean is the overall meanbrightness of the image, but you can change this valueto brighten or darken the image. The default valuefor Desired Std. Dev. generally produces adequatecontrast, but you can increase this value to increasethe overall image contrast.

The output raster of the LACE process is aweighted average of the LACEenhancement and the original image. Therelative weighting is controlled by theWeighting Factor parameter. When thisparameter is set to 0.8, for example, theLACE filter value will contribute 80% tothe value of each output cell and the originalinput value will contribute 20%. You canadjust this parameter to vary the amount ofenhancement applied to the original image.

The LACE filter process adjusts thebrightness of input cells by calculating a gaincoefficient for each cell based on the local standarddeviation. The Gain Limit parameter sets an upperlimit on the value of this coefficient and on the degreeof contrast enhancement that results in a given area.

Adjust LACE Filter Parameters

The Input Redistribution option menu on theAdvanced panel gives you several choicesfor redistributing the input raster valuesbefore applying the LACE filter. The defaultis None. The other choices duplicate theautomatic contrast enhancement optionsavailable in Spatial Data Display.

Kilauea airphoto with theLACE filter applied usinghigher Desired Std. Dev.value. Image has highercontrast than the outputimage on the previous page.

Page 22: E Filtering Images...Filtering Images page 3 In photography, filters of various types can be placed in front of the camera lens to alter and enhance the image that is recorded. Digital

Filtering Images

page 22

When you are working with an RGB raster set or acolor composite raster, the LACE filter process isdesigned to enhance local contrast while minimizingchanges in the color balance of the image. The localcontrast enhancement is applied to a computedintensity raster, in which each cell value is the averageof the red, green, and blue component values. Thecontrast-enhanced intensity raster is then used tocompute red, green, and blue components for theenhanced output image.

STEPSchoose RGB Bands fromthe Raster Type optionmenupress the Rasters buttonand select raster objectsRED, GREEN, and BLUE fromthe CB_TM321 Project Filein the FILTER datacollectionaccept the currentparameter settings asshown in the illustrationpress the Run button anddirect the output raster tothe FILTOUT Project File

LACE Filter with RGB Image

RGB image of Crow Butte Landsat ThematicBands 3-2-1. Each of these bands was modifiedfrom the basic data in the standard CB_TM ProjectFile by designing an exponential contrast table inthe Spatial Data Display process, then producinga new raster with the exponential contrast stretchapplied (using the Prepare / Raster / ApplyContrast process.)

Same image with the LACE filter applied.

Choose the typeof raster inputfrom the RasterType menu.

Page 23: E Filtering Images...Filtering Images page 3 In photography, filters of various types can be placed in front of the camera lens to alter and enhance the image that is recorded. Digital

Filtering Images

page 23

Other Spatial Filter Types

This booklet has introduced only a sampling of the filters available in TNTmips.Additional filters are available in each of the spatial filter classes described here.There are also two additional classes of spatial filters with more specialized filterfunctions for which no sample exercises are provided:

Edge Detection Filters Filters in the Edge Detection class are designed to detectand highlight boundaries between image areas that have distinctly differentbrightness. The output raster is a grayscale image of the edges, with the cellbrightness proportional to the difference in neighboring cell brightness in theoriginal image. The resulting image can be used as the basis for additional imageinterpretation and analysis, such as image segmentation.

Radar Filters Filters in the Radar class are designed to remove the speckle noisethat is characteristic of radar images.

Frequency Filtering

Frequency filtering offers an alternative approach to improving the appearance ofraster images. The frequency filtering process (Image / Filter / Frequency Filter)uses Fourier analysis to mathematically separate an image into its fundamentalspatial frequency components, each of which is modeled as a pure, cyclic sinefunction. Spatial frequencies are calculated in line and column directions, andtwo-dimensional plots of the resulting frequency information can be used toidentify particular frequencies for removal. Frequency filtering is most effectivefor removing regular, periodic image noise (striping) introduced by the imagingsystem.

References

The following references are good places to start if you want additional informationon image enhancement and filtering:

Drury, Stephen A. (2001), Image Interpretation in Geology (3rd ed.). Chapter 5,Digital Image Processing. New York: Routledge. pp. 133-138.

Jensen, John R. (1996). Introductory Digital Image Processing: a Remote SensingPerspective (2nd ed.). Chapter 7, Image Enhancement. Upper Saddle River,NJ: Prentice-Hall. pp. 153-172.

Lillesand, Thomas M. and Kiefer, Ralph W. (1994). Remote Sensing and ImageInterpretation (3rd ed.). Chapter 7, Digital Image Processing. New York:John Wiley and Sons. pp. 585-618.

What Next?

Page 24: E Filtering Images...Filtering Images page 3 In photography, filters of various types can be placed in front of the camera lens to alter and enhance the image that is recorded. Digital

Filtering Images

page 24

Advanced Software for Geospatial AnalysisFILTERING

MicroImages, Inc.

www.microimages.com

MicroImages, Inc. publishes a complete line of professional software for advanced geospatialdata visualization, analysis, and publishing. Contact us or visit our web site for detailed productinformation.

TNTmips Pro TNTmips Pro is a professional system for fully integrated GIS, imageanalysis, CAD, TIN, desktop cartography, and geospatial database management.

TNTmips Basic TNTmips Basic is a low-cost version of TNTmips for small projects.

TNTmips Free TNTmips Free is a free version of TNTmips for students and profession-als with small projects. You can download TNTmips Free from MicroImages’ web site.

TNTedit TNTedit provides interactive tools to create, georeference, and edit vector, image,CAD, TIN, and relational database project materials in a wide variety of formats.

TNTview TNTview has the same powerful display features as TNTmips and is perfect forthose who do not need the technical processing and preparation features of TNTmips.

TNTatlas TNTatlas lets you publish and distribute your spatial project materials on CD orDVD at low cost. TNTatlas CDs/DVDs can be used on any popular computing platform.

Indexclass raster, filtering....................................14comparison and selection (CS) filter.............15contrast enhancement...........................20-22edge-detection filters..................................23enhancement filters............................15-17filter kernel.............................................4,6,7filter polygon mode...................................10filter window............................................3,6frequency filtering.....................................23high-frequency component.....................3,5-7high pass filter.............................................7LACE filter...........................................20-22low-frequency component......................3,5-7low pass / average filter......................5,6,11,12

mask............................................................9median filter..........................................11,13modal filter...................................................14noise reduction filters.............................11-14olympic filter.........................................12,13p-median filter............................................13radar filters.................................................23range filter.................................................19test mode....................................................8texture filters...............................................19spatial convolution filtering......................3Volterra / unsharp filter..............................17weighting coefficients............................4WMMR-MED filter...............................16