40 lines
801 B
Python
40 lines
801 B
Python
#!/usr/bin/python
|
|
# -*- coding: utf-8 -*-
|
|
# \file dfc_base.py
|
|
# \brief TODO
|
|
# \author Florent Guiotte <florent.guiotte@gmail.com>
|
|
# \version 0.1
|
|
# \date 27 août 2018
|
|
#
|
|
# TODO details
|
|
|
|
import numpy as np
|
|
import ld2dap
|
|
|
|
def run(rasters, treshold=1e4):
|
|
"""DFC base, aka no local description before learning.
|
|
|
|
Simply stack layers as description vectors.
|
|
|
|
"""
|
|
# Parse parameters type
|
|
treshold = float(treshold)
|
|
|
|
# Pipelines
|
|
loader = ld2dap.LoadTIFF(rasters)
|
|
dfc_filter = ld2dap.Treshold(treshold)
|
|
normalize = ld2dap.Normalize(dtype=np.uint8)
|
|
raw_out = ld2dap.RawOutput()
|
|
|
|
raw_out.input = normalize
|
|
normalize.input = dfc_filter
|
|
dfc_filter.input = loader
|
|
|
|
# Compute vectors
|
|
raw_out.run()
|
|
|
|
return raw_out.data
|
|
|
|
def version():
|
|
return 'v0.0'
|