Skip to contents

Convenience wrapper around [segmenter_tile_engine()] that runs the package's FH segmenter on disk-backed tiles and performs seam-aware merging and global relabeling to produce a single, consistent segmentation raster.

Usage

fh_segmenter_tile(
  x,
  tile_size = 2048,
  buffer = 64,
  seam_thr = 0.7,
  out_file = "fh_tiled_merged.tif",
  tile_dir = tempdir(),
  cleanup_tiles = FALSE,
  cleanup_seg_tiles = FALSE,
  k = 1,
  min_size = 50,
  eight = TRUE,
  scale_bands = TRUE,
  smooth = 0
)

Arguments

x

A `SpatRaster` to segment.

tile_size

Integer. Tile size in pixels (rows/cols) excluding buffer.

buffer

Integer. Overlap (in pixels) added around each tile.

seam_thr

Numeric. Threshold for merging seam-adjacent segments, applied to Euclidean distance between per-segment mean band vectors.

out_file

Character. Output file path for the final segmentation.

tile_dir

Character. Directory used for intermediate tile products.

cleanup_tiles

Logical. If `TRUE`, remove raw image tile files after segmentation.

cleanup_seg_tiles

Logical. If `TRUE`, remove segmented tile files once the final output is produced.

k

Numeric. FH scale parameter controlling the degree of merging (larger values generally yield larger segments).

min_size

Integer. Minimum segment size (in pixels) enforced by FH.

eight

Logical. If `TRUE`, use 8-neighborhood connectivity; otherwise use 4-neighborhood.

scale_bands

Logical. If `TRUE`, standardize bands before segmentation.

smooth

Integer. Optional spatial smoothing window size (in pixels); `0` disables smoothing.

Value

A file-backed `SpatRaster` pointing to `out_file`, containing a 1-layer integer segmentation with globally consecutive IDs.

Details

This function sets `segment_fun = fh_segmenter` and forwards FH parameters through `seg_args` into [segmenter_tile_engine()].

See also

[segmenter_tile_engine()], [fh_segmenter]