Sei sulla pagina 1di 27

CS 467DigitalImageProcessing CS467 Digital Image Processing

LOCALNEIGHBORHOODPROCESSING. CONCEPTOFSPATIALDOMAIN CONCEPT OF SPATIAL DOMAIN FILTERING


1

SpatialDomain Spatial Domain


TheSpatialDomainisadomain(theplane) g g y p whereadigitalimageisdefinedbyspatial coordinatesofitspixels (Another domain considered in image (Anotherdomainconsideredinimage processingisthefrequencydomainwherea digitalimageisdefinedbybrakingdowninto l f b b k thespatialfrequenciesparticipatinginits formation wewillconsideritlater)
2

LocalNeighborhoodin ImageProcessing
Manyimageprocessingoperations (p (particularly,spatialdomainfiltering)are y p g) reducedtolocalneighborhoodprocessing

LocalNeighborhoodin ImageProcessing
S xy Letbethesetofcoordinatesofa g yp neighborhoodcenteredonanarbitrarypixel (x,y)inanimagef. Neighborhood processing generates a Neighborhoodprocessinggeneratesa correspondingpixelatthesamecoordinates inanoutputimageg,suchthatthevalueof thatthevalueofthatpixelisdeterminedbya specifiedoperationinvolvingthepixelsinthe inputimagewithcoordinatesin input image with coordinates in S xy
4

LocalNeighborhoodin ImageProcessing

LocalNeighborhoodin SpatialDomainImageProcessing
Thespatialdomainprocessescanbe p y g p representedbythefollowingexpression

g ( x, y ) = T ( f ( x, y ) )
wheref(x,y)istheinputimage,g(x,y)isthe f( ,y) p g , ( ,y) outputimageandT isanoperatordefined overalocalneighborhoodofpixelwiththe over a local neighborhood of pixel with the coordinates(x,y)
6

LocalContrastEnhancement Local Contrast Enhancement


Localcontrastenhancementisutilized g g p g throughlocalhistogramprocessing S xy Thelocalhistogram inannxm windowof adigitalimagewithintensitylevels{0,1,,L1} a digital image with intensity levels {0 1 L 1} isadiscretefunction

hS xy rk = nk ; k = 0,1,..., L 1 S xy
7

LocalContrastEnhancement Local Contrast Enhancement


Localcontrastenhancementleadstobetter y visibilityoflocaldetailsand,asaresult,tothe extractionofthosedetails(notnecessarily smalldetails)thatarehiddenintheareaswith small details) that are hidden in the areas with apoorlocalcontrast Localcontrastenhancementcanbeutilized, l h b l forexample,throughthesamemethodsthat areusedfortheglobalcontrastenhancement
8

LocalContrastEnhancement Local Contrast Enhancement

1992-2008 R.C. Gonzalez & R.E. Woods

Filtering
Filtering insignalprocessingistheprocessof p g (p g) j g accepting(passing)orrejectingcertain frequencycomponents Lowpass filters preserve low frequencies filterspreservelowfrequencies rejectingthehighones Highpass filterspreservehighfrequencies rejectingthelowones rejecting the low ones

10

Filtering
Lowpass filtersareusedforremovalor reductionofnoise Highpass filtersareused,forexample,for edgedetection edge detection

11

ModelsofNoise Models of Noise


Modelsofnoise Additivenoise g ( x, y ) = f ( x, y ) + ( x, y ) Multiplicative(speckle)noise g ( x , y ) = f ( x , y ) ( x, y ) pn , ( x, y ) Impulsenoise
g ( x, y ) = 1 pn , f ( x, y )

whereistheprobabilityofdistortion(in where pn is the probability of distortion ( pn in percentsiscalledthecorruptionrate) pn 100%


12

TheGoalofNoiseFiltering The Goal of Noise Filtering


Thegoalofnoisefilteringistoobtainthebest g f ( x, y ) estimateoftheidealimage f ( x, y ) intermsofthemeansquareerror(rootmean squareerror)or,whichisthesame,interms square error) or which is the same in terms ofPSNR Filteringisutilizedthroughanoperator l l h h appliedtoanoisyimage: f ( x, y ) = F ( g ( x, y ) )
13

IdealFiltering Ideal Filtering


Iftherearek realizationsofthesameimage p y scenecorruptedbythesamekindofadditive k noise,and,thentheoriginalimage canberestoredbytakingcomponent wise can be restored by taking componentwise meanofitsrealizations:
gi ( x, y ) = f ( x, y ) + i ( x, y ); i = 1, 2,..., k ,... 1 k f ( x, y ) = g i ( x, y ) k i =1

f ( x, y ) f Thelargerisk,thecloseristo ( x, y )
14

LinearFilters Linear Filters


Linearfilteringisutilizedthroughalinear p operator TheoperatorF iscalledlinear,ifforarbitrary constantsa andb thefollowingproperty constants a and b the following property holds:
F ( af ( x, y ) + b ( x, y ) ) = F ( af ( x, y ) ) + F ( b ( x, y ) ) =
= aF ( f ( x, y ) ) + bF ( ( x, y ) ) b

15

LinearFilters Linear Filters


