Skip to contents

Introduction

This vignette demonstrates the real-photo workflow: loading a raw hemispherical photograph, preprocessing it for gap fraction analysis, and computing solar irradiance metrics. This path is an alternative to the synthetic LiDAR-based fisheye pipeline shown in the introduction vignette.

The bundled photo example-photo.jpg was taken with a Sigma 8mm fisheye lens mounted on a camera body held at breast height under a forest canopy.

Step 1: Load the raw photo

library(gaplightr)
library(imager, warn.conflicts = FALSE)
#> Loading required package: magrittr

img_path <- system.file("extdata", "example-photo.jpg", package = "gaplightr")
img <- imager::load.image(img_path)
plot(img, axes = FALSE, main = "Raw fisheye photo")

Raw hemispherical photograph before preprocessing

Step 2: Preprocess the photo

Real fisheye photos require several preprocessing steps before gap fraction can be extracted. The exact parameters are photo-specific and must be determined visually for each image:

  • Crop: remove the camera body and any non-circular border from the frame
  • Rotate: rotate counterclockwise to align true north to the top
  • Channel extraction: isolate the blue channel, which gives the best contrast between sky and canopy
  • Threshold: convert to a binary sky/canopy mask
# Crop to the circular fisheye area. These pixel bounds are specific to
# example-photo.jpg (2184 x 1456 px) and were determined by visual inspection.
img_crop <- imager::imsub(
  img,
  x %inr% c(372, 1818),
  y %inr% c(2, 1448)
)

# Rotate fisheye 90 degrees so that true north is up. Nearest-neighbour
# interpolation avoids mixing sky and canopy pixel values at boundaries.
img_rotated <- imager::imrotate(img_crop, 90, interpolation = 0)

# Split RGB and keep the blue channel (best contrast)
img_blue <- imager::channel(img_rotated, 3)

# Threshold to produce a binary sky mask using auto-detection. Adjust the
# adjust parameter to fine-tune for a specific photo, or pass a numeric value
# in [0, 1] derived by normalizing an 8-bit threshold: thr = x / 255.
img_thresh <- imager::threshold(img_blue, thr = "auto", adjust = 1)
fisheye <- imager::as.cimg(img_thresh)

plot(fisheye, axes = FALSE, main = "Thresholded fisheye (white = sky)")

Binary sky/canopy mask after thresholding

Save the preprocessed image as a BMP file. BMP is required by gla_process_fisheye_photos().

preprocessed_path <- file.path(tempdir(), "example-photo-preprocessed.bmp")
w <- imager::width(fisheye)
h <- imager::height(fisheye)
grDevices::bmp(
  preprocessed_path,
  width = w,
  height = h,
  units = "px",
  res = 72,
  type = "cairo"
)
graphics::par(mar = c(0, 0, 0, 0))
plot(fisheye, axes = FALSE)
grDevices::dev.off()
#> agg_png 
#>       2

Step 3: Load a point location

gla_load_points() reads a spatial points file, reprojects to match the DEM, and extracts elevation and coordinates. We take a single point and attach the path to the preprocessed fisheye image.

dem_path <- system.file("extdata", "dem.tif", package = "gaplightr")
points_path <- system.file("extdata", "points.geojson", package = "gaplightr")

points <- gla_load_points(points_path, dem_path)
#> Assigning sequential point_id (1 to 3).
points <- points[1, ]
points$fisheye_photo_path <- preprocessed_path

str(points)
#> sf [1 × 8] (S3: sf/tbl_df/tbl/data.frame)
#>  $ elevation         : num 104
#>  $ point_id          : int 1
#>  $ x_meters          : num 1e+06
#>  $ y_meters          : num 5e+05
#>  $ lon               : num -126
#>  $ lat               : num 49.5
#>  $ geometry          :sfc_POINT of length 1; first list element:  'XY' num [1:2] 1e+06 5e+05
#>  $ fisheye_photo_path: chr "/tmp/Rtmp8w7jav/example-photo-preprocessed.bmp"
#>  - attr(*, "sf_column")= chr "geometry"
#>  - attr(*, "agr")= Factor w/ 3 levels "constant","aggregate",..: NA NA NA NA NA NA NA
#>   ..- attr(*, "names")= chr [1:7] "elevation" "point_id" "x_meters" "y_meters" ...

Step 4: Inspect gap fractions

Before computing irradiance, it is useful to inspect the gap fraction grid directly. gla_extract_gap_fraction() maps sky-visible pixels into rings (elevation bands) and sectors (azimuth wedges).

The Sigma 8mm lens uses an equisolid-angle projection rather than the equidistant polar projection assumed by default. gla_lens_sigma_8mm() returns the corresponding radial distortion calibration.

rotation_deg = 16 is the clockwise angular offset between camera orientation and true north for this particular photo.

sigma_cal <- gla_lens_sigma_8mm()

gap_result <- gla_extract_gap_fraction(
  img_file = preprocessed_path,
  elev_res = 5,
  azi_res = 5,
  rotation_deg = 16,
  radial_distortion = sigma_cal
)

