コード例 #1
0
def HHIPreFilter(config={}):
    """HHI pre-interlace filter.

    A widely used prefilter to prevent line twitter when converting
    sequential images to interlace.

    Coefficients taken from: 'Specification of a Generic Format
    Converter', S. Pigeon, L. Vandendorpe, L. Cuvelier and B. Maison,
    CEC RACE/HAMLET Deliverable no R2110/WP2/DS/S/006/b1, September
    1995. http://www.stephanepigeon.com/Docs/deliv2.pdf

    """

    fil = numpy.array(
        [-4, 8, 25, -123, 230, 728, 230, -123, 25, 8, -4],
        dtype=numpy.float32).reshape((-1, 1, 1)) / numpy.float32(1000)
    resize = Resize(config=config)
    out_frame = Frame()
    out_frame.data = fil
    out_frame.type = 'fil'
    audit = out_frame.metadata.get('audit')
    audit += 'data = HHI pre-interlace filter\n'
    out_frame.metadata.set('audit', audit)
    resize.filter(out_frame)
    return resize
コード例 #2
0
 def __init__(self, config={}, **kwds):
     super(PostFilterUV,
           self).__init__(resize=Resize(),
                          filgen=FilterGenerator(xaperture=12, xcut=22),
                          linkages={
                              ('self', 'input'): [('resize', 'input')],
                              ('filgen', 'output'): [('resize', 'filter')],
                              ('resize', 'output'): [('self', 'output')],
                          },
                          config=config,
                          **kwds)
コード例 #3
0
ファイル: common.py プロジェクト: simoninns/pyctools-pal
 def __init__(self, config={}, **kwds):
     # 4fsc = 922 active samples/line, Rec 601 = 702 active samples/line
     xup, xdown = 351, 461
     super(From4Fsc, self).__init__(
         resize = Resize(xup=xup, xdown=xdown),
         filgen = FilterGenerator(xup=xup, xdown=xdown, xaperture=12),
         linkages = {
             ('self',   'input')  : [('resize', 'input')],
             ('filgen', 'output') : [('resize', 'filter')],
             ('resize', 'output') : [('self',   'output')],
             },
         config=config, **kwds)
コード例 #4
0
ファイル: coder.py プロジェクト: rga24/pyctools-pal
 def __init__(self, config={}, **kwds):
     super(PostFilterPAL, self).__init__(
         resize = Resize(),
         fildes = FilterDesign(
             frequency='0.0, 0.307, 0.317, 0.346, 0.356, 0.5',
             gain='     1.0, 1.0,   1.0,   0.0,   0.0,   0.0',
             weight='   1.0, 1.0,   0.0,   0.0,   1.0,   1.0',
             aperture=17,
             ),
         linkages = {
             ('self',   'input')    : [('resize', 'input')],
             ('fildes', 'filter')   : [('resize', 'filter')],
             ('resize', 'output')   : [('self',   'output')],
             },
         config=config, **kwds)
コード例 #5
0
 def __init__(self, config={}, **kwds):
     super(PostFilterY, self).__init__(
         resize=Resize(),
         fildes=FilterDesign(
             frequency=
             '0.0, 0.215, 0.22, 0.23, 0.25, 0.27, 0.28, 0.285, 0.5',
             gain=
             '     1.0, 1.0,   0.8,  0.0,  0.0,  0.0,  0.8,  1.0,   1.0',
             weight=
             '   0.6, 0.6,   0.6,  1.0,  1.0,  1.0,  0.3,  0.3,   0.3',
             aperture=11,
         ),
         linkages={
             ('self', 'input'): [('resize', 'input')],
             ('fildes', 'filter'): [('resize', 'filter')],
             ('fildes', 'response'): [('self', 'response')],
             ('resize', 'output'): [('self', 'output')],
         },
         config=config,
         **kwds)