**5. Conclusions**

A new fully automated method was developed to successfully detect and delineate mangrove trees and patches in a coastal wetland environment from aerial photography. The introduced framework allows for the selection of the most suitable index images with and without shadow removal for detection and delineation of tree patches. High overall accuracy (>90%) with comparable user's and producer's accuracies in tree detection were obtained by using seven index images (COM, ExG, ExGR, GRB, R-G, TGI, and VDVI). The overlap accuracy of ExG\_s (~95%) was better than GRB\_ns (88%) in patch delineation. Despite having similar proportional area estimates, ExG\_s performed better in separation of tree patches and shadows, and also delineated more trees than GRB\_ns. The selection of optimum parameter values for morphological operations is crucial for the detection of markers for watershed segmentation. MKS of 3 produced the highest overall accuracy across all the index images. The parameter values of opening iterations, dilation iterations, and DTC a ffected marker delineation di fferently, and therefore, their values should be selected based on the index image used for watershed segmentation. The parameter values most e ffective in this study should be used only as an initial starting point when the method is applied in a di fferent geographical setting, because optimal parameter values may change because of either lighting conditions or local contrast changes, which depends on the spatial distribution of trees within the surrounding vegetation matrix.

The shadow removal method had positive and negative e ffects; it increased the overall and the user's accuracy for the majority of models, but also reduced the producer's accuracy. Shadows in images are problematic and need to be dealt with carefully when applying automated delineation methods. To reduce shadow e ffects on the delineation of patches in the future, a more sophisticated algorithm to correct brightness values in shadows instead of removing shadowed areas deserves further study.

This method provides an opportunity to analyze mangrove migration patterns at the scale of isolated individuals and patches. It can be applied to reconstruction of change in mangrove distributions over time, and gain insight into the driving forces of their migration patterns. There is much potential in using widely available high-resolution aerial photography to understand not only mangrove transgression dynamics at the individual tree and patch levels, but also woody vegetation invasion in prairies and other grassland ecosystems.

**Author Contributions:** Conceptualization, K.Z. initiated the idea and H.B., K.Z., D.G., and M.S.R. developed the concept; methodology, K.Z. developed the watershed segmentation and shadow removal methods, D.G. and H.B. developed the methods to perform sensitivity and accuracy analysis; formal analysis, H.B. and D.G. processed images and conducted calculation and analysis; writing—original draft preparation, H.B. and D.G.; writing—review and editing, M.S.R., H.B., and D.G., and K.Z.; visualization, H.B. and D.G. All authors have read and agreed to the published version of the manuscript.

**Funding:** This research received no external funding.

**Acknowledgments:** This material is based upon work supported by the National Science Foundation under Grant No. HRD-1547798. This NSF Grant was awarded to Florida International University as part of the Centers for Research Excellence in Science and Technology (CREST) Program. This is contribution number 970 from the Southeast Environmental Research Center in the Institute of Environment at Florida International University.

**Conflicts of Interest:** The authors declare no conflict of interest.
