Background suppression from single mask in Agisoft PhotoScan

Back to overview

This guest post by the team at Agisoft provides tips and tricks to quickly eliminate background data from your photogrammetry image sets using automated masking techniques – read on to up your PhotoScan skills and capture awesome 3D! Originally published on the Agisoft blog.

This tutorial introduces the new alignment parameter Apply masks to Key/Tie points, which was added in PhotoScan 1.4.1:

If Apply masks to Key points is selected, masked areas are excluded from the feature detection procedure independently for each photo. This behavior is equal to the old Constrain features by mask parameter that was in PhotoScan 1.4.0 and older versions.

If Apply masks to Tie points is selected, certain tie points are excluded from the alignment procedure. Effectively this implies that if some area is masked at least on a single photo, relevant key points on the rest of the photos picturing the same area will also be ignored during the alignment procedure (a tie point is a set of key points which have been matched as projections of the same 3D point on different images). This can be useful to suppress background in turntable-like shooting scenarios with few or even with a single mask. Two examples of difficult-for-alignment turntable-like datasets will be discussed below.

Banana on the table

One of the ways to photoscan a small object is to put your camera on a tripod, place the object on a table in front of the camera and take a photo, then rotate the object so that the camera sees the object from a different angle, take a photo, and so on. You can also take a photo of the background (brown desk and white box) without the object (banana) – this will be helpful while processing the whole dataset.

Banana dataset (44 photos, 158 Mb) looks like this:

Please note that in addition to the static background, this dataset also has another non-optimality: the photos were taken from a significantly long distance and with a little bit of zoom; as a result the banana was scanned with fewer pixels than if it were scanned with the proper distance and/or zoom.

If you run Workflow -> Align Photos… without masks (or with Apply masks to None, which effectively is the same option), you will find cameras incorrectly aligned with respect to the brown desk and white box from the background. All photo positions are recognized as being the same, since the camera, in fact, was at the same place on the tripod:

If you just fully mask the background only photo (which doesn’t include the banana) using Rectangle Selection and afterwards align photos using the parameter Apply masks to Tie points, all cameras (except the photo of the background) will be aligned:

Note that the photo of the background (without object) is not mandatory. You can mask the background on one of the photos observing the object and all cameras will be also aligned. Just don’t forget to use the Apply masks to Tie points feature and try to mask background on the photo that observes as much of the background as possible. Sometimes you will need to mask more than one photo, because in some cases there is no single photo capturing the whole background surface at once.

Oenochoe on the bedsheet

Another example is the oenochoe dataset (80 photos). Note that this dataset doesn’t contain the photo of the background without the object, because the photos were taken from different positions and with different view angles and as a result the photos observe different parts of the background.

Please note that in addition to the static background, this dataset has another non-optimality – lighting conditions could have been better. In an ideal case you need uniform diffuse light.

If you just run Workflow -> Align Photos…, you will see that the cameras aligned relative to the white background bedsheet:

To avoid this, you need to mask the background surface. It is enough to mask the background with Intelligent Scissors on only two photos – a photo with the bedsheet’s upper part and the photo with the bedsheet’s bottom part. Note that a single mask is not enough, because there is no single camera observing the full bedsheet at once:

With just two masks and parameter Apply masks to Tie points all 80 photos were successfully aligned:

About the author


No Comments

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    Related articles