Title: | Identifying Foggy and Cloudy Images by Quantifying Haziness |
---|---|
Description: | Provides a set of functions to estimate haziness of an image based on RGB bands. It returns a haze factor, varying from 0 to 1, a metric for fogginess and cloudiness. The package also presents additional functions to estimate brightness, darkness and contrast rasters of the RGB image. This package can be used for several applications such as inference of weather quality data and performing environmental studies from interpreting digital images. |
Authors: | Bijan Seyednasrollah |
Maintainer: | Bijan Seyednasrollah <[email protected]> |
License: | AGPL-3 | file LICENSE |
Version: | 1.1.1 |
Built: | 2024-11-09 04:38:02 UTC |
Source: | https://github.com/cran/hazer |
The brighness map of an image (0 to 1).
getBrightness(rgbArray)
getBrightness(rgbArray)
rgbArray |
RGB array (W x H x 3) where the third dimension contains R, G and B channels, values varying from 0 to 1. |
a numeric matrix (W x H) giving the brightness for each pixel of the image.
getDarkness
, getContrast
and getHazeFactor
library(jpeg) img <- readJPEG(system.file("img", "Rlogo.jpg", package="jpeg")) b <- getBrightness(img) par(mfrow=c(2,1), mar = c(0.5, 1, 0.5, 1)) plotRGBArray(img) plotRGBArray(b)
library(jpeg) img <- readJPEG(system.file("img", "Rlogo.jpg", package="jpeg")) b <- getBrightness(img) par(mfrow=c(2,1), mar = c(0.5, 1, 0.5, 1)) plotRGBArray(img) plotRGBArray(b)
The contrast map of an image (0 to 1).
getContrast(rgbArray)
getContrast(rgbArray)
rgbArray |
RGB array (W x H x 3) where the third dimension contains R, G and B channels, values varying from 0 to 1. |
a numeric matrix (W x H) giving the contrast for each pixel of the image.
getDarkness
, getBrightness
and getHazeFactor
library(jpeg) img <- readJPEG(system.file("img", "Rlogo.jpg", package="jpeg")) c <- getContrast(img) par(mfrow=c(2,1), mar = c(0.5, 1, 0.5, 1)) plotRGBArray(img) plotRGBArray(c)
library(jpeg) img <- readJPEG(system.file("img", "Rlogo.jpg", package="jpeg")) c <- getContrast(img) par(mfrow=c(2,1), mar = c(0.5, 1, 0.5, 1)) plotRGBArray(img) plotRGBArray(c)
The darkness map of an image (0 to 1).
getDarkness(rgbArray)
getDarkness(rgbArray)
rgbArray |
RGB array (W x H x 3) where the third dimension contains R, G and B channels, values varying from 0 to 1. |
a numeric matrix (W x H) giving the darkness for each pixel of the image.
getContrast
, getBrightness
and getHazeFactor
library(jpeg) img <- readJPEG(system.file("img", "Rlogo.jpg", package="jpeg")) d <- getDarkness(img) par(mfrow=c(2,1), mar = c(0.5, 1, 0.5, 1)) plotRGBArray(img) plotRGBArray(d)
library(jpeg) img <- readJPEG(system.file("img", "Rlogo.jpg", package="jpeg")) d <- getDarkness(img) par(mfrow=c(2,1), mar = c(0.5, 1, 0.5, 1)) plotRGBArray(img) plotRGBArray(d)
The haze factor for a given RGB array.
getHazeFactor(rgbArray, mu = 5.1, nu = 2.9, sigma = 0.2461)
getHazeFactor(rgbArray, mu = 5.1, nu = 2.9, sigma = 0.2461)
rgbArray |
RGB array (W x H x 3) where the third dimension contains R, G and B channels, values varying from 0 to 1. |
mu |
function parameter |
nu |
function parameter |
sigma |
function parameter |
a list of two numeric values:haze as haze degree and A0 as the global atmospheric light
getDarkness
, getBrightness
and getContrast
library(jpeg) img <- readJPEG(system.file("img", "Rlogo.jpg", package="jpeg")) h <- getHazeFactor(img) d <- getDarkness(img) b <- getBrightness(img) c <- getContrast(img) par(mfcol = c(2, 2), mar = c(0.5, 0.5, 0.5, 0.5)) plotRGBArray(img) mtext(text = 'RGB', side = 3, line = -2, adj = 0.05, font = 2, col = 'red') mtext(text = paste0('Hazeness: ', signif(h$haze, 2)), side = 1, line = -2, adj = 0.05) mtext(text = paste0('A0: ', signif(h$A0, 2)), side = 1, line = -1, adj = 0.05) plotRGBArray(d) mtext(text = 'Darkness', side = 3, line = -2, adj = 0.05, font = 2, col = 'red') plotRGBArray(b) mtext(text = 'Brightness', side = 3, line = -2, adj = 0.05, font = 2, col = 'red') plotRGBArray(c) mtext(text = 'Contrast', side = 3, line = -2, adj = 0.05, font = 2, col = 'red')
library(jpeg) img <- readJPEG(system.file("img", "Rlogo.jpg", package="jpeg")) h <- getHazeFactor(img) d <- getDarkness(img) b <- getBrightness(img) c <- getContrast(img) par(mfcol = c(2, 2), mar = c(0.5, 0.5, 0.5, 0.5)) plotRGBArray(img) mtext(text = 'RGB', side = 3, line = -2, adj = 0.05, font = 2, col = 'red') mtext(text = paste0('Hazeness: ', signif(h$haze, 2)), side = 1, line = -2, adj = 0.05) mtext(text = paste0('A0: ', signif(h$A0, 2)), side = 1, line = -1, adj = 0.05) plotRGBArray(d) mtext(text = 'Darkness', side = 3, line = -2, adj = 0.05, font = 2, col = 'red') plotRGBArray(b) mtext(text = 'Brightness', side = 3, line = -2, adj = 0.05, font = 2, col = 'red') plotRGBArray(c) mtext(text = 'Contrast', side = 3, line = -2, adj = 0.05, font = 2, col = 'red')
Plotting an RGB array on the graphics.
plotRGBArray(rgbArray, xlim = c(0, 1), ylim = c(0, 1), ...)
plotRGBArray(rgbArray, xlim = c(0, 1), ylim = c(0, 1), ...)
rgbArray |
RGB array (W x H x 3) where the third dimension contains R, G and B channels, values varying from 0 to 1. |
xlim |
range of the x axis. |
ylim |
range of the y axis. |
... |
graphical parameters passed to the plot function |
a rasterImage output plotted on the base R graphics.
plotRGBArray
wraps the graphics::rasterImage
function
library(jpeg) img <- readJPEG(system.file("img", "Rlogo.jpg", package="jpeg")) plotRGBArray(img)
library(jpeg) img <- readJPEG(system.file("img", "Rlogo.jpg", package="jpeg")) plotRGBArray(img)