gap_result
#> $gap_fraction
#>             [,1]         [,2]        [,3]         [,4]        [,5]       [,6]
#>  [1,] 0.00000000 0.0000000000 0.000000000 0.0000000000 0.000000000 0.00000000
#>  [2,] 0.00000000 0.0000000000 0.000000000 0.0000000000 0.000000000 0.00000000
#>  [3,] 0.00000000 0.0000000000 0.000000000 0.0000000000 0.000000000 0.00000000
#>  [4,] 0.00000000 0.0000000000 0.000000000 0.0005260389 0.002626050 0.00000000
#>  [5,] 0.00000000 0.0005390836 0.005382131 0.0010804970 0.000000000 0.02001082
#>  [6,] 0.00617284 0.0067302299 0.001124859 0.0016825575 0.005053341 0.11840629
#>  [7,] 0.03093397 0.0315664086 0.034564958 0.0475341652 0.079667063 0.43597379
#>  [8,] 0.08045255 0.1035131744 0.101194217 0.3830721003 0.676507538 0.98119122
#>  [9,] 0.33016304 0.4993178718 0.652825051 0.8413886998 1.000000000 1.00000000
#> [10,] 0.98212956 0.9985130112 1.000000000 1.0000000000 1.000000000 1.00000000
#> [11,] 1.00000000 1.0000000000 1.000000000 1.0000000000 1.000000000 1.00000000
#> [12,] 1.00000000 1.0000000000 1.000000000 1.0000000000 1.000000000 1.00000000
#> [13,] 1.00000000 1.0000000000 1.000000000 1.0000000000 1.000000000 1.00000000
#> [14,] 0.96461337 0.9921259843 1.000000000 1.0000000000 1.000000000 0.99472991
#> [15,] 0.71096346 0.9602649007 1.000000000 1.0000000000 1.000000000 1.00000000
#> [16,] 0.83826879 1.0000000000 1.000000000 1.0000000000 1.000000000 1.00000000
#> [17,] 0.89147287 0.9612403101 0.961685824 0.8365758755 0.876447876 0.93822394
#> [18,] 0.49411765 0.4382022472 0.582417582 0.5476190476 0.568181818 0.64444444
#>              [,7]      [,8]        [,9]      [,10]      [,11]      [,12]
#>  [1,] 0.000000000 0.0000000 0.000000000 0.00000000 0.00000000 0.00000000
#>  [2,] 0.000000000 0.0000000 0.000000000 0.00000000 0.00000000 0.00000000
#>  [3,] 0.000000000 0.0000000 0.009169638 0.02352941 0.01017294 0.00000000
#>  [4,] 0.004726891 0.1764706 0.507101526 0.22414698 0.03212217 0.04041995
#>  [5,] 0.168284790 0.8375607 0.914686825 0.35918148 0.07555316 0.22894168
#>  [6,] 0.733970754 0.9994382 0.839125561 0.36987071 0.20157215 0.52554745
#>  [7,] 0.996428571 0.9904932 0.592614652 0.02500000 0.02257873 0.60451306
#>  [8,] 1.000000000 0.9115433 0.768070396 0.18706842 0.28060264 0.84899749
#>  [9,] 1.000000000 0.9686649 0.535690007 0.12269939 0.15064758 0.62118126
#> [10,] 1.000000000 0.9313945 0.561102832 0.38484398 0.19136262 0.35943326
#> [11,] 1.000000000 0.9256536 0.504893964 0.30303030 0.09877551 0.51559934
#> [12,] 1.000000000 0.9990758 0.717996289 0.39796861 0.39851715 0.66203704
#> [13,] 1.000000000 1.0000000 1.000000000 0.93811075 0.68152174 0.04565217
#> [14,] 0.968545216 0.9370904 0.887139108 0.65923984 0.29934641 0.09055118
#> [15,] 1.000000000 0.9602649 0.783471074 0.57048093 0.53973510 0.15702479
#> [16,] 1.000000000 1.0000000 1.000000000 0.99541284 0.92413793 0.85159817
#> [17,] 0.976562500 0.9844961 1.000000000 1.00000000 1.00000000 1.00000000
#> [18,] 0.689655172 0.7159091 0.651685393 0.73255814 0.67045455 0.73404255
#>            [,13]       [,14]       [,15]        [,16]       [,17]      [,18]
#>  [1,] 0.00000000 0.000000000 0.000000000 0.0000000000 0.000000000 0.00000000
#>  [2,] 0.00000000 0.000000000 0.000000000 0.0000000000 0.000000000 0.00000000
#>  [3,] 0.00000000 0.005089059 0.017802645 0.0000000000 0.000000000 0.00000000
#>  [4,] 0.30987395 0.011041009 0.165089380 0.0000000000 0.000000000 0.00000000
#>  [5,] 0.57011866 0.036717063 0.109978541 0.0005396654 0.002701243 0.01025918
#>  [6,] 0.62162162 0.099270892 0.208896396 0.0090242527 0.084317032 0.20753656
#>  [7,] 0.88287753 0.136823319 0.280858676 0.0130486358 0.098692033 0.13285884
#>  [8,] 0.89238515 0.270219436 0.030837004 0.0106382979 0.102322662 0.14554580
#>  [9,] 0.82866894 0.354024557 0.002717391 0.0848153215 0.010217984 0.09078498
#> [10,] 0.95613383 0.312500000 0.097488922 0.1846612063 0.032665182 0.11558538
#> [11,] 0.97555012 0.946078431 0.073492981 0.4840816327 0.035159444 0.07096248
#> [12,] 0.75760369 0.895273401 0.247222222 0.6164510166 0.163888889 0.21574074
#> [13,] 0.11304348 0.411062907 0.377682403 0.3300760043 0.720348205 0.39130435
#> [14,] 0.08366013 0.100917431 0.446357616 0.2052631579 0.826998689 0.30457516
#> [15,] 0.20798669 0.404958678 0.726523888 0.5770491803 0.172185430 0.23013245
#> [16,] 0.86175115 0.981651376 0.988372093 0.8548387097 0.533180778 0.08545035
#> [17,] 1.00000000 1.000000000 1.000000000 0.9883268482 0.914728682 0.70769231
#> [18,] 0.83333333 0.701149425 0.630434783 0.6707317073 0.556818182 0.37362637
#>             [,19]      [,20]      [,21]      [,22]      [,23]       [,24]
#>  [1,] 0.000000000 0.00000000 0.00000000 0.00000000 0.00000000 0.000000000
#>  [2,] 0.000000000 0.00000000 0.00000000 0.00000000 0.00000000 0.000000000
#>  [3,] 0.000000000 0.00000000 0.00000000 0.00000000 0.00000000 0.000000000
#>  [4,] 0.000000000 0.00000000 0.00000000 0.00000000 0.00000000 0.000000000
#>  [5,] 0.008099352 0.00000000 0.00000000 0.00000000 0.00000000 0.000000000
#>  [6,] 0.115039282 0.15816040 0.29471316 0.14189568 0.04042673 0.005611672
#>  [7,] 0.145151695 0.62537225 0.69904648 0.38265003 0.25624257 0.066706373
#>  [8,] 0.101822753 0.59284818 0.43368950 0.24451411 0.08103015 0.070219436
#>  [9,] 0.237771739 0.75852660 0.26548673 0.23417291 0.05381471 0.286490156
#> [10,] 0.510796724 0.60892193 0.11449814 0.33134328 0.36607143 0.122097378
#> [11,] 0.584905660 0.77205882 0.14926591 0.38461538 0.74204082 0.419460343
#> [12,] 0.525830258 0.51851852 0.20609982 0.31881372 0.94717331 0.949121184
#> [13,] 0.115092291 0.20955483 0.30174292 0.23484848 0.79782609 0.964362851
#> [14,] 0.032765400 0.04855643 0.02887139 0.06274510 0.46264744 0.563899868
#> [15,] 0.028239203 0.01158940 0.07781457 0.13245033 0.33993399 0.639072848
#> [16,] 0.036446469 0.08965517 0.16475973 0.29655172 0.20229885 0.659817352
#> [17,] 0.406976744 0.08914729 0.01532567 0.09727626 0.05791506 0.000000000
#> [18,] 0.258823529 0.05617978 0.12087912 0.27380952 0.22727273 0.155555556
#>            [,25]        [,26]       [,27]     [,28]     [,29]      [,30]
#>  [1,] 0.00000000 0.0000000000 0.000000000 0.0000000 0.0000000 0.00000000
#>  [2,] 0.00000000 0.0000000000 0.000000000 0.0000000 0.0000000 0.00000000
#>  [3,] 0.00000000 0.0000000000 0.000000000 0.0000000 0.0000000 0.00000000
#>  [4,] 0.00000000 0.0000000000 0.000000000 0.0000000 0.0000000 0.00000000
#>  [5,] 0.00000000 0.0000000000 0.000000000 0.0000000 0.0000000 0.00000000
#>  [6,] 0.00000000 0.0005617978 0.000000000 0.0000000 0.0000000 0.00000000
#>  [7,] 0.04404762 0.1152703506 0.112567004 0.2011905 0.1871658 0.01781473
#>  [8,] 0.08777429 0.0207026349 0.038340666 0.1594476 0.2944131 0.19298246
#>  [9,] 0.05105514 0.0422343324 0.010876954 0.2794819 0.7123381 0.24032587
#> [10,] 0.06110283 0.0156599553 0.024590164 0.3350669 0.9985108 0.58165548
#> [11,] 0.16816327 0.0098039216 0.008156607 0.5257985 1.0000000 0.95648604
#> [12,] 0.85568918 0.1654343808 0.174397032 0.7820868 0.8850788 0.92222222
#> [13,] 0.97717391 0.7125813449 0.832608696 0.7524430 0.5641304 0.62608696
#> [14,] 0.82830931 0.8125819135 0.914698163 0.9397117 0.8705882 0.41732283
#> [15,] 0.95024876 1.0000000000 1.000000000 1.0000000 1.0000000 1.00000000
#> [16,] 0.72997712 0.8528735632 0.995423341 1.0000000 1.0000000 1.00000000
#> [17,] 0.00000000 0.0155038760 0.135135135 0.2384615 0.5752896 0.76245211
#> [18,] 0.13793103 0.3295454545 0.584269663 0.6744186 0.6590909 0.75531915
#>            [,31]       [,32]        [,33]      [,34]        [,35]       [,36]
#>  [1,] 0.00000000 0.000000000 0.0000000000 0.00000000 0.0000000000 0.000000000
#>  [2,] 0.00000000 0.000000000 0.0000000000 0.00000000 0.0000000000 0.000000000
#>  [3,] 0.00000000 0.000000000 0.0000000000 0.00000000 0.0000000000 0.000000000
#>  [4,] 0.00000000 0.000000000 0.0000000000 0.00000000 0.0000000000 0.000000000
#>  [5,] 0.00000000 0.000000000 0.0000000000 0.00000000 0.0005402485 0.005939525
#>  [6,] 0.00000000 0.002804262 0.1441441441 0.26790750 0.0837549185 0.040494938
#>  [7,] 0.05469679 0.029149316 0.2283840191 0.29952550 0.0992865636 0.060498221
#>  [8,] 0.11579610 0.008777429 0.1850220264 0.22903630 0.1895794099 0.193851945
#>  [9,] 0.04232082 0.010231924 0.0298913043 0.28864569 0.1246594005 0.223208191
#> [10,] 0.04832714 0.019345238 0.0192023634 0.14445272 0.0222717149 0.033557047
#> [11,] 0.30317848 0.030228758 0.0074318745 0.04897959 0.2673753066 0.014681892
#> [12,] 0.64331797 0.104726599 0.0009259259 0.09889094 0.1842592593 0.191666667
#> [13,] 0.48043478 0.416485900 0.1845493562 0.21498371 0.1131664853 0.010869565
#> [14,] 0.24836601 0.277850590 0.4794701987 0.49078947 0.2595019659 0.032679739
#> [15,] 0.96672213 0.778512397 0.8401976936 0.57377049 0.3195364238 0.067880795
#> [16,] 1.00000000 1.000000000 0.8883720930 0.66359447 0.3432494279 0.281755196
#> [17,] 0.92156863 0.968992248 1.0000000000 0.93774319 0.9224806202 0.880769231
#> [18,] 0.69047619 0.804597701 0.9130434783 1.00000000 0.9772727273 0.923076923
#>              [,37]        [,38]        [,39]       [,40]        [,41]
#>  [1,] 0.0000000000 0.0000000000 0.0000000000 0.000000000 0.0000000000
#>  [2,] 0.0000000000 0.0000000000 0.0000000000 0.000000000 0.0000000000
#>  [3,] 0.0000000000 0.0000000000 0.0005099439 0.000000000 0.0005099439
#>  [4,] 0.0010504202 0.0000000000 0.0031512605 0.006838506 0.0000000000
#>  [5,] 0.0005399568 0.0000000000 0.0000000000 0.000000000 0.0005399568
#>  [6,] 0.0016835017 0.0000000000 0.0033745782 0.000000000 0.0028074116
#>  [7,] 0.0107079120 0.0000000000 0.0250297974 0.004159239 0.0017835910
#>  [8,] 0.0270270270 0.0000000000 0.0069138906 0.008777429 0.0012562814
#>  [9,] 0.0067934783 0.0000000000 0.0027229408 0.005445882 0.0265667575
#> [10,] 0.0387192852 0.0007434944 0.0044609665 0.019402985 0.0260416667
#> [11,] 0.0205086136 0.0049019608 0.0000000000 0.000000000 0.0000000000
#> [12,] 0.2564575646 0.0342592593 0.0000000000 0.000000000 0.0000000000
#> [13,] 0.2128121607 0.2236699240 0.0000000000 0.001082251 0.0000000000
#> [14,] 0.0013106160 0.0013123360 0.0000000000 0.010457516 0.0013106160
#> [15,] 0.0066445183 0.0000000000 0.0016556291 0.001655629 0.0676567657
#> [16,] 0.1412300683 0.0666666667 0.0045766590 0.002298851 0.0620689655
#> [17,] 0.8333333333 0.8255813953 0.7931034483 0.828793774 0.8841698842
#> [18,] 0.8941176471 0.8089887640 0.6043956044 0.583333333 0.7500000000
#>             [,42]        [,43]       [,44]       [,45]       [,46]       [,47]
#>  [1,] 0.000000000 0.0000000000 0.000000000 0.000000000 0.000000000 0.000000000
#>  [2,] 0.000000000 0.0000000000 0.000000000 0.000000000 0.000000000 0.000000000
#>  [3,] 0.000000000 0.0000000000 0.000000000 0.000000000 0.000000000 0.000000000
#>  [4,] 0.000000000 0.0000000000 0.004726891 0.069963177 0.003674541 0.007898894
#>  [5,] 0.011357491 0.0000000000 0.021586616 0.560475162 0.695207324 0.196977874
#>  [6,] 0.012345679 0.0000000000 0.170786517 0.436659193 0.789207420 0.337450870
#>  [7,] 0.019058964 0.0000000000 0.190136661 0.326384753 0.591071429 0.120617944
#>  [8,] 0.001253918 0.0006269592 0.007528231 0.153362665 0.122410546 0.200251099
#>  [9,] 0.001357773 0.0006807352 0.019754768 0.409925221 0.110429448 0.104294479
#> [10,] 0.016479401 0.0000000000 0.002982849 0.158718331 0.276374443 0.224125093
#> [11,] 0.044971382 0.0000000000 0.069444444 0.044045677 0.178542179 0.082448980
#> [12,] 0.000000000 0.0000000000 0.003696858 0.006493506 0.091412742 0.029657090
#> [13,] 0.000000000 0.0000000000 0.001084599 0.011956522 0.040173724 0.069565217
#> [14,] 0.000000000 0.0000000000 0.019659240 0.072178478 0.144167759 0.022222222
#> [15,] 0.026490066 0.0049751244 0.041390728 0.082644628 0.081260365 0.011589404
#> [16,] 0.312785388 0.3272311213 0.220689655 0.130434783 0.089449541 0.082758621
#> [17,] 0.942084942 0.9960937500 0.922480620 0.845559846 0.826923077 0.822393822
#> [18,] 0.755555556 0.6666666667 0.534090909 0.438202247 0.267441860 0.272727273
#>             [,48]       [,49]       [,50]       [,51]       [,52]      [,53]
#>  [1,] 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000 0.00000000
#>  [2,] 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000 0.00000000
#>  [3,] 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000 0.00000000
#>  [4,] 0.002099738 0.000000000 0.000000000 0.000000000 0.000000000 0.00000000
#>  [5,] 0.293736501 0.045307443 0.000000000 0.000000000 0.000000000 0.00000000
#>  [6,] 0.448062886 0.010135135 0.068424004 0.129504505 0.156796390 0.01349073
#>  [7,] 0.072446556 0.000000000 0.056513980 0.315444246 0.476868327 0.17479191
#>  [8,] 0.015664160 0.048458150 0.344200627 0.646947766 0.543178974 0.24795982
#>  [9,] 0.205023761 0.087372014 0.145293315 0.169157609 0.255129959 0.16212534
#> [10,] 0.164802386 0.053531599 0.356398810 0.538404727 0.344005957 0.45657016
#> [11,] 0.050903120 0.000000000 0.006535948 0.022295623 0.058775510 0.10956664
#> [12,] 0.020370370 0.000921659 0.000000000 0.001851852 0.009242144 0.03055556
#> [13,] 0.075000000 0.096739130 0.032537961 0.133047210 0.106406080 0.39390642
#> [14,] 0.000000000 0.205228758 0.432503277 0.449006623 0.755263158 0.97509830
#> [15,] 0.001652893 0.016638935 0.337190083 0.645799012 0.877049180 0.98675497
#> [16,] 0.143835616 0.062211982 0.449541284 0.620930233 0.735023041 0.97482838
#> [17,] 0.888888889 0.835294118 0.662790698 0.617424242 0.568093385 0.62790698
#> [18,] 0.287234043 0.285714286 0.126436782 0.086956522 0.060975610 0.13636364
#>            [,54]      [,55]       [,56]      [,57]      [,58]      [,59]
#>  [1,] 0.00000000 0.00000000 0.000000000 0.00000000 0.00000000 0.00000000
#>  [2,] 0.00000000 0.00000000 0.000000000 0.00000000 0.00000000 0.00000000
#>  [3,] 0.00000000 0.00000000 0.000000000 0.00000000 0.00000000 0.00000000
#>  [4,] 0.00000000 0.00000000 0.000000000 0.00000000 0.00000000 0.00000000
#>  [5,] 0.00000000 0.00000000 0.000000000 0.00000000 0.00000000 0.00000000
#>  [6,] 0.00000000 0.00000000 0.000000000 0.00000000 0.00000000 0.00000000
#>  [7,] 0.08244365 0.02022606 0.007742704 0.00000000 0.00000000 0.00000000
#>  [8,] 0.32622334 0.07416719 0.077164366 0.03645506 0.01065831 0.01256281
#>  [9,] 0.39385666 0.48301630 0.521145975 0.11980939 0.14703880 0.30449591
#> [10,] 0.28262491 0.44601638 0.548698885 0.46171004 0.59328358 0.62425595
#> [11,] 0.24306688 0.41181296 0.790849673 0.93964111 0.96399345 0.62938776
#> [12,] 0.07129630 0.45202952 0.973148148 1.00000000 1.00000000 0.99907322
#> [13,] 0.81847826 0.87079262 1.000000000 1.00000000 1.00000000 1.00000000
#> [14,] 1.00000000 1.00000000 1.000000000 1.00000000 1.00000000 1.00000000
#> [15,] 1.00000000 1.00000000 0.993377483 1.00000000 1.00000000 1.00000000
#> [16,] 0.83371824 0.68109339 0.629885057 0.72082380 0.62988506 0.67586207
#> [17,] 0.36538462 0.15503876 0.100775194 0.18773946 0.19844358 0.08494208
#> [18,] 0.08791209 0.05882353 0.179775281 0.13186813 0.08333333 0.21590909
#>            [,60]      [,61]      [,62]      [,63]      [,64]      [,65]
#>  [1,] 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
#>  [2,] 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
#>  [3,] 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
#>  [4,] 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
#>  [5,] 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
#>  [6,] 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
#>  [7,] 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
#>  [8,] 0.01379310 0.10783699 0.18444166 0.12445003 0.03013183 0.06465788
#>  [9,] 0.13577733 0.11436351 0.31539510 0.26920462 0.06748466 0.22290389
#> [10,] 0.25018727 0.09165425 0.59880686 0.43442623 0.37815750 0.52271035
#> [11,] 0.38757155 0.66367347 0.90114379 0.99836868 0.94021294 0.90693878
#> [12,] 0.90101758 0.93802035 1.00000000 1.00000000 0.98891967 0.97775718
#> [13,] 1.00000000 1.00000000 1.00000000 1.00000000 0.99457112 0.96304348
#> [14,] 1.00000000 1.00000000 1.00000000 1.00000000 0.98165138 0.86405229
#> [15,] 1.00000000 1.00000000 1.00000000 1.00000000 0.97346600 0.67218543
#> [16,] 0.91324201 0.71167048 0.73793103 0.89244851 0.52752294 0.30574713
#> [17,] 0.08494208 0.00390625 0.06201550 0.04247104 0.08461538 0.35907336
#> [18,] 0.11111111 0.00000000 0.01136364 0.00000000 0.00000000 0.01136364
#>            [,66]        [,67]      [,68]      [,69]      [,70]        [,71]
#>  [1,] 0.00000000 0.0000000000 0.00000000 0.02875065 0.00000000 0.0000000000
#>  [2,] 0.00000000 0.0000000000 0.00000000 0.00000000 0.00000000 0.0000000000
#>  [3,] 0.00000000 0.0000000000 0.00000000 0.00000000 0.00000000 0.0000000000
#>  [4,] 0.00000000 0.0000000000 0.00000000 0.00000000 0.00000000 0.0000000000
#>  [5,] 0.00000000 0.0000000000 0.00000000 0.00000000 0.00000000 0.0000000000
#>  [6,] 0.00000000 0.0000000000 0.00000000 0.00000000 0.00000000 0.0000000000
#>  [7,] 0.00000000 0.0000000000 0.00000000 0.00000000 0.00000000 0.0005945303
#>  [8,] 0.01065163 0.0006293266 0.00000000 0.00000000 0.01126408 0.0269930948
#>  [9,] 0.15342838 0.0163822526 0.05593452 0.10461957 0.40902873 0.4168937330
#> [10,] 0.55853840 0.0892193309 0.14880952 0.62186115 0.89501117 0.5560504826
#> [11,] 0.94827586 0.2110839446 0.45016340 0.97853014 0.96979592 0.5682747343
#> [12,] 0.89166667 0.0488479263 0.70157553 0.98240741 0.97597043 0.5648148148
#> [13,] 0.60326087 0.0641304348 0.94685466 1.00000000 0.92942454 0.6267682263
#> [14,] 0.28740157 0.3908496732 0.91480996 0.99735099 0.81973684 0.6762778506
#> [15,] 0.15371901 0.8951747088 0.94049587 0.61779242 0.13770492 0.1721854305
#> [16,] 0.87442922 0.9907834101 0.68807339 0.16046512 0.02073733 0.0549199085
#> [17,] 0.55555556 0.6352941176 0.78682171 0.89015152 0.85214008 0.8992248062
#> [18,] 0.07446809 0.1666666667 0.18390805 0.21505376 0.37804878 0.3863636364
#>             [,72]
#>  [1,] 0.000000000
#>  [2,] 0.000000000
#>  [3,] 0.000000000
#>  [4,] 0.000000000
#>  [5,] 0.000000000
#>  [6,] 0.001124859
#>  [7,] 0.004744958
#>  [8,] 0.053952321
#>  [9,] 0.533788396
#> [10,] 0.973154362
#> [11,] 1.000000000
#> [12,] 1.000000000
#> [13,] 0.997826087
#> [14,] 0.827450980
#> [15,] 0.163907285
#> [16,] 0.397228637
#> [17,] 0.957692308
#> [18,] 0.450549451
#> 
#> $total_pixels
#>       [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
#>  [1,] 1903 1908 1904 1907 1905 1910 1902 1907 1904  1907  1905  1902  1909
#>  [2,] 1976 1977 1975 1974 1977 1969 1976 1976 1977  1976  1975  1974  1976
#>  [3,] 1963 1961 1961 1961 1961 1969 1964 1960 1963  1955  1966  1959  1965
#>  [4,] 1904 1900 1904 1901 1904 1904 1904 1904 1901  1905  1899  1905  1904
#>  [5,] 1852 1855 1858 1851 1852 1849 1854 1853 1852  1857  1853  1852  1854
#>  [6,] 1782 1783 1778 1783 1781 1782 1778 1780 1784  1779  1781  1781  1776
#>  [7,] 1681 1679 1678 1683 1682 1679 1680 1683 1679  1680  1683  1684  1682
#>  [8,] 1591 1594 1591 1595 1592 1595 1595 1594 1591  1593  1593  1596  1589
#>  [9,] 1472 1466 1469 1469 1468 1473 1469 1468 1471  1467  1467  1473  1465
#> [10,] 1343 1345 1345 1340 1344 1335 1342 1341 1342  1346  1343  1341  1345
#> [11,] 1219 1224 1226 1222 1225 1223 1225 1224 1226  1221  1225  1218  1227
#> [12,] 1084 1080 1082 1079 1079 1081 1081 1082 1078  1083  1079  1080  1085
#> [13,]  921  921  918  924  920  926  920  922  920   921   920   920   920
#> [14,]  763  762  762  765  763  759  763  763  762   763   765   762   765
#> [15,]  602  604  604  604  606  604  603  604  605   603   604   605   601
#> [16,]  439  435  437  435  435  438  437  435  437   436   435   438   434
#> [17,]  258  258  261  257  259  259  256  258  259   260   259   261   255
#> [18,]   85   89   91   84   88   90   87   88   89    86    88    94    84
#>       [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25]
#>  [1,]  1906  1913  1901  1905  1907  1903  1908  1904  1907  1905  1910  1902
#>  [2,]  1972  1964  1983  1974  1973  1976  1977  1975  1974  1977  1969  1976
#>  [3,]  1965  1966  1960  1964  1961  1963  1961  1961  1961  1961  1969  1964
#>  [4,]  1902  1902  1905  1904  1906  1904  1900  1904  1901  1904  1904  1904
#>  [5,]  1852  1864  1853  1851  1852  1852  1855  1858  1851  1852  1849  1854
#>  [6,]  1783  1776  1773  1779  1778  1782  1783  1778  1783  1781  1782  1778
#>  [7,]  1681  1677  1686  1682  1686  1681  1679  1678  1683  1682  1679  1680
#>  [8,]  1595  1589  1598  1593  1594  1591  1594  1591  1595  1592  1595  1595
#>  [9,]  1466  1472  1462  1468  1465  1472  1466  1469  1469  1468  1473  1469
#> [10,]  1344  1354  1343  1347  1341  1343  1345  1345  1340  1344  1335  1342
#> [11,]  1224  1211  1225  1223  1226  1219  1224  1226  1222  1225  1223  1225
#> [12,]  1079  1080  1082  1080  1080  1084  1080  1082  1079  1079  1081  1081
#> [13,]   922   932   921   919   920   921   921   918   924   920   926   920
#> [14,]   763   755   760   763   765   763   762   762   765   763   759   763
#> [15,]   605   607   610   604   604   602   604   604   604   606   604   603
#> [16,]   436   430   434   437   433   439   435   437   435   435   438   437
#> [17,]   258   264   257   258   260   258   258   261   257   259   259   256
#> [18,]    87    92    82    88    91    85    89    91    84    88    90    87
#>       [,26] [,27] [,28] [,29] [,30] [,31] [,32] [,33] [,34] [,35] [,36] [,37]
#>  [1,]  1907  1904  1907  1905  1902  1909  1906  1913  1901  1905  1907  1903
#>  [2,]  1976  1977  1976  1975  1974  1976  1972  1964  1983  1974  1973  1976
#>  [3,]  1960  1963  1955  1966  1959  1965  1965  1966  1960  1964  1961  1963
#>  [4,]  1904  1901  1905  1899  1905  1904  1902  1902  1905  1904  1906  1904
#>  [5,]  1853  1852  1857  1853  1852  1854  1852  1864  1853  1851  1852  1852
#>  [6,]  1780  1784  1779  1781  1781  1776  1783  1776  1773  1779  1778  1782
#>  [7,]  1683  1679  1680  1683  1684  1682  1681  1677  1686  1682  1686  1681
#>  [8,]  1594  1591  1593  1593  1596  1589  1595  1589  1598  1593  1594  1591
#>  [9,]  1468  1471  1467  1467  1473  1465  1466  1472  1462  1468  1465  1472
#> [10,]  1341  1342  1346  1343  1341  1345  1344  1354  1343  1347  1341  1343
#> [11,]  1224  1226  1221  1225  1218  1227  1224  1211  1225  1223  1226  1219
#> [12,]  1082  1078  1083  1079  1080  1085  1079  1080  1082  1080  1080  1084
#> [13,]   922   920   921   920   920   920   922   932   921   919   920   921
#> [14,]   763   762   763   765   762   765   763   755   760   763   765   763
#> [15,]   604   605   603   604   605   601   605   607   610   604   604   602
#> [16,]   435   437   436   435   438   434   436   430   434   437   433   439
#> [17,]   258   259   260   259   261   255   258   264   257   258   260   258
#> [18,]    88    89    86    88    94    84    87    92    82    88    91    85
#>       [,38] [,39] [,40] [,41] [,42] [,43] [,44] [,45] [,46] [,47] [,48] [,49]
#>  [1,]  1908  1904  1907  1905  1910  1902  1907  1904  1907  1905  1902  1909
#>  [2,]  1977  1975  1974  1977  1969  1976  1976  1977  1976  1975  1974  1976
#>  [3,]  1961  1961  1961  1961  1969  1964  1960  1963  1955  1966  1959  1965
#>  [4,]  1900  1904  1901  1904  1904  1904  1904  1901  1905  1899  1905  1904
#>  [5,]  1855  1858  1851  1852  1849  1854  1853  1852  1857  1853  1852  1854
#>  [6,]  1783  1778  1783  1781  1782  1778  1780  1784  1779  1781  1781  1776
#>  [7,]  1679  1678  1683  1682  1679  1680  1683  1679  1680  1683  1684  1682
#>  [8,]  1594  1591  1595  1592  1595  1595  1594  1591  1593  1593  1596  1589
#>  [9,]  1466  1469  1469  1468  1473  1469  1468  1471  1467  1467  1473  1465
#> [10,]  1345  1345  1340  1344  1335  1342  1341  1342  1346  1343  1341  1345
#> [11,]  1224  1226  1222  1225  1223  1225  1224  1226  1221  1225  1218  1227
#> [12,]  1080  1082  1079  1079  1081  1081  1082  1078  1083  1079  1080  1085
#> [13,]   921   918   924   920   926   920   922   920   921   920   920   920
#> [14,]   762   762   765   763   759   763   763   762   763   765   762   765
#> [15,]   604   604   604   606   604   603   604   605   603   604   605   601
#> [16,]   435   437   435   435   438   437   435   437   436   435   438   434
#> [17,]   258   261   257   259   259   256   258   259   260   259   261   255
#> [18,]    89    91    84    88    90    87    88    89    86    88    94    84
#>       [,50] [,51] [,52] [,53] [,54] [,55] [,56] [,57] [,58] [,59] [,60] [,61]
#>  [1,]  1906  1913  1901  1905  1907  1903  1908  1904  1907  1905  1910  1902
#>  [2,]  1972  1964  1983  1974  1973  1976  1977  1975  1974  1977  1969  1976
#>  [3,]  1965  1966  1960  1964  1961  1963  1961  1961  1961  1961  1969  1964
#>  [4,]  1902  1902  1905  1904  1906  1904  1900  1904  1901  1904  1904  1904
#>  [5,]  1852  1864  1853  1851  1852  1852  1855  1858  1851  1852  1849  1854
#>  [6,]  1783  1776  1773  1779  1778  1782  1783  1778  1783  1781  1782  1778
#>  [7,]  1681  1677  1686  1682  1686  1681  1679  1678  1683  1682  1679  1680
#>  [8,]  1595  1589  1598  1593  1594  1591  1594  1591  1595  1592  1595  1595
#>  [9,]  1466  1472  1462  1468  1465  1472  1466  1469  1469  1468  1473  1469
#> [10,]  1344  1354  1343  1347  1341  1343  1345  1345  1340  1344  1335  1342
#> [11,]  1224  1211  1225  1223  1226  1219  1224  1226  1222  1225  1223  1225
#> [12,]  1079  1080  1082  1080  1080  1084  1080  1082  1079  1079  1081  1081
#> [13,]   922   932   921   919   920   921   921   918   924   920   926   920
#> [14,]   763   755   760   763   765   763   762   762   765   763   759   763
#> [15,]   605   607   610   604   604   602   604   604   604   606   604   603
#> [16,]   436   430   434   437   433   439   435   437   435   435   438   437
#> [17,]   258   264   257   258   260   258   258   261   257   259   259   256
#> [18,]    87    92    82    88    91    85    89    91    84    88    90    87
#>       [,62] [,63] [,64] [,65] [,66] [,67] [,68] [,69] [,70] [,71] [,72]
#>  [1,]  1907  1904  1907  1905  1902  1909  1906  1913  1901  1905  1907
#>  [2,]  1976  1977  1976  1975  1974  1976  1972  1964  1983  1974  1973
#>  [3,]  1960  1963  1955  1966  1959  1965  1965  1966  1960  1964  1961
#>  [4,]  1904  1901  1905  1899  1905  1904  1902  1902  1905  1904  1906
#>  [5,]  1853  1852  1857  1853  1852  1854  1852  1864  1853  1851  1852
#>  [6,]  1780  1784  1779  1781  1781  1776  1783  1776  1773  1779  1778
#>  [7,]  1683  1679  1680  1683  1684  1682  1681  1677  1686  1682  1686
#>  [8,]  1594  1591  1593  1593  1596  1589  1595  1589  1598  1593  1594
#>  [9,]  1468  1471  1467  1467  1473  1465  1466  1472  1462  1468  1465
#> [10,]  1341  1342  1346  1343  1341  1345  1344  1354  1343  1347  1341
#> [11,]  1224  1226  1221  1225  1218  1227  1224  1211  1225  1223  1226
#> [12,]  1082  1078  1083  1079  1080  1085  1079  1080  1082  1080  1080
#> [13,]   922   920   921   920   920   920   922   932   921   919   920
#> [14,]   763   762   763   765   762   765   763   755   760   763   765
#> [15,]   604   605   603   604   605   601   605   607   610   604   604
#> [16,]   435   437   436   435   438   434   436   430   434   437   433
#> [17,]   258   259   260   259   261   255   258   264   257   258   260
#> [18,]    88    89    86    88    94    84    87    93    82    88    91
#> 
#> $gap_pixels
#>       [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
#>  [1,]    0    0    0    0    0    0    0    0    0     0     0     0     0
#>  [2,]    0    0    0    0    0    0    0    0    0     0     0     0     0
#>  [3,]    0    0    0    0    0    0    0    0   18    46    20     0     0
#>  [4,]    0    0    0    1    5    0    9  336  964   427    61    77   590
#>  [5,]    0    1   10    2    0   37  312 1552 1694   667   140   424  1057
#>  [6,]   11   12    2    3    9  211 1305 1779 1497   658   359   936  1104
#>  [7,]   52   53   58   80  134  732 1674 1667  995    42    38  1018  1485
#>  [8,]  128  165  161  611 1077 1565 1595 1453 1222   298   447  1355  1418
#>  [9,]  486  732  959 1236 1468 1473 1469 1422  788   180   221   915  1214
#> [10,] 1319 1343 1345 1340 1344 1335 1342 1249  753   518   257   482  1286
#> [11,] 1219 1224 1226 1222 1225 1223 1225 1133  619   370   121   628  1197
#> [12,] 1084 1080 1082 1079 1079 1081 1081 1081  774   431   430   715   822
#> [13,]  921  921  918  924  920  926  920  922  920   864   627    42   104
#> [14,]  736  756  762  765  763  755  739  715  676   503   229    69    64
#> [15,]  428  580  604  604  606  604  603  580  474   344   326    95   125
#> [16,]  368  435  437  435  435  438  437  435  437   434   402   373   374
#> [17,]  230  248  251  215  227  243  250  254  259   260   259   261   255
#> [18,]   42   39   53   46   50   58   60   63   58    63    59    69    70
#>       [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25]
#>  [1,]     0     0     0     0     0     0     0     0     0     0     0     0
#>  [2,]     0     0     0     0     0     0     0     0     0     0     0     0
#>  [3,]    10    35     0     0     0     0     0     0     0     0     0     0
#>  [4,]    21   314     0     0     0     0     0     0     0     0     0     0
#>  [5,]    68   205     1     5    19    15     0     0     0     0     0     0
#>  [6,]   177   371    16   150   369   205   282   524   253    72    10     0
#>  [7,]   230   471    22   166   224   244  1050  1173   644   431   112    74
#>  [8,]   431    49    17   163   232   162   945   690   390   129   112   140
#>  [9,]   519     4   124    15   133   350  1112   390   344    79   422    75
#> [10,]   420   132   248    44   155   686   819   154   444   492   163    82
#> [11,]  1158    89   593    43    87   713   945   183   470   909   513   206
#> [12,]   966   267   667   177   233   570   560   223   344  1022  1026   925
#> [13,]   379   352   304   662   360   106   193   277   217   734   893   899
#> [14,]    77   337   156   631   233    25    37    22    48   353   428   632
#> [15,]   245   441   352   104   139    17     7    47    80   206   386   573
#> [16,]   428   425   371   233    37    16    39    72   129    88   289   319
#> [17,]   258   264   254   236   184   105    23     4    25    15     0     0
#> [18,]    61    58    55    49    34    22     5    11    23    20    14    12
#>       [,26] [,27] [,28] [,29] [,30] [,31] [,32] [,33] [,34] [,35] [,36] [,37]
#>  [1,]     0     0     0     0     0     0     0     0     0     0     0     0
#>  [2,]     0     0     0     0     0     0     0     0     0     0     0     0
#>  [3,]     0     0     0     0     0     0     0     0     0     0     0     0
#>  [4,]     0     0     0     0     0     0     0     0     0     0     0     2
#>  [5,]     0     0     0     0     0     0     0     0     0     1    11     1
#>  [6,]     1     0     0     0     0     0     5   256   475   149    72     3
#>  [7,]   194   189   338   315    30    92    49   383   505   167   102    18
#>  [8,]    33    61   254   469   308   184    14   294   366   302   309    43
#>  [9,]    62    16   410  1045   354    62    15    44   422   183   327    10
#> [10,]    21    33   451  1341   780    65    26    26   194    30    45    52
#> [11,]    12    10   642  1225  1165   372    37     9    60   327    18    25
#> [12,]   179   188   847   955   996   698   113     1   107   199   207   278
#> [13,]   657   766   693   519   576   442   384   172   198   104    10   196
#> [14,]   620   697   717   666   318   190   212   362   373   198    25     1
#> [15,]   604   605   603   604   605   581   471   510   350   193    41     4
#> [16,]   371   435   436   435   438   434   436   382   288   150   122    62
#> [17,]     4    35    62   149   199   235   250   264   241   238   229   215
#> [18,]    29    52    58    58    71    58    70    84    82    86    84    76
#>       [,38] [,39] [,40] [,41] [,42] [,43] [,44] [,45] [,46] [,47] [,48] [,49]
#>  [1,]     0     0     0     0     0     0     0     0     0     0     0     0
#>  [2,]     0     0     0     0     0     0     0     0     0     0     0     0
#>  [3,]     0     1     0     1     0     0     0     0     0     0     0     0
#>  [4,]     0     6    13     0     0     0     9   133     7    15     4     0
#>  [5,]     0     0     0     1    21     0    40  1038  1291   365   544    84
#>  [6,]     0     6     0     5    22     0   304   779  1404   601   798    18
#>  [7,]     0    42     7     3    32     0   320   548   993   203   122     0
#>  [8,]     0    11    14     2     2     1    12   244   195   319    25    77
#>  [9,]     0     4     8    39     2     1    29   603   162   153   302   128
#> [10,]     1     6    26    35    22     0     4   213   372   301   221    72
#> [11,]     6     0     0     0    55     0    85    54   218   101    62     0
#> [12,]    37     0     0     0     0     0     4     7    99    32    22     1
#> [13,]   206     0     1     0     0     0     1    11    37    64    69    89
#> [14,]     1     0     8     1     0     0    15    55   110    17     0   157
#> [15,]     0     1     1    41    16     3    25    50    49     7     1    10
#> [16,]    29     2     1    27   137   143    96    57    39    36    63    27
#> [17,]   213   207   213   229   244   255   238   219   215   213   232   213
#> [18,]    72    55    49    66    68    58    47    39    23    24    27    24
#>       [,50] [,51] [,52] [,53] [,54] [,55] [,56] [,57] [,58] [,59] [,60] [,61]
#>  [1,]     0     0     0     0     0     0     0     0     0     0     0     0
#>  [2,]     0     0     0     0     0     0     0     0     0     0     0     0
#>  [3,]     0     0     0     0     0     0     0     0     0     0     0     0
#>  [4,]     0     0     0     0     0     0     0     0     0     0     0     0
#>  [5,]     0     0     0     0     0     0     0     0     0     0     0     0
#>  [6,]   122   230   278    24     0     0     0     0     0     0     0     0
#>  [7,]    95   529   804   294   139    34    13     0     0     0     0     0
#>  [8,]   549  1028   868   395   520   118   123    58    17    20    22   172
#>  [9,]   213   249   373   238   577   711   764   176   216   447   200   168
#> [10,]   479   729   462   615   379   599   738   621   795   839   334   123
#> [11,]     8    27    72   134   298   502   968  1152  1178   771   474   813
#> [12,]     0     2    10    33    77   490  1051  1082  1079  1078   974  1014
#> [13,]    30   124    98   362   753   802   921   918   924   920   926   920
#> [14,]   330   339   574   744   765   763   762   762   765   763   759   763
#> [15,]   204   392   535   596   604   602   600   604   604   606   604   603
#> [16,]   196   267   319   426   361   299   274   315   274   294   400   311
#> [17,]   171   163   146   162    95    40    26    49    51    22    22     1
#> [18,]    11     8     5    12     8     5    16    12     7    19    10     0
#>       [,62] [,63] [,64] [,65] [,66] [,67] [,68] [,69] [,70] [,71] [,72]
#>  [1,]     0     0     0     0     0     0     0    55     0     0     0
#>  [2,]     0     0     0     0     0     0     0     0     0     0     0
#>  [3,]     0     0     0     0     0     0     0     0     0     0     0
#>  [4,]     0     0     0     0     0     0     0     0     0     0     0
#>  [5,]     0     0     0     0     0     0     0     0     0     0     0
#>  [6,]     0     0     0     0     0     0     0     0     0     0     2
#>  [7,]     0     0     0     0     0     0     0     0     0     1     8
#>  [8,]   294   198    48   103    17     1     0     0    18    43    86
#>  [9,]   463   396    99   327   226    24    82   154   598   612   782
#> [10,]   803   583   509   702   749   120   200   842  1202   749  1305
#> [11,]  1103  1224  1148  1111  1155   259   551  1185  1188   695  1226
#> [12,]  1082  1078  1071  1055   963    53   757  1061  1056   610  1080
#> [13,]   922   920   916   886   555    59   873   932   856   576   918
#> [14,]   763   762   749   661   219   299   698   753   623   516   633
#> [15,]   604   605   587   406    93   538   569   375    84   104    99
#> [16,]   321   390   230   133   383   430   300    69     9    24   172
#> [17,]    16    11    22    93   145   162   203   235   219   232   249
#> [18,]     1     0     0     1     7    14    16    20    31    34    41
#> 
#> $nRings
#> [1] 18
#> 
#> $nSectors
#> [1] 72

