Masking Question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • apenngrace
    3Dflower
    • Feb 2016
    • 4

    Masking Question

    If I want to mask photos using a program like Gimp or Photoshop rather than Masquerade, is that supported? If it is, then does 3D Zephyr analyze the transparency channel and just ignore transparent pixels?

    Thanks!
  • Roberto
    3Dflow
    • Jun 2011
    • 559

    #2
    Hello!

    yes, you can load external .png, .jpg or .tif images as masks. White pixels will be marked as foreground regions, while black pixels will be interpreted as background.
    Additionally, if you put the masks in the same folder of the images and with same name followed by one of these suffixed:
    "_mask.png"
    "_masked.png"
    "_mask.jpg"
    "_masked.jpg"
    "_mask.tif"
    "_masked.tif"
    "_mask.tiff"
    "_masked.tiff"

    They will be automatically loaded by zephyr in the masking selection page.

    Comment

    • apenngrace
      3Dflower
      • Feb 2016
      • 4

      #3
      Thank you for your reply! Let's say my original full-color images are pic1.png, pic2.png, ... etc. Would I save the files like this?

      pic1_masked.png (original image)
      pic1_mask.png (black & white mask image)
      pic2_masked.png (original)
      pic2_mask.png (black & white mask image)

      Also, when saving the mask file, does it matter what color format is used to save it? Can it be RGB, grayscale, or black & white?

      Thanks!

      Comment

      • Roberto
        3Dflow
        • Jun 2011
        • 559

        #4
        If your images are named pic1.png, pic2.png, etc.. you can keep the original names and simply add one the suffixes for the masks.
        Eg:
        pic1.png (original image)
        pic1_mask.png (mask)
        pic2.png (original image)
        pic2_masked.png (mask)

        Actually it would work also if you name the mask images pic1.png_mask.png or pic2.png_masked.png.

        You can save the masks either in RGB or greyscale. If you save them in RGB, Zephyr will automatically convert masks to greyscale and then put a threshold to mark foreground pixels (greyscale value greater than 127 bright/white) and background pixels (greyscale value less then 127 dark/black). If you want to save them in black and white, that's fine too.

        Comment

        • apenngrace
          3Dflower
          • Feb 2016
          • 4

          #5
          Thanks!

          Comment

          • apenngrace
            3Dflower
            • Feb 2016
            • 4

            #6
            I have a follow-up question. What are the steps to make sure that makes are used?

            This is what I tried:

            I created about 100 masks (white foreground, black background), and used the naming convention "_mask.png" (the originals are also png). In the New Project wizard, I select "mask images" on the first dialog box.

            Then I I first selected all my images, including the masked images as input. I saw that 3D Samantha was calculating descriptors for the mask images, so I suspected that wasn't right. I cancelled that process.

            Then, I reran the New Project wizard, selected the Mask Images checkbox, and only selected the original images (none that had the "_mask.png" suffix).

            At that point, do I need to do something in Masquerade? I saw that in Masquerade the mask files are present. I am not sure if I need to do anything there. I try clicking the B/W Mask Button, and I see all black. When I exit masquerade, in the "Start Reconstruction Page" under "Session Summary", I see messages like:

            [pre]
            Code:
            Camera Video Feb 10, 4 03 49 PM_0.png is masked
            Camera Video Feb 10, 4 03 49 PM_1.png is masked
            Camera Video Feb 10, 4 03 49 PM_2.png is masked
            Camera Video Feb 10, 4 03 49 PM_3.png is masked
            Camera Video Feb 10, 4 03 49 PM_4.png is masked
            [/pre]


            The problem is that when I see the final results, the results are the same as if I had no mask. I suspect that maybe there is something that I am missing or the file format of the mask is not what is expected or something. The mask PNG file is RGBA color, with opaque white (255,255,255,255) and black values (0,0,0,255).

            Here is a sample original image.
            Here is the mask for the sample.

            Here is a screen shot of the result (after creating dense point cloud). I am not expecting to see the clouds or the stairs around the object to be appearing.

            I'm not sure what could be going wrong.

            Thanks for your help,
            Andrew

            Comment

            • Roberto
              3Dflow
              • Jun 2011
              • 559

              #7
              No, you don't need to do anything else in Masquerade.
              You should just add only the original images and check the 'mask images' checkbox as you correctly did.
              The mask image seems fine, but the results are clearly not.
              You can check if the images are correctly masked by double clicking on a image and opening the properties dialog.
              If you check the 'show masked' checkbox, you should see the masked image. If you don't see any 'show masked' at all, then the masks were not loaded.

              If you are still having problems, could please you send me the dataset and the zep file?

              The noise should disappear by using masks, but as a side note, you can also try to remove the noise using the confidence tool.

              Comment

              • apenngrace
                3Dflower
                • Feb 2016
                • 4

                #8
                When I click the show masked checkbox, it still shows the whole image (screenshot).

                Here is my dataset: dataset.
                Here is my zep file: zep file.

                Thanks,
                Andrew

                Comment

                • Roberto
                  3Dflow
                  • Jun 2011
                  • 559

                  #9
                  Ok I think I got it.
                  The images were saved as RGBA, but the alpha channel has always a value of 255. Zephyr reads the alpha channel if it finds one.
                  You can just save the masks as RGB png (save for web and remove transparency from Photoshop) or save them in jpg or set the alpha channel accordingly. You can also use a tool like this one to convert them in batch.

                  Once you are done, just update the masks on your current project (tools-]workspace-]change masks) and run again the dense point cloud generation.

                  Comment

                  Working...