Skip to content

Commit be77725

Browse files
committed
Version 0.2.0
1 parent 446b5cc commit be77725

File tree

3 files changed

+100
-52
lines changed

3 files changed

+100
-52
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,15 @@ jobs:
4848
- name: Cache vcpkg libraries
4949
if: runner.os == 'Windows'
5050
uses: actions/cache@v3
51+
env:
52+
cache-name: cache-vcpkg-packages
5153
with:
5254
path: |
5355
C:/vcpkg/installed
5456
C:/vcpkg/vcpkg
55-
key: ${{ runner.os }}-vcpkg-${{ hashFiles('**/vcpkg.json') }}
57+
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('C:/vcpkg/**/vcpkg.json') }}
58+
restore-keys: |
59+
${{ runner.os }}-${{ env.cache-name }}-
5660
5761
5862
- name: Install libjpeg-turbo (Windows)

README.md

Lines changed: 71 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -41,59 +41,98 @@ git submodule update
4141

4242
```
4343
Usage:
44-
./reproject [OPTION...]
44+
./bin/reproject [OPTION...]
4545
4646
Color processing options:
47-
--exposure EV Exposure compensation in stops (EV) to brigthen or
47+
--exposure EV Exposure compensation in stops (EV) to brigthen or
4848
darken the pictures. (default: 0.0)
49-
--reinhard max Use reinhard tonemapping with given maximum value
50-
(after exposure processing) on the output images.
49+
--reinhard max Use reinhard tonemapping with given maximum value
50+
(after exposure processing) on the output images.
5151
(default: 1.0)
5252
53+
Filter files options:
54+
--filter-prefix prefix Only include files starting with (default:
55+
"")
56+
--filter-suffix suffix Only include files ending with (default: "")
57+
58+
Input optics.
59+
These are usually inferred by the config JSONs. When specifying
60+
--no-configs, lens information needs to be passed through these
61+
command line options options:
62+
--i-rectilinear focal_length,sensor_width
63+
Input rectilinear images with given
64+
focal_length,sensor_width tuple.
65+
--i-equisolid focal_length,sensor_width,fov
66+
Input equisolid images with given
67+
focal_length,sensor_width,fov tuple.
68+
--i-equidistant fov Input equidistant images with given fov
69+
value.
70+
--i-equirectangular long_min,long_max,lat_min,lat_max (radians)
71+
Input equirectangular images with given
72+
longitude min,max and latitude min,max
73+
value or 'full'.
74+
5375
Input/output options:
54-
--input-cfg json-file Input JSON file containing lens and camera
55-
settings of the input images.
56-
--output-cfg json-file Output JSON file containing lens and camera
57-
settings of the input images.
58-
-i, --input-dir file Input directory containing images to
59-
reproject.
60-
--single file A single input file to convert.
61-
-o, --output-dir file Output directory to put the reprojected
62-
images.
63-
--exr Output EXR files. Color and depth.
64-
--png Output PNG files. Color only.
76+
--input-cfg json-file Input JSON file containing lens and camera
77+
settings of the input images.
78+
--output-cfg json-file Output JSON file containing lens and camera
79+
settings of the output images.
80+
--no-configs width,height
81+
Work without reading and writing config
82+
files. Requires you to specify the input
83+
lens through the input-optics flags
84+
(staring with -i-...) and the expected
85+
resolution of the input images here.
86+
-i, --input-dir file Input directory containing images to
87+
reproject.
88+
--single file A single input file to convert.
89+
-o, --output-dir file Output directory to put the reprojected
90+
images.
91+
--exr Output EXR files. Color and depth.
92+
--png Output PNG files. Color only.
6593
6694
Output optics options:
6795
--no-reproject Do not reproject at all.
6896
--rectilinear focal_length,sensor_width
69-
Output rectilinear images with given
97+
Output rectilinear images with given
7098
focal_length,sensor_width tuple.
7199
--equisolid focal_length,sensor_width,fov
72-
Output equisolid images with given
100+
Output equisolid images with given
73101
focal_length,sensor_width,fov tuple.
74-
--equidistant fov Output equidistant images with given fov
102+
--equidistant fov Output equidistant images with given fov
75103
value.
104+
--equirectangular longitude_min,longitude_max,latitude_min,latitude_max
105+
Output equirectangular images with given
106+
longitude min,max and latitude min,max
107+
value or 'full'.
108+
--rotation pan, pitch, roll (degrees)
109+
Specify a rotation (default: 0.0)
76110
77111
Runtime options:
78-
-j, --parallel threads Number of parallel images to process. (default:
112+
--skip-if-exists Skip if the output file already exists.
113+
-j, --parallel threads Number of parallel images to process. (default:
79114
1)
80-
--dry-run Do not actually reproject images. Only produce
115+
--dry-run Do not actually reproject images. Only produce
81116
config.
82117
-h, --help Show help
83118
84119
Sampling options:
85-
-s, --samples number Number of samples per dimension for interpolating
86-
(default: 1)
87-
--nn Nearest neighbor interpolation
88-
--bl Bilinear interpolation
89-
--bc Bicubic interpolation (default)
90-
--scale percentage Output scale, as a fraction of the input size. It
91-
is recommended to increase --samples to prevent
92-
aliassing in case you are downscaling. Eg:
93-
--scale 0.5 --samples 2 or --scale 0.33334
94-
--samples 3 or --scale 0.25 --samples 4. Final
95-
dimensions are rounded towards zero. (default:
96-
1.0)
120+
-s, --samples number Number of samples per dimension for
121+
interpolating (default: 1)
122+
--nn Nearest neighbor interpolation
123+
--bl Bilinear interpolation
124+
--bc Bicubic interpolation (default)
125+
--scale percentage Output scale, as a fraction of the input
126+
size. It is recommended to increase
127+
--samples to prevent aliassing in case you
128+
are downscaling. Eg: --scale 0.5 --samples
129+
2 or --scale 0.33334 --samples 3 or --scale
130+
0.25 --samples 4. Final dimensions are
131+
rounded towards zero. (default: 1.0)
132+
--output-resolution width,height
133+
A fixed output resolution. Overwrites the
134+
behavior of the 'scale' parameter.
135+
97136
```
98137

