5.5. Tutorial: Creating or editing masks in an external application


3DSOM Pro provides an extensive set of automatic, semi-automatic and manual masking tools. However users may wish to use additional tools provided by external 2D imaging software (such as Adobe PhotoShop) to mask the images.


Premasked images with an alpha channel can be loaded into 3DSOM Pro in TIFF format. This is only recommended for image editors such as PhotoShop where camera setting metadata found in the raw image files is preserved when saving the masked versions.

Alternatively, the mask data can be exported from 3DSOM Pro along with the image data as a 4 channel RGBA image for editing in 3rd party applications. Edited masks can then be imported back into 3DSOM Pro for use in 3D model generation.

Step 1
Using pre-masked images

PhotoShop users can create an alpha-channel mask for all the images and save in TIFF format (4 channel RGBA). These images can then be loaded directly into 3DSOM Pro for example using the Images > Add Images... menu item. Make sure the RGB channels have not been modified so that the calibration mat can be correctly detected.

Note that if you choose to use this workflow, we recommend that all masking is peformed in PhotoShop. If you wish to edit a mask simply edit the TIFF image and then refresh the masks in 3DSOM Pro using the Masking > Load Masks... menu item.

If you are not using pre-masked images, load a number of camera images into a new project. Run the auto-masking process to generate initial masks.

Step 2

In the Thumbnail Window, select the masked thumbnails that you wish to edit in a 3rd party application. Use ctrl-click to add an additional thumbnail to the selection and shift-click to select a block of thumbnails.

Step 3

Select the Masking > Save Masks... menu item to save the masks. You will be offered the choice of a number of mask export formats. For compatibility with standard 2D image editors, we recommend you select the TIFF file type. If the directory containing the input images is writeable, it is recommended that the TIFF files are saved in the same directory. i.e. select the "Masks in same folder as each image" option and hit the OK button.

You cannot change the names used for the mask files, but can always save them in a different directory. Files that already exist and will be overwritten are marked with an asterisk.

File formats for saving and loading masks:
  • 4 Channel TIFF: this is the recommended format since it is readable by the majority of applications.
  • Portable Network Graphic (PNG): The original image will be saved as part of the file, with the mask saved in the alpha channel. If the original images were PNG files then no information is lost if the masks overwrite the original images.
  • Portable Grey Map (PGM): Only the mask is saved as a greyscale image. The original image is not saved as part of the PGM file. When using this format for saving masks it is important that the original images are not in PGM format.
Step 4

Open your 3rd party image editor. Load in the TIFF files that 3DSOM Pro will have created in the same directory as the input photographs.

Step 5

The mask information is stored in the "alpha" channel which may not initially be visible. To display the current mask in PhotoShop, select the Channels tab (Window > Show Channels menu item). Then click on the checkbox next to the "Alpha" channel to turn on the visibility for this channel.

Figure 5.5.1. The Channels tab in PhotoShop
Alpha channel convention

3DSOM Pro uses the following convention...

pixel label alpha value colour
object 127-255 white
background 0-127 black

It is advisable to stick to using two colours in the alpha channel — white (255) for the object and black (0) for the background.


In PaintShopPro you need to first create a mask using the Masks > Load From Alpha Channel menu item. Then select the Masks > View Mask menu item.

Step 6

You can use all editing tools in your image editor application to edit the mask channel. If you are editing a mask in PaintShopPro make sure you save the result back to the alpha channel using the Masks > Save To Alpha Channel menu item. When you are done editing save the TIFF file using the original filename.

Masking tips for PhotoShop users
  • From the Channels tab click on "Alpha 1" channel to edit the mask channel.
  • You can use the PaintBrush Tool to paint in the alpha channel. Make sure you use a hard edged brush. Click on the brush and drag the hardness slider to 100%. Use white for painting the object regions and black for painting the background.
  • You can select part of the object (or backdrop) and update the mask using the Select > Save Selection menu item. Choose the "Alpha-1" channel and select "Add to Channel" to set the selected region as object (or "Subtract from Channel" to set as backdrop).
  • If you are selecting an area using the Select > Color Range menu item make sure you have selected the RGB channels in the Channel tab.
  • If you wish to use PhotoShop's image extraction tool then first click the RGB channel in the Channels tab. Then select the Image > Extract menu item and perform the extraction of the object. This will create a transparency channel. To update the mask use the Select > Load Selection menu item and choose the transparency channel. Then use the Select > Save Selection menu item to replace the alpha channel.
  • When you are finished, save as a TIFF with alpha channels using the original filename.
Step 7

Once you have edited the RGBA TIFF images they can be loaded back into 3DSOM Pro by selecting the appropriate thumbnails and using the Masking > Load Masks... menu item. It will ignore the images that it doesn't find a mask files for — these are the ones not marked with an asterisk in the list of filenames.