How exactly does the “reflect” mode for scipys ndimage filters work?

前端 未结 1 1449
深忆病人
深忆病人 2020-12-05 19:20

I\'m failing to understand exactly how the reflect mode handles my arrays. I have this very simple array:

import numpy as np
from scipy.ndimage.filters impor         


        
相关标签:
1条回答
  • 2020-12-05 20:06

    Suppose the data in one axis is 1 2 3 4 5 6 7 8. The following table shows how the data is extended for each mode (assuming cval=0):

        mode       |   Ext   |         Input          |   Ext
        -----------+---------+------------------------+---------
        'mirror'   | 4  3  2 | 1  2  3  4  5  6  7  8 | 7  6  5
        'reflect'  | 3  2  1 | 1  2  3  4  5  6  7  8 | 8  7  6
        'nearest'  | 1  1  1 | 1  2  3  4  5  6  7  8 | 8  8  8
        'constant' | 0  0  0 | 1  2  3  4  5  6  7  8 | 0  0  0
        'wrap'     | 6  7  8 | 1  2  3  4  5  6  7  8 | 1  2  3
    

    For an even window size n, consider the window of size n+1, and then don't include the lower and right edges. (The position of the window can be changed by using the origin argument.)

    0 讨论(0)
提交回复
热议问题