This standalone OTB module is a wrapper of the Sirius library. It provides an image to image filter which resamples an image in the frequency domain. This filter is packaged in the application FrequencyResample.
This module is using CMake to build its libraries and executables.
- C++14 compiler (GCC >5)
- CMake >=3.2
- GDAL development kit, >=2
- FFTW development kit, >=3
- Sirius library
OTB Frequency Resample Module depends on the Sirius library.
In order to find the library using CMake find_package
helper, SIRIUS_ROOT
must be set to a Sirius install directory.
This OTB module can be built outside the OTB project as a standalone module. It only requires an OTB build tree (e.g. SuperBuild generation).
CMAKE_BUILD_TYPE
: Debug, Release, RelWithDebInfo and MinSizeRelSIRIUS_ROOT
: path to Sirius install directoryOTB_BUILD_MODULE_AS_STANDALONE
: set toON
to buildFrequencyResample
as a standalone moduleOTB_DIR
: path to the OTB build tree CMake directoryBUILD_TESTING
: set toON
to enable tests
git clone https://github.com/CS-SI/OTB-SIRIUS.git
mkdir .build
cd .build
cmake .. -DCMAKE_BUILD_TYPE=Release \
-DSIRIUS_ROOT=/path/to/Sirius/install/directory \
-DOTB_BUILD_MODULE_AS_STANDALONE=ON \
-DOTB_DIR=/path/to/OTB/SDK/lib/cmake/OTB-x.y \
-DBUILD_TESTING=ON
cmake --build . --target FrequencyResample-all
This module can also be built inside the OTB project (cf. OTB documentation).
Module_FrequencyResample
: set toON
to activate FrequencyResample remote moduleSIRIUS_ROOT
: path to Sirius install directory
git clone https://github.com/CS-SI/OTB-SIRIUS.git FrequencyResample
cp -r FrequencyResample /path/to/OTB/Modules/Remote
cd /path/to/OTB/build/directory
cmake /path/to/OTB -DModule_FrequencyResample=ON -DSIRIUS_ROOT=/path/to/Sirius/install/directory
cmake --build . --target FrequencyResample-all
The following example will zoom in /path/to/input/image.tif
by 2, apply the filter /path/to/filter/image.tif
to the resampled image and write the output into /path/to/output/image.tif
.
# CWD is the OTB build directory
./bin/otbcli_FrequencyResample \
-in /path/to/input/image.tif \
-out /path/to/output/image.tif \
-resampling.ratio 2:1 \
-filter.path /path/to/filter/image.tif
The following code is a boilerplate to create and initialize the FrequencyResampleFilter
component.
#include "otbFrequencyResampleFilter.h"
using FilterType = otb::FrequencyResampleFilter<DoubleImageType>;
// initialization parameters
sirius::ZoomRatio zoom_ratio(2, 1);
sirius::Image filter_image = {...};
sirius::Filter freq_filter = sirius::Filter::Create(filter_image, zoom_ratio);
sirius::ImageDecompositionPolicies image_decomposition =
sirius::ImageDecompositionPolicies::kRegular;
sirius::FrequencyZoomStrategies zoom_strategy =
sirius::FrequencyZoomStrategies::kPeriodization;
FilterType::Pointer i2i_filter = FilterType::New();
// init filter
i2i_filter->Init(zoom_ratio, std::move(freq_filter),
image_decomposition, zoom_strategy);
i2i_filter->SetInput(...);