The Tsukuba stereo image pair (University of Tsukuba) is a common example in computer vision. In the ragram R package, we use this stereo image pair to demonstrate the calculation of the disparity map.
The tsukuba dataset includes a stack object with two layers (raster objects).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # data(tsukuba)
# plot(tsukuba$layer.1)
# plot(tsukuba$layer.2)
# dispMap <- disparityMap(tsukuba$layer.1, tsukuba$layer.2, window.size = 11, search.area.size=31)
# dispMapHorizontal <- raster(dispMap[,,1])
# extent(dispMapHorizontal) <- extent(tsukuba$layer.1)
# plot(dispMapHorizontal)
# dispMapVertical <- raster(dispMap[,,2])
# extent(dispMapVertical) <- extent(tsukuba$layer.1)
# plot(dispMapVertical)
# dispMapDiagonal <- dispMapLon
# values(dispMapDiagonal) <- sqrt(dispMapHorizontal[]^2 + dispMapVertical[]^2)
# plot(dispMapDiagonal)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.