Frozen Flame
Frozen Flame

Reputation: 3245

Modes of scipy.ndimage.filters.convolve not understood

Function scipy.ndimage.filters.convolve accept a mode parameter for different border-handling schemes:

mode : {'reflect','constant','nearest','mirror', 'wrap'}

I know about the imfilter function in Matlab, and assume the follow mapping on the keywords used to describe border-handling schemes:

imfilter      convolve

(scalar)      'constant'
'symmetric'   'mirror'
'replicate'   'nearest'
'circular'    'reflect'   ---- Am I right?

Questions:

  1. Did I get all these correct?
  2. What does mode 'wrap' do?

Upvotes: 3

Views: 3460

Answers (1)

Matteo Italia
Matteo Italia

Reputation: 126787

The equivalence table is almost correct; the only mistake is "circular", which should be mapped to "wrap"

imfilter      convolve

(scalar)      'constant'
'symmetric'   'mirror'
n.a.          'reflect'
'replicate'   'nearest'
'circular'    'wrap'

As stated in the table, the "reflect" convolve mode has no matlab equivalent; the most similar is 'symmetric' (they only differ for the fact that the border element is replicated in 'reflect', but not in 'mirror').

References:

Upvotes: 2

Related Questions