99138
### Configuration JSON

src/main.cpp

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -59,31 +59,36 @@ int parse_equirectangular(const std::string &lstr, float res_x, float res_y,
5959
reproject::LensInfo &li) {
6060
auto &lier = li.equirectangular;
6161
li.type = reproject::EQUIRECTANGULAR;
62-
int argidx = 0;
63-
for (size_t b = 0, e = lstr.find(",");;
64-
b = e + 1, e = lstr.find(",", e + 1)) {
65-
std::string arg = lstr.substr(b, e - b);
66-
std::printf("argidx: %d, arg: %s, b: %zu, e: %zu\n", argidx, arg.c_str(), b,
67-
e);
68-
double fa = std::atof(arg.c_str());
69-
// clang-format off
62+
if (lstr == "full") {
63+
lier.longitude_min = -M_PI;
64+
lier.longitude_max = M_PI;
65+
lier.latitude_min = -M_PI * 0.5f;
66+
lier.latitude_max = M_PI * 0.5f;
67+
} else {
68+
int argidx = 0;
69+
for (size_t b = 0, e = lstr.find(",");;
70+
b = e + 1, e = lstr.find(",", e + 1)) {
71+
std::string arg = lstr.substr(b, e - b);
72+
double fa = std::atof(arg.c_str());
73+
// clang-format off
7074
switch (argidx) {
7175
case 0: lier.longitude_min = fa; break;
7276
case 1: lier.longitude_max = fa; break;
7377
case 2: lier.latitude_min = fa; break;
7478
case 3: lier.latitude_max = fa; break;
79+
}
7580
// clang-format on
76-
}
7781

78-
argidx++;
79-
if (e == std::string::npos) {
80-
break;
82+
argidx++;
83+
if (e == std::string::npos) {
84+
break;
85+
}
86+
}
87+
if (argidx != 4) {
88+
std::printf("Error: expected 4 arguments for equirectangular, got %d.\n",
89+
argidx);
90+
return 1;
8191
}
82-
}
83-
if (argidx != 4) {
84-
std::printf("Error: expected 4 arguments for equirectangular, got %d.\n",
85-
argidx);
86-
return 1;
8792
}
8893
li.sensor_width = li.sensor_height = 0;
8994
return 0;
@@ -208,7 +213,7 @@ int main(int argc, char **argv) {
208213
"fov value.",
209214
cxxopts::value<std::string>(), "fov")
210215
("i-equirectangular", "Input equirectangular images with given longitude "
211-
"min,max and latitude min,max value.",
216+
"min,max and latitude min,max value or 'full'.",
212217
cxxopts::value<std::string>(), "long_min,long_max,lat_min,lat_max (radians)")
213218
;
214219

@@ -224,7 +229,7 @@ int main(int argc, char **argv) {
224229
"fov value.",
225230
cxxopts::value<std::string>(), "fov")
226231
("equirectangular", "Output equirectangular images with given longitude "
227-
"min,max and latitude min,max value.",
232+
"min,max and latitude min,max value or 'full'.",
228233
cxxopts::value<std::string>(), "longitude_min,longitude_max,latitude_min,latitude_max")
229234
("rotation", "Specify a rotation",
230235
cxxopts::value<std::string>()->default_value("0.0"), "pan, pitch, roll (degrees)")

0 commit comments

Comments
 (0)