Crop out the center of images
Usage
uas_cropctr(
x,
crp_h = 10,
crp_w = 10,
dir_out = ".",
out_prefix = "",
out_suffix = "_crp",
overwrite = FALSE,
quiet = FALSE
)
Arguments
- x
A list of class 'uas_info'
- crp_h
Height of the crop box (meters)
- crp_w
Width of the crop box (meters)
- dir_out
The output directory for the cropped images
- out_prefix
A character object that will be pre-pended to output file names
- out_suffix
A character object that will be suffixed to output file names (before the extension)
- overwrite
Overwrite existing files, T/F
- quiet
Suppress messages and printing of the pandoc command line, T/F
Details
This function will crop around the center of a set of images. This can be used to create
a photomosaic. If the photos were taken at nadir (i.e., straight down), the center region of
each photo is often the least distorted. If the images have world files created
for them (see uas_worldfile
), the cropped images will have the world files also.
If the images have been cropped to minimize the amount of overlap between then, and they have
world files, viewing them in GIS software should results in a basic photo mosaic (albeit without
any stitching or blending).
This function requires the command line version of gdal to be installed. For instructions see
http://gdal.org. Windows users can download a gdal installation file (*.msi) from
http://www.gisinternals.com/release.php, install the software, add the installation
directory to the system path (using the Windows Control Panel >> System >> Advanced), and
restart RStudio. To see if it worked, run Sys.which("gdal_translate")
.
If the images were collected in a grid pattern, you can use the average distance between centers as the value for `crp_h`, and the average distance between flight lines for `crp_w`. This will result in cropped images where the edges are just touching. `crp_h` and `crp_w` should be expressed in meters.