Presentation is loading. Please wait.

Presentation is loading. Please wait.

Non-linear filtering Example: Median filter Replaces pixel value by median value over neighborhood Generates no new gray levels.

Similar presentations


Presentation on theme: "Non-linear filtering Example: Median filter Replaces pixel value by median value over neighborhood Generates no new gray levels."— Presentation transcript:

1 Non-linear filtering Example: Median filter Replaces pixel value by median value over neighborhood Generates no new gray levels

2 Median filters Advantage (?): the “odd-man-out” effect e.g. 1,1,1,7,1,1,1,1  ?,1,1,1.1,1,1,?

3 Median filters: example filter width = 5 Linear (averaging) Input Median

4 Median filters: example filter width = 5 Linear (averaging) Input Median Discards spike Preserves jump exactly at correct location

5 Median filters: example filter width = 5 Linear (averaging) Input Median Smooths spike Blurs jump

6 Median filter 3 x 3 median filter Sharpens edges Destroys edge cusps and protrusions  Original Keeps edges sharp Odd Man Out  can destroy details 

7 Median filter vs Gaussian Gaussian Eye has more detail. Blurrier edges 3 x 3 median filter

8 Median filter: summary Purpose –Smooth image without blurring boundaries InputMedian Filter

9 Median filter: summary Purpose –Smooth image without blurring boundaries Problem –Loses small details InputMedian Filter

10 Another approach: bilateral filter InputGaussian Smoothed

11 Another approach: bilateral filter InputGaussian Smoothed [ OK to average these brightness values

12 Another approach: bilateral filter InputGaussian Smoothed [ Don’t average these (brightness too different, probably from different objects)

13 Another approach: bilateral filter InputGaussian Smoothed Bilateral smoothing: basic idea –Ordinary smoothing… –But only sum over pixels with similar brightness

14 Another approach: bilateral filter InputGaussian Smoothed Bilateral smoothing: basic idea –Ordinary smoothing… –But only sum over pixels with similar brightness Sum over all 3 pixels

15 Another approach: bilateral filter InputGaussian Smoothed Bilateral smoothing: basic idea –Ordinary smoothing… –But only sum over pixels with similar brightness Sum over all 3 pixels

16 Another approach: bilateral filter InputGaussian Smoothed Bilateral smoothing: basic idea –Ordinary smoothing… –But only sum over pixels with similar brightness Sum over all 3 pixels (similar brightness)

17 Another approach: bilateral filter InputGaussian Smoothed Bilateral smoothing: basic idea –Ordinary smoothing… –But only sum over pixels with similar brightness Don’t sum over 3 rd pixel (too dark)

18 Another approach: bilateral filter InputGaussian Smoothed Bilateral smoothing: basic idea –Ordinary smoothing… –But only sum over pixels with similar brightness Don’t sum over 3 rd pixel (too bright)

19 Another approach: bilateral filter InputGaussian Smoothed Bilateral smoothing: basic idea –Ordinary smoothing… –But only sum over pixels with similar brightness Sum over all 3 pixels (similar brightness))

20 Another approach: bilateral filter InputBilateral Smoothing Bilateral smoothing: basic idea –Ordinary smoothing… –But only sum over pixels with similar brightness

21 Another approach: bilateral filter InputBilateral Smoothing Bilateral smoothing: basic idea –Ordinary smoothing… –But only sum over pixels with similar brightness Smoothed

22 Another approach: bilateral filter InputBilateral Smoothing Bilateral smoothing: basic idea –Ordinary smoothing… –But only sum over pixels with similar brightness Not smoothed

23 Another approach: bilateral filter InputBilateral Smoothing Bilateral smoothing: implementation –Ordinary smoothing… –But only sum over pixels with similar brightness –Pixels with similar brightness weighted more

24 Bilateral filter Weight pixel contributions by nearness in distance and nearness in intensity –Old: Gaussian smoothing

25 Bilateral filter Weight pixel contributions by nearness in distance and nearness in intensity –Old: Gaussian smoothing

26 Bilateral filter Weight pixel contributions by nearness in distance and nearness in intensity –Old: Gaussian smoothing Normalization (so weights sum to 1)

27 Bilateral filter Weight pixel contributions by nearness in distance and nearness in intensity –Old: Gaussian smoothing –New: bilateral smoothing

28 Bilateral filter Weight pixel contributions by nearness in distance and nearness in intensity –Old: Gaussian smoothing –New: bilateral smoothing Suppresses contribution from pixels with different brightness

29 Bilateral filter

30 Pattern detection with filters Biggest response to brightness patterns resembling them! Example: 1D correlation with mask

31 Pattern detection with filters Biggest response to brightness patterns resembling them! Example: 1D correlation with mask Compute at position 3

32 Pattern detection with filters Biggest response to brightness patterns resembling them! Example: 1D correlation with mask Compute at position 3 Image (1D) mask weights …

33 Pattern detection with filters Biggest response to brightness patterns resembling them! Example: 1D correlation with mask Compute at position 3 Image (1D) mask weights …

34 Pattern detection with filters Biggest response to brightness patterns resembling them! Example: 1D correlation with mask Compute at position 3 Image (1D) mask weights Vector i Vector w …

35 Pattern detection with filters Biggest response to brightness patterns resembling them! Example: 1D correlation with mask Compute at position 3 Image (1D) mask weights Vector i Vector w dot product …

36 Pattern detection with filters Gaussian filter –Detects blobs “Derivative” filter e.g., [-1/2 0 1/2] –Detects brightness jumps eye detector?

37 Pattern detection with filters Summary: detect pattern (object) by correlating with similar mask Problems when lighting changes –Overall brightness can change between images –Contrast may change –Or both…

38 To improve detection: Compensate for changes in brightness and contrast Want to detect pattern Old – Correlate image with – Pattern “detected” wherever is large

39 To improve detection: Compensate for changes in brightness and contrast Want to detect pattern Old – Correlate image with – Pattern “detected” wherever is large New: at each pixel (i,j) –Subtract average brightness (to eliminate problems from additive shifts) Do weighted sum

40 To improve detection: Compensate for changes in brightness and contrast New: at each pixel (i,j) –Subtract average brightness Do weighted sum –Normalize (avoids problems from contrast changes)

41 Normalized Correlation Important: for each (x,y) (i.e., each pixel in result ) you must compute the average for window centered over (x,y)

42 Normalized Correlation MATLAB demo (eye detection)

43 Detection with Normalized Correlation Problem Result of normalized correlation Suppose you want 3 best candidates for an eye…

44 Detection with Normalized Correlation Problem Result of normalized correlation Suppose you want 3 best candidates for an eye… The three highest NC values are all here (at best eye position plus 2 nearby pixels)

45 Detection with Normalized Correlation Solution Result of normalized correlation Only consider pixels with higher NC value than at all other “nearby” pixels

46 Detection with Normalized Correlation Solution Result of normalized correlation Only consider pixels with higher NC value than at all other “nearby” pixels ( Non maximum suppression) (Non Ma

47 Detection with Normalized Correlation Solution Result of normalized correlation Result of NC and NonMax Suppression


Download ppt "Non-linear filtering Example: Median filter Replaces pixel value by median value over neighborhood Generates no new gray levels."

Similar presentations


Ads by Google