Aligning turntable photos with background suppression from single mask in Agisoft PhotoScan


You are reading outdated article. For the most recent instruction please check the tutorial in Agisoft Knowledge Base: Aligning turntable photos with background suppression from single mask in Agisoft Metashape.

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

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

If Apply masks to Tie points selected - certain tie points are excluded from 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 be also ignored during 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 scenario 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 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 and take a photo, and so on. You can also take a photo of the background (brown desk and white box) without object (banana) - this will be helpful while processing the whole data.

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

Please note that except static background this dataset also has another non-optimality: the photos were taken from significantly long distance and with small zoom, as a result the banana was scanned with less number of pixels as it can be scanned with 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 brown desk and white box from background. All photo positions be recognized as being the same, since camera, in fact, was at the same place on tripod:

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

Note that photo of the background (without object) is not mandatory. You can mask background on one of the photos observing the object and all cameras will be also aligned. Just don't forget to use 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 oberserving 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 except 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 cameras aligned relative to the white background bedsheet:

To avoid this, you need to mask background surface. It is enough to mask 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 full bedsheet at once:

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

Forum discussion

Discuss new masking possibility for alignment and share your results on our forum! Furthermore, if you still have alignment problems related to static background - you can describe your situation with photo examples in the same forum thread, so that the community could help you.