Skip to content

Commit 272dbb1

Browse files
committed
0.20191003: added tpi
1 parent ed0eccc commit 272dbb1

File tree

1,689 files changed

+289758
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,689 files changed

+289758
-0
lines changed

scale/tpi/CMakeLists.txt

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
cmake_minimum_required(VERSION 2.6)
2+
3+
# Enable C99
4+
if(CMAKE_VERSION VERSION_LESS "3.1")
5+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
6+
else()
7+
set(CMAKE_C_STANDARD 99)
8+
endif()
9+
10+
# Find OPENMP
11+
find_package(OpenMP)
12+
if (OPENMP_FOUND)
13+
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
14+
endif()
15+
16+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
17+
18+
# include source code directory
19+
set(SRC src)
20+
include_directories(${SRC})
21+
22+
# include external code directory
23+
set(EXTERNAL ${SRC}/external)
24+
include_directories(${EXTERNAL})
25+
26+
# include NFFT
27+
add_subdirectory(${EXTERNAL}/nfft-3.5.0)
28+
include_directories(${NFFT3_INCPATH})
29+
link_directories( ${NFFT3_LIBPATH})
30+
31+
# set libraries
32+
set(LIBS m iio fftw3 fftw3_threads)
33+
34+
# geometric transformation using NFFT
35+
add_executable(tpi_transformhomographic ${SRC}/main_transform.c ${SRC}/homographic_transform.c ${SRC}/fft_core.c ${SRC}/homography_core.c)
36+
add_dependencies(tpi_transformhomographic nfft-3.5.0)
37+
target_link_libraries(tpi_transformhomographic ${LIBS} nfft3_threads)
38+
39+
# shift interpolation
40+
add_executable(tpi_transformshift ${SRC}/main_shift.c ${SRC}/shift_transform.c ${SRC}/fft_core.c)
41+
target_link_libraries(tpi_transformshift ${LIBS})
42+
43+
# upsampling
44+
add_executable(tpi_samplingup ${SRC}/main_upsampling.c ${SRC}/resampling.c ${SRC}/fft_core.c)
45+
target_link_libraries(tpi_samplingup ${LIBS})
46+
47+
# downsampling
48+
add_executable(tpi_samplingdown ${SRC}/main_downsampling.c ${SRC}/resampling.c ${SRC}/fft_core.c)
49+
target_link_libraries(tpi_samplingdown ${LIBS})

scale/tpi/LICENSE

Lines changed: 116 additions & 0 deletions
Large diffs are not rendered by default.

scale/tpi/README.txt

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
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+

scale/tpi/data/rubberwhale.png

351 KB
Loading
116 KB
Loading

scale/tpi/man/tpi_samplingdown.1

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
.TH "IPOL tools User Manual" 1 "03 Oct 2019" "IPOL documentation"
2+
3+
.SH NAME
4+
tpi_samplingdown
5+
6+
.SH DESCRIPTION
7+
Trigonometric Polynomial Interpolation of Images
8+
9+
.SH SYNOPSIS
10+
tpi_samplingdown input output valuex valuey [OPTIONS]
11+
12+
.SH OPTIONS
13+
.TP
14+
input
15+
name input graphics file (jpeg | png | tiff)
16+
.TP
17+
output
18+
name output graphics file (jpeg | png | tiff)
19+
.TP
20+
valuex
21+
value horisontal down sample factor
22+
.TP
23+
valuey
24+
value vertical down sample factor
25+
.TP
26+
-t
27+
specify the input type of valuex and valuey (by default 1)
28+
29+
.SH EXAMPLE
30+
tpi_samplingdown input.png output.tiff 2.5 3
31+
32+
.SH COPYRIGHT
33+
Copyright : (C) 2019 IPOL Image Processing On Line http://www.ipol.im/
34+
Licence : GPL v2+, see GPLv2.txt
35+
36+
.SH SEE ALSO
37+
cjpeg (1),
38+
djpeg (1)
39+
40+
.SH CONTACTS
41+
.TP
42+
Author:
43+
Thibaud Briand <briand.thibaud@gmail.com>
44+
.TP
45+
Latest version available at:
46+
https://github.com/IPOL-Fork/ipol-tools

scale/tpi/man/tpi_samplingup.1

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
.TH "IPOL tools User Manual" 1 "03 Oct 2019" "IPOL documentation"
2+
3+
.SH NAME
4+
tpi_samplingup
5+
6+
.SH DESCRIPTION
7+
Trigonometric Polynomial Interpolation of Images
8+
9+
.SH SYNOPSIS
10+
tpi_samplingup input output valuex valuey [OPTIONS]
11+
12+
.SH OPTIONS
13+
.TP
14+
input
15+
name input graphics file (jpeg | png | tiff)
16+
.TP
17+
output
18+
name output graphics file (jpeg | png | tiff)
19+
.TP
20+
valuex
21+
value horisontal down sample factor
22+
.TP
23+
valuey
24+
value vertical down sample factor
25+
.TP
26+
-t
27+
specify the input type of valuex and valuey (by default 1)
28+
.TP
29+
-i
30+
specify the trigonometric polynomial interpolator type (by default 1)
31+
32+
.SH EXAMPLE
33+
tpi_samplingup input.png output.tiff 2.5 3
34+
35+
.SH COPYRIGHT
36+
Copyright : (C) 2019 IPOL Image Processing On Line http://www.ipol.im/
37+
Licence : GPL v2+, see GPLv2.txt
38+
39+
.SH SEE ALSO
40+
cjpeg (1),
41+
djpeg (1)
42+
43+
.SH CONTACTS
44+
.TP
45+
Author:
46+
Thibaud Briand <briand.thibaud@gmail.com>
47+
.TP
48+
Latest version available at:
49+
https://github.com/IPOL-Fork/ipol-tools
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
SUBDIRS = cstripack .
2+
3+
noinst_LTLIBRARIES = lib3rdparty.la
4+
5+
lib3rdparty_la_SOURCES =
6+
7+
lib3rdparty_la_LIBADD = cstripack/libcstripack.la
8+
9+
EXTRA_DIST = README

0 commit comments

Comments
 (0)