Skip to content
Snippets Groups Projects
Commit 33f1daab authored by Thomas Müller's avatar Thomas Müller
Browse files

Make dynamic mask work with non-red, non-zero pixels as per the docs

parent f144de26
No related branches found
No related tags found
No related merge requests found
...@@ -582,7 +582,6 @@ NerfDataset load_nerf(const std::vector<filesystem::path>& jsonpaths, float shar ...@@ -582,7 +582,6 @@ NerfDataset load_nerf(const std::vector<filesystem::path>& jsonpaths, float shar
throw std::runtime_error{"Could not open image file: "s + std::string{stbi_failure_reason()}}; throw std::runtime_error{"Could not open image file: "s + std::string{stbi_failure_reason()}};
} }
fs::path alphapath = basepath / fmt::format("{}.alpha.{}", frame["file_path"], path.extension()); fs::path alphapath = basepath / fmt::format("{}.alpha.{}", frame["file_path"], path.extension());
if (alphapath.exists()) { if (alphapath.exists()) {
int wa = 0, ha = 0; int wa = 0, ha = 0;
...@@ -613,7 +612,7 @@ NerfDataset load_nerf(const std::vector<filesystem::path>& jsonpaths, float shar ...@@ -613,7 +612,7 @@ NerfDataset load_nerf(const std::vector<filesystem::path>& jsonpaths, float shar
} }
dst.mask_color = 0x00FF00FF; // HOT PINK dst.mask_color = 0x00FF00FF; // HOT PINK
for (int i = 0; i < dst.res.prod(); ++i) { for (int i = 0; i < dst.res.prod(); ++i) {
if (mask_img[i*4] != 0) { if (mask_img[i*4] != 0 || mask_img[i*4+1] != 0 || mask_img[i*4+2] != 0) {
*(uint32_t*)&img[i*4] = dst.mask_color; *(uint32_t*)&img[i*4] = dst.mask_color;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment