Showing posts with label PhotoScan. Show all posts
Showing posts with label PhotoScan. Show all posts

Monday, July 22, 2013

Create cloud masks for aerial photos in batch

Clouds in aerial photos can interfere in the feature identification and matching stages of the ortho-photo rectification process. Depending on the software algorithm, it may be necessary to either remove the entire photo or mask out the cloud portions from the photo. If there are hundreds or thousands of photos with clouds, then it will be very tedious to manually digitize the cloud masks with a photo editing software. It would be nice to have some tool to automate the task somewhat.

Here is a simple procedure of using the free and open source software Imagemagick and the threshold option to generate the cloud masks from the photos. The assumption is that clouds in aerial photos would be brighter than the terrain underneath. An example aerial photo with clouds is shown below.
Photo credit: Kevin Payravi, Wikimedia Commons

  1. In the Windows Command Prompt, type in the following:

    C:/> convert Overview_head_of_cloud_with_shadow.jpg -threshold 40% cloud_mask.png

    Note: the threshold option tells Imagemagick to set pixel values below 40% to 0 (black) and above to white.

    The mask is created.

  2. Optional. In some software, black is the mask so it may be necessary to invert the mask with the following command.

    C:/> convert cloud_mask.png -channel rgba -transparent black -fill black -opaque white -fill white -opaque none -alpha off -define png:color-type=6 cloud_invert_mask.png

    The mask is inverted as RGB file type
Note: if there are bright objects on the ground e.g. river, stream, road, metallic rooftops, then the mask may contain these objects too. It may be necessary to edit the mask to remove these objects.

Monday, May 27, 2013

Optimize aligned aerial photo images tip

Agisoft Photoscan is a software application that can be used for generating orthophoto mosaic images from aerial photographs using structure from motion (SFM) techniques. As part of the procedure of creating orthophotos, the aerial photographs must go through a photo alignment process. Sometimes the alignment process can result in odd orientations; an example is shown below, where the cameras seem oriented at 45 degrees from the horizontal.

It is possible to correct this by running the Optimize command from the Ground Control pane as shown in the screenshot below.

The following dialog will appear when the Optimize command is clicked. Click OK.

Run the Optimize command as many times as required until the orientation appear correct or there is only minor changes in the camera and point cloud. The screenshot below shows the optimized or corrected cameras and point cloud.