Lakshmi Narayanan
Lakshmi Narayanan

Reputation: 5342

Top hat filter kernel

Can you please tell me how does the kernel of a 2D top hat filter looks like? I created the following kernel,

     0     0     0    -1     0     0     0
     0    -1    -1    -1    -1    -1     0
     0    -1    -1     1    -1    -1     0
    -1    -1     1     1     1    -1    -1
     0    -1    -1     1    -1    -1     0
     0    -1    -1    -1    -1    -1     0
     0     0     0    -1     0     0     0

does this qualify as a top hat filter kernel? If I convolute an image with this matrix, is it equivalent to have done a top hat filtering operation? Am sorry if the question is rudimentary, but your help is much appreciated.

Upvotes: 0

Views: 2045

Answers (1)

Paul R
Paul R

Reputation: 212979

Top hat is a very loose term which can mean different things in different contexts.

For spatial domain filtering a top hat filter generally has coefficients of 1 in the central area and 0 beyond this. However it is not a particularly useful filter as its frequency response is a sinc function.

More commonly "top hat" refers to a morphological operation in image processing used to extract small elements and details. This is quite different from the top hat spatial filter described above.

Upvotes: 1

Related Questions