-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hue (HSV) based snow flagging #28
Comments
A similar test for bartlettir renders no false positives, although the background has snow the trunks limit blue tints and don't trigger flagging. The reverse is true with evergreens which covered with snow turn blue-ish and trigger the snow flagging thresholds on the hue values. # HSV based snow flagging
library(phenocamr)
library(tidyverse)
if(!file.exists(file.path(tempdir(),"bartlettir_DB_1000_1day.csv"))){
download_phenocam(site = "bartlettir",
out_dir = tempdir(),
frequency = 1,
roi_id = 1000)
}
# read data
df <- read.table(file.path(tempdir(),"bartlettir_DB_1000_1day.csv"),
sep = ",",
header = TRUE,
stringsAsFactors = FALSE)
df <- df %>% filter(!is.na(r_mean))
hsv <- rgb2hsv(df$r_mean, df$g_mean, df$b_mean)
df$snow_flag <- ifelse(hsv[1,] > 0.55 & hsv[1,] < 0.97,"snow","no snow")
p <- ggplot(df) +
geom_point(aes(as.Date(date), gcc_90, col = as.factor(snow_flag))) +
theme_minimal()
print(p) |
The same goes for detecting snow on ground, if nothing else is in the way. So for agricultural fields it allows you to detect snow on the ground (since the signal isn't contaminated by stems). # HSV based snow flagging
library(phenocamr)
library(tidyverse)
if(!file.exists(file.path(tempdir(),"arsmorris1_AG_1000_1day.csv"))){
download_phenocam(site = "arsmorris1",
out_dir = tempdir(),
frequency = 1,
roi_id = 1000)
}
# read data
df <- read.table(file.path(tempdir(),"arsmorris1_AG_1000_1day.csv"),
sep = ",",
header = TRUE,
stringsAsFactors = FALSE)
df <- df %>% filter(!is.na(r_mean))
hsv <- rgb2hsv(df$r_mean, df$g_mean, df$b_mean)
df$snow_flag <- ifelse(hsv[1,] > 0.55 & hsv[1,] < 0.97,"snow","no snow")
p <- ggplot(df) +
geom_point(aes(as.Date(date), gcc_90, col = as.factor(snow_flag))) +
theme_minimal()
print(p) |
A Hue based filter performs well in finding images with snow and cloud contamination, even on average daily values across an ROI (no image processing needed).
The text was updated successfully, but these errors were encountered: