Skip to content
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

Support exporting image mask files #1244

Open
wants to merge 120 commits into
base: master
Choose a base branch
from
Open

Conversation

ZihaoTu
Copy link

@ZihaoTu ZihaoTu commented Mar 1, 2018

No description provided.

@pmoulon pmoulon changed the base branch from master to develop March 1, 2018 04:30
@pmoulon pmoulon changed the base branch from develop to master March 1, 2018 04:31
@pmoulon
Copy link
Member

pmoulon commented Mar 1, 2018

Thx can you please use this guide: https://github.com/openMVG/openMVG/blob/master/CONTRIBUTING.md
-> Start from the branch develop.

@pmoulon
Copy link
Member

pmoulon commented Mar 1, 2018

Please move your commit f86ff1f to another branch.

auto maskFileName = srcImage + ".mask.png";
if (stlplus::is_file(maskFileName)) {
Image<openMVG::image::RGBColor> maskRGB, maskRGB_ud;
ReadImage(maskFileName.c_str(), &maskRGB);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add the same logic as here: https://github.com/openMVG/openMVG/blob/develop/src/software/SfM/main_openMVG2openMVS.cpp#L162

Sorry I just pushed this safety check some days ago.

@@ -107,11 +107,20 @@ bool exportToOpenMVS(
ReadImage(srcImage.c_str(), &imageRGB);
UndistortImage(imageRGB, cam, imageRGB_ud, BLACK);
WriteImage(image.name.c_str(), imageRGB_ud);
// undistort mask and save it
auto maskFileName = srcImage + ".mask.png";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const std::string
Since the type is known and will not change I would prefer to use std::string there.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

".mask.png" can be saved in a string and reused.
const std::string openmvs_mask_postfix = ".mask.png";

@@ -107,11 +107,20 @@ bool exportToOpenMVS(
ReadImage(srcImage.c_str(), &imageRGB);
UndistortImage(imageRGB, cam, imageRGB_ud, BLACK);
WriteImage(image.name.c_str(), imageRGB_ud);
// undistort mask and save it
auto maskFileName = srcImage + ".mask.png";
if (stlplus::is_file(maskFileName)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OpenMVG is using braces on new lines.

{
}

Image<openMVG::image::RGBColor> maskRGB, maskRGB_ud;
ReadImage(maskFileName.c_str(), &maskRGB);
UndistortImage(maskRGB, cam, maskRGB_ud, BLACK);
WriteImage((image.name + ".mask.png").c_str(), maskRGB_ud);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use the defined openmvs_mask_postfix

}
else
{
// just copy image
stlplus::file_copy(srcImage, image.name);
stlplus::file_copy(srcImage + ".mask.png", image.name + ".mask.png");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the defined openmvs_mask_postfix

@@ -248,6 +248,10 @@ int main(int argc, char **argv)
stlplus::create_filespec(sOutDir, "cloud_and_poses", ".ply"),
ESfM_Data(ALL));

Save(sfmEngine.Get_SfM_Data(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know that you can call the binary ConvertSfMData with -i SOMETHIG.bin -o SOMETHING_ELSE.json for doing this?

@pmoulon
Copy link
Member

pmoulon commented Mar 1, 2018

@ZihaoTu If you want make a PR, please push one commit to the branch else I will have to cherry-pick to keep only the feature

chubei-oppen and others added 24 commits November 18, 2019 18:33
…_imagelisting

support multi camera models
…oints

provide_track_to_compute_3d_points
add sort_and_clean binaray to remove invalid view of sfm_data file
Add TransformSfMData utility
Fix mirrored camera matrix in TransformSfMData
fix pose idx error if there are some missing extrinsics;
…uctureFromKnowPoses

Add option to main compute structure from know poses
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants