|
| 1 | +# Trigonometric Polynomial Interpolation of Images # |
| 2 | + |
| 3 | +## Summary ## |
| 4 | +This repository contains implementations of the following operations using trigonometric polynomial interpolation: |
| 5 | +DFT translation, homographic transformation, up-sampling and down-sampling |
| 6 | +It is part of an [IPOL publication](https://doi.org/10.5201/ipol.2019.273) |
| 7 | + |
| 8 | +## Authors ## |
| 9 | + |
| 10 | +* Thibaud Briand <briand.thibaud@gmail.com> |
| 11 | + |
| 12 | +Laboratoire d'Informatique Gaspard Monge (LIGM)/ Ecole des Ponts ParisTech |
| 13 | +Centre de mathématiques et de leurs applications (CMLA)/ ENS Paris-Saclay |
| 14 | + |
| 15 | +## Version ## |
| 16 | + |
| 17 | +Version 1.0, released on 09/09/2019 |
| 18 | + |
| 19 | +## License ## |
| 20 | + |
| 21 | +This program is free software: you can redistribute it and/or modify it |
| 22 | +under the terms of the GNU General Public License as published by |
| 23 | +the Free Software Foundation, either version 2 of the License, or |
| 24 | +(at your option) any later version. |
| 25 | + |
| 26 | +You should have received a copy of the GNU General Public License |
| 27 | +along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 28 | + |
| 29 | +Copyright (C) 2018-2019, Thibaud Briand <briand.thibaud@gmail.com> |
| 30 | + |
| 31 | +All rights reserved. |
| 32 | + |
| 33 | +## Build ## |
| 34 | + |
| 35 | +Required environment: Any unix-like system with a standard compilation |
| 36 | +environment (make and C compiler) and [Cmake](https://cmake.org/). |
| 37 | + |
| 38 | +Required libraries: |
| 39 | +[libpng](http://libpng.org/pub/png/libpng.html), |
| 40 | +[lipjpeg](http://ijg.org/), |
| 41 | +[libtiff](http://simplesystems.org/libtiff/) |
| 42 | +[libfftw3](http://www.fftw.org/) |
| 43 | + |
| 44 | +Optional libraries: |
| 45 | +[libopenmp](https://www.openmp.org/) |
| 46 | + |
| 47 | +Build instructions: |
| 48 | + |
| 49 | + mkdir build |
| 50 | + cd build |
| 51 | + cmake -DCMAKE_BUILD_TYPE=Release .. |
| 52 | + make |
| 53 | + |
| 54 | +It produces programs "homographic_transform", "shift_transform", "upsampling" and "downsampling". |
| 55 | + |
| 56 | +## Usage of shift_transform ## |
| 57 | + |
| 58 | +The program reads an input image, the shift parameters, optionnally takes the type of interpolator and |
| 59 | +produces a shifted version of the image using trigonometric polynomial interpolation. |
| 60 | +This corresponds to Algorithm 1. |
| 61 | + |
| 62 | + <Usage>: ./shift_transform input output dx dy [interp] |
| 63 | + |
| 64 | +The parameter "interp" controls the trigonometric polynomial interpolator type (by default 1) |
| 65 | + 0 --> Real part of complex convention |
| 66 | + 1 --> Real convention |
| 67 | + |
| 68 | +Execution examples: |
| 69 | + |
| 70 | + 1. Horizontal shift of 0.5 pixel with real convention: |
| 71 | + |
| 72 | + ./shift_transform input.png output.tiff 0.5 0 |
| 73 | + |
| 74 | + 2. Vertical shift of -0.5 pixel with real part of complex convention: |
| 75 | + |
| 76 | + ./shift_transform input.png output.tiff 0 -0.5 0 |
| 77 | + |
| 78 | +## Usage of homographic_transform ## |
| 79 | + |
| 80 | +The program reads an input image, an homography, optionnally takes the type of interpolator and |
| 81 | +produces an homographic transformation of the image using trigonometric polynomial interpolation. |
| 82 | +This corresponds to Algorithm 2. |
| 83 | + |
| 84 | + <Usage>: ./homographic_transform input output "h11 h12 h13 h21 h22 h23 h31 h32 h33" [interp] |
| 85 | + |
| 86 | +The parameter "interp" controls the trigonometric polynomial interpolator type (by default 1) |
| 87 | + 0 --> Real part of complex convention |
| 88 | + 1 --> Real convention |
| 89 | + |
| 90 | +Execution examples: |
| 91 | + |
| 92 | + 1. Horizontal shift of 0.5 pixel with real convention: |
| 93 | + |
| 94 | + ./homographic_transform input.png output.tiff "1 0 0.5 0 1 0 0 0 1" |
| 95 | + |
| 96 | + 2. Vertical shift of -0.5 pixel with real part of complex convention: |
| 97 | + |
| 98 | + ./homographic_transform input.png output.tiff "1 0 0 0 1 -0.5 0 0 1" |
| 99 | + |
| 100 | +## Usage of upsampling ## |
| 101 | + |
| 102 | +The program reads an input image, the up-sampling factors (or the output sizes), optionnally takes the type of interpolator and produces an up-sampled version of the image using trigonometric polynomial interpolation. |
| 103 | +This corresponds to Algorithm 3. |
| 104 | + |
| 105 | + <Usage>: ./upsampling input output valuex valuey [OPTIONS] |
| 106 | + |
| 107 | +The optional parameters are: |
| 108 | +-i, Specify the trigonometric polynomial interpolator type (by default 1) |
| 109 | + 0 --> Real part of complex convention |
| 110 | + 1 --> Real convention |
| 111 | +-t, Specify the input type of valuex and valuey (by default 1) |
| 112 | + 0 --> Output image sizes |
| 113 | + 1 --> Up-sampling factors (>=1) |
| 114 | + |
| 115 | +Execution examples: |
| 116 | + |
| 117 | + 1. Up-sampling of factor (2.5,3) with real convention: |
| 118 | + |
| 119 | + ./upsampling input.png output.tiff 2.5 3 |
| 120 | + |
| 121 | + 2. Up-sampling to have an image of size 1000x2000 with real part of complex convention: |
| 122 | + |
| 123 | + ./upsampling input.png output.tiff 1000 2000 -i 0 -t 0 |
| 124 | + |
| 125 | +## Usage of downsampling ## |
| 126 | + |
| 127 | +The program reads an input image, the down-sampling factors (or the output sizes) and produces a down-sampled version of the image using trigonometric polynomial interpolation. |
| 128 | +This corresponds to Algorithm 4. |
| 129 | + |
| 130 | + <Usage>: ./downsampling input output valuex valuey [OPTIONS] |
| 131 | + |
| 132 | +The optional parameters are: |
| 133 | +-t, Specify the input type of valuex and valuey (by default 1) |
| 134 | + 0 --> Output image sizes |
| 135 | + 1 --> Down-sampling factors (>=1) |
| 136 | + |
| 137 | +Execution examples: |
| 138 | + |
| 139 | + 1. Down-sampling of factor (2.5,3) with real convention: |
| 140 | + |
| 141 | + ./downsampling input.png output.tiff 2.5 3 |
| 142 | + |
| 143 | + 2. Down-sampling to have an image of size 100x200: |
| 144 | + |
| 145 | + ./downsampling input.png output.tiff 100 200 -t 0 |
| 146 | + |
| 147 | +## List of files ## |
| 148 | + |
| 149 | +* CMakeList.txt : CMake file for the compilation |
| 150 | +* LICENSE : License file |
| 151 | +* README.txt : This file |
| 152 | + |
| 153 | +In the data/ directory: |
| 154 | + |
| 155 | +* rubberwhale.png : Test image (color) |
| 156 | +* rubberwhale_gray.png : Test image (grayscale) |
| 157 | + |
| 158 | +In the src/ directory: |
| 159 | + |
| 160 | +* fft_core.[hc] : Functions related to the FFT |
| 161 | +* homographic_transform.[hc] : Functions to perform Algorithm 2 |
| 162 | +* homography_core.[hc] : Functions related to homographies |
| 163 | +* main_downsampling.c : Main program for input/output (Algorithm 4) |
| 164 | +* main_shift.c : Main program for input/output (Algorithm 1) |
| 165 | +* main_transform.c : Main program for input/output (Algorithm 2) |
| 166 | +* main_upsampling.c : Main program for input/output (Algorithm 3) |
| 167 | +* resampling.[hc] : Functions to perform Algorithm 3 et Algorithm 4 |
| 168 | +* shift_transform.[hc] : Functions to perform Algorithm 1 |
| 169 | + |
| 170 | +Additional files are provided in the external/ directory: |
| 171 | + |
| 172 | +* iio.[hc] : Functions for opening images in any format |
| 173 | +* xmtime.h : Clock with millisecond precision |
| 174 | +* nfft-3.5.0 : NFFT3 library |
| 175 | + |
0 commit comments