Afilter,whichisrepresentedbyalinear p operatoriscalledthelinearfilter Ideally,thelinearfiltermayseparateanimage fromadditivenoise.IfF isalinearfilter,then from additive noise If F is a linear filter then F ( g ( x, y ) ) = F ( f ( x, y ) + ( x, y ) ) = F ( f ( x, y ) ) + F ( ( x, y ) ) andtheimagecanberestoredasfollows
f ( x, y ) = F 1 F ( f ( x, y ) ) = F 1 F ( g ( x, y ) ) F ( ( x, y ) )

)
16

LinearandNonlinearFilters Linear and Nonlinear Filters


Sincecanbeestimatedonlyinthe F ( ( x, y ) ) q y frequencydomainandthisestimationis possibleonlyforsomeparticularkindsof noise,the ideal method has a limited noise the idealmethodhasalimited applicability Speckleandimpulsenoisecannotbe kl l b separatedfromanimageusingalinearfilter. Thus,fortheirfilteringnonlinearfiltersshould beused be used
17

LinearandNonlinearFilters Linear and Nonlinear Filters


Afilter,whichisrepresentedbyanoperator, fil hi h i db whichisnotlinear,iscalledthenonlinearfilter Linearfilterscanbeimplementedinthe frequencydomain(wheretheyoriginallywere h appliedbyNorbertWienerin1940th )andinthe spatialdomain Mostofnonlinearfilterscanbeimplemented onlyinthespatialdomain(exceptsomespecific nonlineartransformationsofspectrathatare applicableonlyinthefrequencydomain)
18

SpatialDomainFiltering Spatial Domain Filtering


Aspatialfilterisreducedtoprocessingofa g localneighborhood Filteringcreatesanewpixelwithcoordinates equaltothecoordinatesofthecenterofthe equal to the coordinates of the center of the neighborhoodandwhosevalueistheresultof thefilteringoperatorappliedtothe h fl l h neighborhoodoftheprocessedpixel

19

SpatialDomainFiltering Spatial Domain Filtering


Alowpass spatialdomainfiltersmoothan g g imageinan xm localneighborhoodofeach pixel.Thismeansthatimagedetailsofthesize about0.5n x0.5m becomesmoothedandcan about 0 5n x 0 5m become smoothed and can becomeundistinguishable. Lowpass spatialdomainfiltersareusedfor l fl f noisereduction.Smoothingeachn xm local neighborhood,theydissolveanoiseinan image
20

SpatialDomainFiltering Spatial Domain Filtering

21

LinearSpatialDomainFiltering Linear Spatial Domain Filtering


Linearspatialfilteringofanimageofsize y M xN withafilterofsizemxnisdefinedby theexpression
f ( x, y ) =
s = a t = b

w ( s, t ) g ( x + s, y + t )

whereg(x,y)istheimagetobeprocessed, a=(m1)/2,b=(n1)/2,andw(s,t)formthefilter a=(m1)/2 b=(n1)/2 and w(s t) form the filter kernel
22

LinearSpatialDomainFiltering Linear Spatial Domain Filtering

1992-2008 R.C. Gonzalez & R.E. Woods

23

BorderEffectsin SpatialDomainFiltering
Toprocessimageborders,itisnecessaryto g extendanimageinalldirections,otherwiseit willnotbepossibletobuildlocal neighborhoodsfortheborderpixels neighborhoods for the border pixels Thesimplestwayofsuchanextensioniszero padding.However,thismethodalways h h l createsablackframealongtheimage borders.
24

BorderEffectsin SpatialDomainFiltering
Totakecareofbordereffects,mirroring g shouldbeused.AnN xM image,beforeitis processedbyaspatialdomainfilterwithan n m N + M + n x m kernel should be extended to 2 xm kernel,shouldbeextendedto 2 imageasfollows
f f ( x, y ) = f f f

( ( N 1) ( x N + 1), y ) ; x = N ,..., N + n / 2 1, y = 0,1,..., M 1 f ( x, y ) ; x = 0 1 N 1 y = 1,..., m / 2 0,1,..., 1, 1 ( x, ( N 1) ( y N + 1) ) ; x = 0,1,..., N 1, y = N ,..., N + m / 2 1 1 2 ( x, y ) ; x, y = 1, 2,... ( ( N 1) ( x N + 1), ( N 1) ( y N + 1) ) ; x, y = N , N + 1,... 25

f ( x, y ) ; x = 0,1,..., N 1, y = 0,1,..., M 1 , , , , , , , f ( x, y ) ; x = 1,..., n / 2 , y = 0,1,..., M 1

-1st col.

BorderEffectsin SpatialDomainFiltering
0th col. 1st col. -1th row 0th row

M-1 M 1th row Mth row Mirroring for 3x3 local neighborhood window

26

ArithmeticMeanFilter theSimplest SpatialDomainLinearFilter


Arithmeticmeanfilterreplacestheintensity p y valueineachpixelbythelocalarithmetic meantakenoveralocaln xm processing window: 1 a b
f ( x, y ) =
1 nm 1 nm ... 1 nm

g ( x + s, y + t ) nm
s = a t = b
1 nm 1 nm ... 1 nm ... ... ... ... 1 nm 1 nm ... 1 nm

Thiscorrespondstothefilterkernel(mask)

27

Potrebbero piacerti anche