Tutorial #03 : when and how to use the masking tool

Using the masking Tool

 

Welcome to the 3DF Zephyr tutorial series.
In this recipe, you will learn when and how to use 3DF masquerade to mask images.
This feature requires 3DF Zephyr v 1.100 or higher.

 

  • Step 1 – Introduction

3DF Masquerade is bundled and distributed in all 3DF Zephyr versions: with 3DF Masquerade you’ll be able to mask certain images.
Feel free to watch this video tutorial or to skip directly to the following dataset example:

When masking images, you’re telling Zephyr to completely ignore some areas of the pictures, this means that

  • Zephyr will not use the ignored areas to search for features and to create matches between images

  • Zephyr will not use the ignored areas to compute the dense point cloud / mesh from that particular image

This is particularly helpful when there is a lot of background noise or when the subject has been moved incoherently with the background: the most common scenario is a subject that is being acquired on a turntable: since the object is moving but the background wall is not, if the background has enough features sometimes Zephyr might try to set the camera for the background rather than for the actual subject. The solution is to mask the background with 3DF Masquerade before processing the images.

For this tutorial, we are going to use our dismal souvenir dataset 🙂

download datasetDataset Download – Dismal Souvenir (284MB)

 

  • Step 2  – Running 3DF masquerade

3DF Masquerade has been developed as an external executable, so you can either launch it from the Tools menu or during the “Masking” phase in the “Project Wizard” (1b).

If the mask (.bim file) is saved in the same directory where the picture is saved, Zephyr will automatically pick it up when adding pictures.

You can safely mix unmasked images with masked images.

This time, run Zephyr with the same settings described in step 1 but remember to pick “mask images(1) during the “New Project Wizard” under “Additional Options” tab.

 

  • Step 3  – Masquerade sections

The 3DF Masquerade interface is divided into these sections:

  • (2) Upper toolbar – save / undo / redo / rotate image / view BW mask

  • (3) Command history – used to undo/redo actions taken in 3DF Masquerade

  • (4) Picture list – allows to quickly move through your pictures

  • (5) Tools toolbar – picks current tool and masks/unmask image

 

  • Step 4  – Masquerade Tools

3DF Masquerade offers a lot of useful tools, some of them are very similar and probably you will be able to pick them up very easily: in order to mask a certain area (mask what you want to be processed) you can

  • (6) Clear and reset the current image mask

  • (7) Copy the current mask on the next image, this will replicate the mask on the next image.

  • (8) Copy the current mask on all next images

  • (9) Cancel current using tool

  • (10) Rectangle drag a rectangle and then press the “Mask button” (13) to mask the selected area

  • (11) Polygon use left click to add nodes to a polygon path (doubleclick to automatically close it) and press the “Mask button (13)”  to mask the selected area

  • (12) Lasso drag the lasso and press the “Mask button (13)” to mask the selected area

  • (13) Mask button Add current selection to mask

  • (14) Unmask button Remove current selection to mask

  • (15) Use a special algorithm to automatically compute a mask specified for turntable setup (for autocompute mode).

  • (16) Automatically compute the next image automatically, by trying to propagate the current silhouette mask red/blue strokes to next image (for autocompute mode).

  • (17) Mask based on color, pick a color and choose a threshold to mask that range of color in the image

  • (18) Use this tool to mark what you want to include in the mask (for autocompute mode).

  • (19) Use this tool to mark what you want to exclude in the mask (for autocompute mode).

  • (20) Toggle the automated masking compute after each stroke

  • (21) Autocompute the current image (enabled only when the automated masking after each stroke is disabled)

  • (22) Set brush size

When masked, the selection area will turn red (using the manual tools (10,11,12) will show a blue outline while you are defining your shape).

When using these tools, you can add areas by keeping pressed the left control key or subtract areas by keeping pressed the left shift key when doing the selection.  You can undo actions by pressing CTRL+Z or simply by clicking to the command you want to revert back to in the command history section (3).

To zoom in / out you can use the mousewheel up/down ; panning is done by moving the mouse while holding the mousewheel button down.
 

  • Step 5  – The brush tool

The brush tool (also known as silhouetter tool) require you to define at least one foreground stroke (red) and one background stroke (blue). Everything selected by the blue stroke will be masked out. 3DF Masquerade will use its novel algorithm to propagate automatically the mask – high contrast between background and foreground help Masquerade in doing this automatically.

You can quickly switch between the two strokes by pressing left shift+left click. The brush size can be changed with the brush size slider (22).

This tool is especially useful when the background has a very high contrast compared to the object. You can delete existing strokes using the right click.

  • Step 6 – Auto advance mask tool

Pictured below, an example of the auto advance mask tool: on the left (23), _DSC0001.jpg has been manually masked by the user using the red stroke for the statue (foreground) and the blue stroke for the background. On the right (24) you see what happens to _DSC0002.jpg automatically when the user clicks the “compute mask automatically” button (16).

  • Step 7 – Auto advance masking tool for turntable setup

Similarly, on the left (27) the same setup as defined in the step above. However, on the right (28) you can see how the background is automatically propagated after the user clicks the “compute mask automatically” button (16) while the turntable mode (15) is toggled on.

  • Step 8 – Load masks

All mask files (.bim) in the current directory will be detected automatically – however, if you launched 3DF Masquerade from 3DF Zephyr, it may happen that switching back to 3DF Zephyr won’t load the masks automatically – in this case, simply click “refresh” (29).

  • Final notes

Masking can be a daunting task given a high number of pictures, so we strongly encourage taking good pictures when possible. However, masking out large portion of images will considerably speed up the computation process since masked out section won’t be computed at all.

 

The next tutorial will show how to manage multiple objects in 3DF Zephyr’s workspace. Click here to proceed to the next tutorial.