Step 5: Compute solar irradiance

gla_process_fisheye_photos() integrates gap fractions with the solar geometry model to produce canopy openness and irradiance metrics. We use Julian days 172-182 (around the summer solstice) with a coarser time step to keep computation fast.

results <- gla_process_fisheye_photos(
  points = points,
  clearsky_coef = 0.65,
  time_step_min = 10,
  day_start = 172,
  day_end = 182,
  day_res = 2,
  elev_res = 5,
  azi_res = 5,
  Kt = 0.54,
  rotation_deg = 16,
  radial_distortion = sigma_cal,
  parallel = FALSE
)
#> Processing 1 fisheye photos for solar radiation...
#> Completed processing 1 fisheye photos

str(results[, c(
  "canopy_openness_pct",
  "transmitted_global_irradiation_MJm2d",
  "light_penetration_index"
)])
#> sf [1 × 4] (S3: sf/tbl_df/tbl/data.frame)
#>  $ canopy_openness_pct                 : num 20.7
#>  $ transmitted_global_irradiation_MJm2d: num 5.83
#>  $ light_penetration_index             : num 0.259
#>  $ geometry                            :sfc_POINT of length 1; first list element:  'XY' num [1:2] 1e+06 5e+05
#>  - attr(*, "sf_column")= chr "geometry"
#>  - attr(*, "agr")= Factor w/ 3 levels "constant","aggregate",..: NA NA NA
#>   ..- attr(*, "names")= chr [1:3] "canopy_openness_pct" "transmitted_global_irradiation_MJm2d" "light_penetration_index"

Next steps

For a batch of real photos, create an sf object with one row per photo and set fisheye_photo_path to the preprocessed BMP path for each row. The same gla_process_fisheye_photos() call then processes all points.