4.2. Tutorial: Using the Magic Highlighter masking tool

Problem

Sometimes it is difficult to set-up a suitable backdrop and stand to allow automatic masking to work well (for example the stand may need to be a different colour to the backdrop). However completely manual masking can be tedious and error-prone.

Solution

3DSOM Pro provides a semi-automatic tool to make manual masking easier. The new "Magic Highlighter" tool allows you to quickly highlight the edges of the object using a wide "highlight" pen and 3DSOM Pro will refine the edge to get the precise mask.

Alternatively the "shrink-wrap" tool is still available if you want to sketch a rough outline outside the object which is "collapsed" onto the true boundary.

Starting Point

Load one or more photographs of the object for masking. Select one of the images by double-clicking the desired thumbnail.

Step 1

Remove any existing mask using the ID_UNMASK_IMAGE.jpgUnmask image button from the Edit Masks toolbar.

Step 2

Select the ID_MAGIC_MARKER.jpgMagic highlighter mode button to enter "Magic Highlighter" mode. You will see the following popup tool palette...

The top row of buttons select four different brush sizes. You can also use , and . to adjust the brush size in small increments or < and > to adjust the brush size in large increments.

Initially the ID_MAGIC_MARKER.jpgMagic highlighter mode button is selected so that the paint mode is set to apply the magic highlighter.

The ID_MAGIC_UNPAINT.jpgUnpaint highlight button should be used to unpaint areas you previously marked with the magic highlighter.

The Preview button refines the edge and display the resulting mask displayed previewed as a solid colour. Clicking on the image or a button will hide the preview and return to the edge highlighting display.

The ID_MAGIC_DONE.jpg button is pressed when you are happy and the ID_MAGIC_CANCEL.jpg button cancels the highlighting process and returns to the previous mask.

Step 3

Select a large brush and roughly paint around the edge of the object. Make sure the true object boundary lies within the highlighted region. Hit Preview button to view the initial result.

Figure 4.2.1. Sketch around boundary
Figure 4.2.2. Previewed result
Step 4

Highlight any interior edges around holes. If you used a wide brush size then you may see that the hole is completely filled-in - which will not have the desired effect.

Figure 4.2.3. Left: closeup of highlighted interior hole, Right: resulting mask ignores hole

To correct this, you should select a small brush size and the ID_MAGIC_UNPAINT.jpgUnpaint highlight button. Then unpaint an area inside the hole so that 3DSOM Pro can grow the hole up to the highlighted edges.

Figure 4.2.4. Left: closeup with part of hole unpainted, Right: resulting mask correctly shows the hole region
Step 5

You can use the highlighter and unpaint tools to refine the results. For example if a dot from the calibration targets is visible in your previewed mask, you can unpaint part of the dot so that it is no longer included as shown below:

Figure 4.2.5. Left: Closeup of hightlighted edge, Right: Resulting mask contains background dot
Figure 4.2.6. Left: Refined highlighted region with dot partially unpainted, Right: Resulting mask is fixed
between projected points and observed image feed.
Step 6

For difficult areas where there is poor contrast between foreground and background you will need to paint a more accurate highlighted edge with smaller brush.

When you are happy with the previewed result hit the ID_MAGIC_DONE.jpg button. The popup palette should disappear and you are back to normal mask editing.

Step 7

Once processed, you can adjust the tightness of the mask using the interactive slider in the "Auto Mask" palette and you can apply the adjustment within the currently selected rectangular region.

Finally you can use all the manual tools to edit the mask as normal.

4.2.1. The "shrinkwrap" tool

3DSOM Pro also includes a shrinkwrap tool that allows a rough sketch containing a painted area completely outside the object to be "shrinkwrapped" onto the object. Note that this contrasts with the "Magic Highlighter" where the area painted should include the true boundary.

Step 1

To use the shrinkwrap tool simple paint a closed rough outline outside the object using the ID_PAINT_MASK.jpgPaint mask button.

TIP:

The outline can be very rough but make sure you don't touch the object you are trying to mask. If there are holes in the object shape you can also paint inside these areas to help the masking process.

Step 2

Hit the ID_SHRINKWRAP.jpgShrink-wrap Mask button and drag the masking slider to interactively shrink-wrap the mask. Move the slider to the right to create more mask colour and to the left to create less mask colour.

Step 3

For finer control you can modify the shrink-wrap threshold in a rectangular region of the image. Simply click the ID_PAINT_SELECTREGION.jpgregion select button. Then select the desired image region by dragging with the left mouse button. Now drag the masking slider to interactively set the threshold for the selected region only.

Step 4

Select or deselect the "Holes" checkbox to allow or disallow holes in the object.

TIP:

At any stage, you can re-run the shrink-wrapping using the current mask as a starting point. This can be helpful when fine-tuning the mask in a selected region.