knitr::opts_chunk$set( fig.width = 7, fig.height = 4 )
library(imager) library(data.table) library(ggplot2) library(visDec) library(foreach) library(iterators) library(doParallel) registerDoParallel(cores=2)
path <- system.file("extdata/Meetterrein", package="visDec") filenames <- list.files(path, pattern=glob2rx("Meetterrein_201510*.jpg"), full.names=TRUE) #```r imageSummary <- foreach(file = iter(filenames), .combine = rbind) %dopar% { FileNameParser(file, "na*me_yyyymmdd_hhmm.jpg") }
properties <- fread(system.file("extdata/properties.csv", package="visDec")) setkey(imageSummary, filePrefix, dateTime) imageSummary <- merge(imageSummary, properties, by.x = "filePrefix", by.y = "filePrefix") daylightImages <- imageSummary[IsDayLightImage(dateTime, lon, lat), ]
invisible(daylightImages[, id := 1:.N]) setkey(daylightImages, id) imageFeatures <- foreach(id = iter(daylightImages[, id]), .combine = rbind) %dopar% { daylightImages[id, ImageFeatures(filePath, y > 16)] }
setkey(daylightImages, filePath) setkey(imageFeatures, filePath) imageSummary <- merge(daylightImages, imageFeatures)
im <- subim(load.image(filenames[75]), y > 16) old_par <- par(mfrow=c(1,2)) plot(im) DetectEdges(im) %>% plot par(old_par)
im <- subim(load.image(filenames[49]), y > 16) old_par <- par(mfrow=c(1,2)) plot(im) DetectEdges(im) %>% plot par(old_par)
path <- system.file("extdata/Sensor", package="visDec") sensorFiles <- list.files(path, pattern=glob2rx("DeBilt*.csv"), full.names=TRUE) sensorData <- ReadMORSensorData(sensorFiles) setkey(sensorData, dateTime) setkey(imageSummary, dateTime) imageSummary <- merge(imageSummary, sensorData) invisible(imageSummary[, MOR := TOA.MOR_10]) # see .e.g https://github.com/rstudio/rmarkdown/issues/829
ggplot(imageSummary, aes(x = dateTime, y = mean_edge)) + geom_line() + xlab("") ggplot(imageSummary, aes(x = dateTime, y= MOR)) + geom_line() + xlab("") ggplot(imageSummary, aes(x = dateTime, y = fractal_dim)) + geom_line() + xlab("")
ggplot(imageSummary[hour(dateTime) %in% seq(5, 10, by=1), ], aes(x = dateTime, y = mean_edge)) + geom_line() + xlab("") ggplot(imageSummary[hour(dateTime) %in% seq(5, 10, by=1), ], aes(x = dateTime, y = fractal_dim)) + geom_line() + xlab("")
invisible(imageSummary[, visibility := factor(2000)]) invisible(imageSummary[MOR < 1000, visibility := factor(1000)]) invisible(imageSummary[MOR < 500, visibility := factor(500)]) invisible(imageSummary[MOR < 200, visibility := factor(200)]) #ggplot(imageSummary[hour %in% seq(7, 16, by = 1), ], aes(x = log(FS261), y = meanEdge, col = visibility)) + geom_point() + geom_quantile(aes(col=NULL), quantiles=0.5) ggplot(imageSummary[hour %in% seq(7, 16, by = 1), ], aes(x = log(MOR), y = mean_edge, col = visibility)) + geom_point() + geom_quantile(aes(col=NULL), quantiles=0.5) ggplot(imageSummary[hour %in% seq(7, 16, by = 1), ], aes(x = log(MOR), y = change_point, col = visibility)) + geom_point() + geom_quantile(aes(col=NULL), quantiles=0.5) ggplot(imageSummary[hour %in% seq(7, 16, by = 1), ], aes(x = log(MOR), y = smoothness, col = visibility)) + geom_point() + geom_quantile(aes(col=NULL), quantiles=0.5) ggplot(imageSummary[hour %in% seq(7, 16, by = 1), ], aes(x = log(MOR), y = fractal_dim, col = visibility)) + geom_point() + geom_quantile(aes(col=NULL), quantiles=0.5) ggplot(imageSummary[hour %in% seq(7, 16, by = 1), ], aes(x = log(MOR), y = mean_hue, col = visibility)) + geom_point() + geom_quantile(aes(col=NULL), quantiles=0.5) ggplot(imageSummary[hour %in% seq(7, 16, by = 1), ], aes(x = log(MOR), y = mean_saturation, col = visibility)) + geom_point() + geom_quantile(aes(col=NULL), quantiles=0.5) ggplot(imageSummary[hour %in% seq(7, 16, by = 1), ], aes(x = log(MOR), y = mean_brightness, col = visibility)) + geom_point() + geom_quantile(aes(col=NULL), quantiles=0.5) ggplot(imageSummary[hour %in% seq(7, 16, by = 1), ], aes(x = log(MOR), y = mean_transmission, col = visibility)) + geom_point() + geom_quantile(aes(col=NULL), quantiles=0.5)
stopImplicitCluster()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.