Geomatica Focus features the Smart GeoFill tool which allows you to alter aspects in your imagery, such as copying features or terrain elements, or filling an area of interest with content from an overlapping image to replace an unwanted aspect. You can adjust settings for blend width, color balance, contrast, and brightness of the source area to enhance or adjust its appearance in the destination layer.
The following tutorial outlines some common Smart GeoFill workflows: Replacing Values in a Single Image, Replacing Values from Another Image - Cloud Removal, Replacing Values from a Stack of Images, and DEM Ortho Preview with DEM Editor.
There are two video tutorials available on the PCI Geomatics YouTube channel which outlines two Smart GeoFill workflows:
- Single Image Workflow: https://www.youtube.com/watch?v=0bBAIUBNoAY
- Multiple Images Workflow: https://www.youtube.com/watch?v=Bqc4VL987lY
Smart GeoFill can be accessed through the Focus toolbar under the Tools dropdown menu. Information about the Smart GeoFill tool, including the following table is available from the Geomatica Help (Focus > Help > General): Geomatica Help > Focus > Image Processing > Using Smart Geofill
Replacing values in a single image
This workflow replaces pixels in an image with different pixels from the same image. This is useful if you do not have other overlapping images and there is an artifact in your image that needs to be removed. In this example, we will copy pixels from a different part of the image to remove a cloud.
- Open your image in Focus and then open the Smart GeoFill Tool (Tools > Smart GeoFill). We will be replacing the cloud and shadow with different pixels from the same image.
- The Selection Mode button is automatically selected. With this tool selected you can create a polygon around the cloud in the image.
- If you click on the Selection Mode button’s drop-down arrow you will notice there are two options: Copy and Fill. We want to leave this as the default In Fill mode, Smart GeoFill uses the concept of source and destination polygons. That is, you draw a polygon, to define the area you want to fill. This polygon is then designated as the destination polygon. In Copy mode, Smart GeoFill copies the pixels inside the polygon you have drawn (or selected), which you can then paste to suit.
- If you hover over the polygon, your pointer will switch to a four pointed arrow. You can click on the polygon and drag the source (yellow) polygon to choose the pixels that will fill the destination (blue) polygon. Try and choose pixels that are similar to your destination polygon.
- Hide the polygons to check if the edges match. You can check off Blend width box and set a blend value to blend the edge of the destination.
- Once the filled section looks correct you can choose Paste
- I will repeat these steps to remove the corresponding shadow.
- Make sure to save the image once you have made your edits.
Replace values from another image – Cloud removal
This workflow is a very common use for the Smart GeoFill tool. You can fix problem areas in your images by replacing the pixels in the problem area with pixels from a different image. This is particularly useful if you have an image with clouds. You can replace the cloudy section of the image with cloud free pixels from a different image.
- Load the two images into Focus: Original image and cloud free image. In this example pixels from the cloud free image will be copied into the original image to replace the clouds in the original image.
- Select the Original Image in the Focus Maps Tab
- Open the Smart GeoFill tool (Tools > Smart GeoFill)
- The Selection Mode button is automatically selected. With this tool selected you can create a polygon around the clouds in your image. I’m also making sure to create the polygon around the cloud’s shadows.
*Note: You can also import polygons from an existing vector layer. To do this, deselect the selection mode button from the Smart GeoFill window and select the polygon from your vector layer. You may need to click the Selection tool on the Focus toolbar. With the polygon selected, click Import Selected from the Smart GeoFill window.
- The dashed polygon is now visible on the image. In order to copy pixels from another image you will need to change the Smart GeoFill Source In this case we will switch this to Project File Set as we have already loaded the cloud free image into our Focus project.
- You will immediately notice that the pixels inside the polygon have been replaced by pixels from the cloud free image. However, at this point the colors do not match well.
- We can now adjust the colours of the copied pixels to match the original image. In many cases, clicking Automatically apply colour balancing will match the copied pixels. If required you can adjust the contrast and brightness manually using the sliders.
- Before pasting the copied pixels you can turn off the vector to check how the pixels will look when copied. If the edges of the copied section are very obvious you can check off and adjust the Blend width.
- When you are satisfied with the appearance of the copied pixels you can paste them to the original image
- You will want to make sure to save the image so the edits are permanently applied before closing out of the Smart GeoFill window
Replacing values from a stack of images
The Smart GeoFill tool allows you to load multiple images into a file set, draw a polygon and then compare all of the images to select the best pixels to copy.
- Open the image that you wish to edit in Focus and then open the Smart GeoFill tool (Tools > Smart GeoFill).
- Only a single image is loaded into the Focus Files tab.
- In the Smart GeoFill tool switch the Source to Custom File Set.
- The File Selector window will open. Select and open all of the images from your stack.
- You can view all of the images that were added to the Smart GeoFill window from the Source File Set window
- Click the Selection Mode button and draw a polygon around the area you wish to edit
- You will notice that the image selector arrows are available. Also if you open the Source File Set Window again the images that overlap with the polygon will be selected in the Use If there are images you wish to remove from the preview you can uncheck them in this column.
- Use the selector arrows to navigate through each of the available images. As you navigate through the images, each of the images will be added into the Focus Maps tab. You will notice that the pixels in the polygon change to show the new pixels from the selected image. You can then choose which of the available images matches better with the surrounding pixels.
- You can always click the Source Visibility button to view the original pixels.
- Once you have chosen the best image, you can click paste to paste the pixels from the source image into your original image.
- After completing the edit you can click the Reset Selection button to remove the polygon you were using. At this time, all of the source images are removed from the Focus Maps tab. Only the edited destination image remains.
- Make sure to save the image once you have made your edits.
DEM Ortho Preview with DEM Editor
More information available in the help: Focus > Image Processing > Using Smart Geofill > Repairing Imagery > Copying from the Full Res. Ortho Preview window
You would use this tool if you have already generated the mosaic from your orthos and then notice an artifact in your final mosaic that is caused by a problem in the DEM. In this example, the wavy road in the mosaic is caused by an error in the DEM. If much editing of the mosaic has already occurred, it may be very time consuming to fix the DEM, regenerate the problem ortho image and then add it into the final mosaic. Instead you can fix the problem in the DEM and then copy this fixed section of the ortho (available in the ortho preview window) into the mosaic using Smart GeoFill.
This section will include editing the DEM using the DEM Editing Tool. More information on this tool is available from the Live DEM Editing Tutorial
1. DEM Editing - Edit the problem in the DEM
a) Open the DEM and the DEM editor (Layer > DEM Editing). Navigate to the section of the DEM that is causing the problem in the mosaic. In this example this road needs to be fixed in the DEM.
b) In the DEM Editing Setting tab check off Enable Smart Geofill Special Setting and set the 1:1 Pixel size to the Mosaic image’s pixel size (Right-Click mosaic file in Files tab > Properties > Projection).
c) In the DEM Editing window, click Define Preview Region and then draw a rectangle around the AOI. The Full Res. Ortho Preview will open with the AOI displayed.
d) Edit the road in the DEM editor and then regenerate the ortho preview . A polygon is drawn around the road and then a Road Average Filter is applied. Information on editing roads in a DEM is available in Demo 2 and 3 of the DEM Editing tutorial
e) There is another small section above the main road which I will also edit using an Average Filter.
2. Smart GeoFill - Once the section is fixed in the DEM you can copy the fixed section from the Ortho Preview window and paste it into the mosaic using Smart GeoFill tool.
a) With all the DEM editing windows still open, click on the mosaic in the Maps tab and open Smart GeoFill
b) In Smart GeoFill change the Source to DEM Ortho Preview
c) You can either draw a new polygon or import the polygon from DEM editing. To import, select the DEM editing polygon and then click import on the Smart GeoFill window . In this example I will draw a new polygon which covers the main road and small road that I edited above.
d) In Smart Geofill you can choose which fixed ortho to copy into the mosaic
e) You can adjust the Smart Geofill colour balancing settings as required and then paste the new section into the mosaic. Make sure to save the Ortho Mosaic image before closing out of the Smart GeoFill window.