Metashape offers the defocus masking feature that can help with improving blurred texture in particular areas of the object. When capturing a scene with depth variability it is common that not all parts of the scene have the same level of sharpness on one image: some areas will be inevitably out of focus. It is suggested that the blurred areas on the images should be excluded from the processing to improve texture quality. The tool described in the current tutorial allows excluding such areas prior to the texture blending procedure by applying the masks automatically to out-of-focus areas.
This function is available in Agisoft Metashape Professional version only, because the algorithm relies on the model's dimensions on a real-world scale. In our example we have created a scale bar between two points (defined by the markers) setting the length for the sword - element that can be measured directly on the real object:
Contents of this article:
To generate a mask for defocus areas
1. Select Generate Masks command from the Mesh submenu from Tools menu. At this point, you should already have a mesh model generated in the active chunk.
2. In Generate Masks dialog select suitable parameters:
- enable "Mask defocus areas" option.
- define Blur threshold parameter.
You can choose Blur Threshold parameter value experimentally, but in most cases, we recommend using the 2 or 3. The Blur threshold parameter defines the allowed blur radius on a photo in pixels:
3. Click OK button when done. The progress dialog box will appear displaying the current processing status. To cancel processing click Cancel button.
In the examples below the images on the left-hand side are original photos, and automatic masks with defocus masking feature were applied to the images on the right-hand side. The illustration demonstrates that the set Blur threshold (it is equal to 3 in our dataset) worked well to mask out the out-of-focus areas on the images (such as griffin's tail), while other parts of the model are not masked. Additionally, the tool automatically masks out the background that is not present in the actual model. The parts of the image covered by the mask appear darker on the preview.
It is important to note that automatic masking uses the reconstructed mesh model, therefore the more detailed model will provide better results.
The tool can be applied to all cameras in the project or only to one or several images specified by the user:
After masks for defocus areas are generated you may proceed to the texture generation via Workflow > Build Texture command.