-
-
Notifications
You must be signed in to change notification settings - Fork 827
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New hdri stitching software #678
Changes from 4 commits
8f4a0b0
737ed20
d21c101
5077007
bdd2b91
c7e842c
4f733fa
b4c5454
110be8d
6a02f93
e577670
0d76793
4e49836
0c69255
363a664
670b54d
9cf0d1d
25cffd4
b2aec22
78b8041
0e03fc1
8edd995
6de58b6
237b542
bb929c1
be120eb
9cdfb96
e2fcd33
d9df8fa
c18c79a
3a50728
e474a82
191c1ac
99f871b
a231d7a
cbb4ed9
258e104
39a7783
b604455
a9d51d1
4562124
5f7f08e
55b73a8
5bcf34d
a35fc75
6fea9d1
87b63a7
4a6c18e
956fd99
9a87635
030f79f
7673f28
fdeb437
382ce56
7f5df6c
804a4af
664e2c7
fce1909
f927ee3
db13568
8517dd4
e999483
1ed1753
a1c832e
2d7c36c
cdab531
e223770
9099d78
4bacac0
b8c299c
6179a43
84e86c0
a74a294
11c2c1f
fc86b28
7745ae3
a5f3d0e
640731f
e5173ff
0629071
1b3150e
75c1e9d
f6cf207
a0020f7
85112a4
457e72e
98f1d1f
17b5d86
ecb6804
fd99ee2
633f046
e68fa67
1870454
95bb845
802571c
a028475
fd795d1
5d748a1
3547e83
0f6ee90
b2444a4
197a341
861c1af
8dbc7af
d3a8181
0510a1d
7ed0e60
783d4ab
76598cf
3c77d5d
684d073
c2b66f4
cb97617
020c427
3da66b7
a53b414
b4f7dd1
426bf32
8788e53
f3d5f8d
0f3f161
87777fc
6a729e6
9c1cb2e
b65cc30
f776121
168d6f3
c2696ea
fdce092
6faa7b2
bbcd5e0
21a4f03
9ee8b30
368ab28
4e7ca46
d0f4d65
8303d14
4dddb5f
cc37725
a5378aa
1d54f90
3f99913
1f298ce
42debb5
c56cc20
4af5ffc
a8d5d51
a2330eb
00f8ae0
a601611
b86b7f5
6bf245a
39744c1
ee19530
7754b81
0a6d674
5096d47
d967fb8
900def1
e5c8877
c23879a
0002d13
339fcb5
cbb3e86
38e469a
2aff5ae
a712450
12689a1
a8fdf6f
c274b68
414ef86
df44721
b41730d
587aacf
2e7d7ac
c0cd659
ba8082b
420d74f
a0a1d64
0698c38
66a2bec
790af00
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,7 +93,7 @@ float sigmoid(float x, float sigwidth, float sigMid) | |
* @param[out] buffer - to store input metadata in output image | ||
* @param[out] imageAlpha - output RGBAf fisheye image correctly oriented | ||
*/ | ||
void setFisheyeImage(image::Image<image::RGBfColor>& imageIn, oiio::ImageBuf& buffer, image::Image<image::RGBAfColor>& imageAlpha) | ||
void setFisheyeImage(image::Image<image::RGBfColor>& imageIn, const float blurWidth_param, oiio::ImageBuf& buffer, image::Image<image::RGBAfColor>& imageAlpha) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. const not necessary with primitive type |
||
{ | ||
bool correctOrientation = oiio::ImageBufAlgo::reorient(buffer, buffer); | ||
|
||
|
@@ -110,9 +110,9 @@ void setFisheyeImage(image::Image<image::RGBfColor>& imageIn, oiio::ImageBuf& bu | |
|
||
imageAlpha.resize(width, height, false); | ||
|
||
const float maxRadius = std::min(width, height) * 0.5 * 0.95; | ||
const float blurWidth = maxRadius * 0.2; | ||
const float blurMid = maxRadius * 0.95; | ||
const float maxRadius = std::min(width, height) * 0.5; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. .5f |
||
const float blurWidth = maxRadius * blurWidth_param; | ||
const float blurMid = maxRadius - blurWidth/2.f; | ||
const Vec2i center(width/2, height/2); | ||
|
||
for(std::size_t x = 0; x < width; ++x) | ||
|
@@ -188,7 +188,7 @@ void fisheyeToEquirectangular(image::Image<image::RGBAfColor>& imageIn, const in | |
* @param[in] rotations - contains adjustment rotations on each image set by user | ||
* @param[out] outputFolder - output folder path to write panorama | ||
*/ | ||
void stitchPanorama(const std::vector<std::string>& imagePaths, const std::vector<oiio::ParamValueList>& metadatas, const std::array<std::vector<double>, 3> rotations, std::string& outputPath) | ||
void stitchPanorama(const std::vector<std::string>& imagePaths, const std::vector<oiio::ParamValueList>& metadatas, const float blurWidth, const std::array<std::vector<double>, 3> rotations, std::string& outputPath) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
{ | ||
int nbImages = imagePaths.size(); | ||
image::Image<image::RGBAfColor> imageOut; | ||
|
@@ -216,7 +216,7 @@ void stitchPanorama(const std::vector<std::string>& imagePaths, const std::vecto | |
image::getBufferFromImage(imageIn, buffer); | ||
buffer.specmod().extra_attribs = metadatas[i]; | ||
|
||
setFisheyeImage(imageIn, buffer, imageAlpha); | ||
setFisheyeImage(imageIn, blurWidth, buffer, imageAlpha); | ||
|
||
if(i == 0) | ||
{ | ||
|
@@ -247,6 +247,7 @@ int main(int argc, char** argv) | |
std::string verboseLevel = system::EVerboseLevel_enumToString(system::Logger::getDefaultVerboseLevel()); | ||
std::vector<std::string> inputPath; // media file path list | ||
std::string outputFolder; // output folder for panorama | ||
float blurWidth = 0.2f; | ||
std::vector<double> xRotation; | ||
std::vector<double> yRotation; | ||
std::vector<double> zRotation; | ||
|
@@ -263,6 +264,8 @@ int main(int argc, char** argv) | |
|
||
po::options_description optionalParams("Optional parameters"); | ||
optionalParams.add_options() | ||
("blurWidth,b", po::value<float>(&blurWidth)->default_value(blurWidth), | ||
"Blur width of alpha channel for all fisheye (between 0 and 1), determine the transitions sharpness.") | ||
("xRotation,x", po::value<std::vector<double>>(&xRotation)->multitoken(), | ||
"Angles to rotate each image on axis x : horizontal axis on the panorama.") | ||
("yRotation,y", po::value<std::vector<double>>(&yRotation)->multitoken(), | ||
|
@@ -333,7 +336,7 @@ int main(int argc, char** argv) | |
{ | ||
for(fs::directory_entry& file : boost::make_iterator_range(fs::directory_iterator(path), {})) | ||
{ | ||
if(fs::is_regular_file(file.status())) | ||
if(image::isSupported(file.path().extension().string())) | ||
{ | ||
imagePaths.push_back(file.path().string()); | ||
|
||
|
@@ -358,7 +361,7 @@ int main(int argc, char** argv) | |
} | ||
} | ||
|
||
else if(fs::exists(path) && fs::is_regular_file(fs::path(entry))) | ||
else if(fs::exists(path) && image::isSupported(path.extension().string())) | ||
{ | ||
imagePaths.push_back(path.string()); | ||
|
||
|
@@ -387,6 +390,12 @@ int main(int argc, char** argv) | |
} | ||
} | ||
|
||
if(imagePaths.empty()) | ||
{ | ||
ALICEVISION_LOG_ERROR("No valid image file found in input folder or paths"); | ||
return EXIT_FAILURE; | ||
} | ||
|
||
int nbImages = imagePaths.size(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. const auto |
||
std::vector<float> times_sorted = times; | ||
std::vector<std::string> imagePaths_sorted; | ||
|
@@ -416,7 +425,7 @@ int main(int argc, char** argv) | |
|
||
ALICEVISION_LOG_INFO(nbImages << " file paths found."); | ||
|
||
stitchPanorama(imagePaths_sorted, metadatas_sorted, rotations, outputFolder); | ||
stitchPanorama(imagePaths_sorted, metadatas_sorted, blurWidth, rotations, outputFolder); | ||
|
||
return EXIT_SUCCESS; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const