Digital Hemispherical Photography(DHP)を使った樹冠開空度の解析

このノートの目的

このノートでは、魚眼レンズや全天球カメラで撮影した林内写真から、 「空がどれくらい見えているか(= 樹冠開空度)」を数値化する方法を紹介します。

Note

「魚眼レンズや全天球カメラで撮影した林内写真」は、専門的にはDigital Hemispherical Photography (DHP)と呼ばれます

参考リンク:

まず理解したいポイント

  • 写真の中で「空」と「葉・枝」を分けます(二値化)
  • 空の割合が高いほど、林冠は「開いている」と解釈できます
  • 撮影条件(明るさ、露出、レンズ中心のずれ)で結果が変わるため、前処理が重要です

パッケージのインストールと読み込み

# renvを使用している場合
renv::install("gitlab::fchianucci/hemispheR")

# CRANからインストールする場合
install.packages("hemispheR")

# 開発版をインストールする場合
# install.packages("devtools")
devtools::install_git("https://gitlab.com/fchianucci/hemispheR")
library(hemispheR)
Loading required package: terra
terra 1.9.11

画像の読み込み

image_path <- "data/dhp_example_19rinpan1_2.jpg"
img <- terra::rast(image_path)
Warning: [rast] unknown extent
terra::plotRGB(img) # 元画像を表示

前処理(レンズ中心と半径の指定)

hemispheR::import_fisheye() で、 「どこが魚眼画像の中心か」「どこまでを解析対象にするか(半径)」を指定します。

xc <- dim(img)[2] / 2 # 画像幅の半分
yc <- dim(img)[1] / 2 # 画像高さの半分
rc <- 550 # 解析に使う半径(画像に応じて調整)

image_fisheye <- import_fisheye(
  image_path,
  channel = 3,
  circ.mask = list(xc = xc, yc = yc, rc = rc),
  circular = TRUE,
  gamma = 2.2,
  stretch = FALSE,
  display = TRUE,
  message = TRUE
)
It is a circular fisheye, where xc, yc and radius are 1024, 786, 550

空と樹冠の二値化

hemispheR::binarize_fisheye() で、画像を「空(白)」と「樹冠(黒)」に分けます。 ここでは自動しきい値法の Otsu 法を使います。

img_binary <- binarize_fisheye(
  image_fisheye,
  method = "Otsu",
  zonal = FALSE,
  manual = NULL,
  display = TRUE,
  export = FALSE
)

ギャップ率の解析

gap_frac <- gapfrac_fisheye(
  img_binary,
  maxVZA = 90,
  lens = "equidistant", # デフォルト
  startVZA = 0,
  endVZA = 70,
  nrings = 7,
  nseg = 8,
  display = TRUE,
  message = FALSE
)

樹冠開空度の計算と解釈

canopy <- canopy_fisheye(gap_frac)
canopy
# A tibble: 1 × 20
  id         Le     L    LX  LXG1  LXG2  DIFN MTA.ell     x VZA   rings azimuths
  <chr>   <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>   <dbl> <dbl> <chr> <int>    <int>
1 dhp_ex…  1.69  1.94  0.87  0.66  0.53  30.5      57  1.05 5_15…     7        8
# ℹ 8 more variables: mask <chr>, lens <chr>, channel <chr>, stretch <chr>,
#   gamma <chr>, zonal <chr>, method <chr>, thd <chr>

この出力に含まれる代表値のひとつが DIFN です。 DIFN(diffuse non-interceptance)は、 「拡散光が樹冠に遮られずに通る割合」を表す指標です。

  • 値が高い: 空隙が多く、樹冠が開いている
  • 値が低い: 葉や枝が密で、樹冠が閉じている

References

Chianucci, Francesco, and Martin Macek. 2023. “hemispheR: An r Package for Fisheye Canopy Image Analysis.” Agricultural and Forest Meteorology. https://doi.org/10.1016/j.agrformet.2023.109470.