# disparityMap: Calculated disparity map between two SAR records In ragram: Radargrammetry

## Description

Calculates a disparity map between two SAR records using window based zero normalized cross correlation (ZNCC).

## Usage

 ```1 2 3``` ```disparityMap(master, slave, window.size = 3, search.area.size = 7, search.area.shift = c(0, 0), resample.slave = T, window.moving.step = 1, run.parallel = F, cores = 4, log = F, log.file = "dispMapLog.txt") ```

## Arguments

 `master` Object of the `SAR-class` or a subclass (e.g. `Sentinel-class` or `TSX-class`). `slave` Object of the `SAR-class` or a subclass (e.g. `Sentinel-class` or `TSX-class`). `window.size` Integer or vector of integers. Edge Length of quadratic window(s) to calculate `zncc`. Correlation coefficients are multiplied if a vector is provided. `search.area.size` Integer. Edge Length of quadratic search area in slave image. `search.area.shift` Numeric vector. Pixels in x and y direction that the search area should be shifted. That is how a priori knowledge about disparity can be regarded. `resample.slave` Logical. Should the slave image be resampled to the aggregated master image? `window.moving.step` Integer. Step size to move windows in slave image. Default is 1. `run.parallel` Logical. Run algorithm on more than one cores? `cores` Integer. How many cores should be allocated? `log` Logical. Log output to text file? `log.file` Character. Log file address and name.

## Value

Four dimensional array. The first and second dimension give rows and columns, respectively. The third and forth dimension gives disparities in x and y direction. The disparity is measured in pixel.

`zncc`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21``` ```data(kili) master <- aggregate(master, 5) disp.map <- disparityMap(master, slave, window.size=11, search.area.size=25) disp.map.lon <- raster(disp.map[,,1]) extent(disp.map.lon) <- extent(master) plot(disp.map.lon) disp.map.lat <- raster(disp.map[,,2]) extent(disp.map.lat) <- extent(master) plot(disp.map.lat) disp.map.diagonal <- disp.map.lon values(disp.map.diagonal) <- sqrt(disp.map.lat[]^2 + disp.map.lon[]^2) plot(disp.map.diagonal) # to run parallel register cores first, e.g.: # library(doMC) # registerDoMC(4) ```