Skip to content

Commit

Permalink
issues with package building solved
Browse files Browse the repository at this point in the history
  • Loading branch information
detsutut committed Sep 15, 2020
1 parent a266663 commit f40cccb
Show file tree
Hide file tree
Showing 9 changed files with 238 additions and 60 deletions.
23 changes: 9 additions & 14 deletions chromaR/DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,15 @@ Maintainer: Tommaso Buonocore <[email protected]>
Description: R toolkit to analyze and explore chromatic storytelling in any video source
in any video source, previously converted in a csv sequence of frames.
Imports:
dplyr,
stringr,
ggplot2,
corrplot,
Hmisc,
grid,
gridExtra,
plotwidgets,
circlize,
jpeg,
scales,
imager,
LICORS,
grDevices
utils,
tools,
ggplot2,
graphics,
plotwidgets,
circlize,
imager,
grDevices,
LICORS
License: file LICENSE
Encoding: UTF-8
LazyData: true
Expand Down
21 changes: 8 additions & 13 deletions chromaR/NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,11 @@ export(plotTimeWindows)
export(satOnly)
export(temperature)
export(vividHex)
import(Hmisc)
import(circlize)
import(corrplot)
import(dplyr)
import(ggplot2)
import(grDevices)
import(graphics)
import(grid)
import(gridExtra)
import(jpeg)
import(plotwidgets)
import(scales)
import(stats)
import(stringr)
import(utils)
importFrom(LICORS,kmeanspp)
importFrom(circlize,chordDiagram)
importFrom(circlize,circos.clear)
importFrom(grDevices,convertColor)
importFrom(grDevices,rgb)
importFrom(imager,B)
Expand All @@ -48,3 +37,9 @@ importFrom(imager,height)
importFrom(imager,load.image)
importFrom(imager,resize)
importFrom(imager,width)
importFrom(plotwidgets,col2hsl)
importFrom(plotwidgets,hsl2col)
importFrom(plotwidgets,modCol)
importFrom(tools,file_path_sans_ext)
importFrom(utils,choose.files)
importFrom(utils,read.csv)
41 changes: 19 additions & 22 deletions chromaR/R/colors.R
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
#' @import utils
#' @import stats
#' @import graphics
#' @import ggplot2
#' @import dplyr
#' @import stringr
#' @import plotwidgets
#' @import gridExtra
#' @import grid
#' @import corrplot
#' @import Hmisc
#' @import circlize
#' @import jpeg
#' @import scales
#' @import grDevices

NULL

Expand Down Expand Up @@ -47,6 +34,7 @@ luminance <- function(r,g,b){
#' print("example")
#'
#' @export
#' @importFrom plotwidgets modCol
vividHex <- function(hexString, intensity = c("light","medium","strong","ultra")){
darkIntensity <- switch(EXPR=intensity,light = .05,medium = .1,strong =.2, ultra =.3)
satIntensity <- switch(EXPR=intensity,light = .1,medium = .2,strong =.3, ultra =.4)
Expand All @@ -65,6 +53,7 @@ vividHex <- function(hexString, intensity = c("light","medium","strong","ultra")
#' print("example")
#'
#' @export
#' @importFrom plotwidgets modCol
lumOnly <- function(hexString){
return(modCol(hexString, darken = 0, saturate = -1, modhue = 0))
}
Expand All @@ -81,6 +70,7 @@ lumOnly <- function(hexString){
#' print("example")
#'
#' @export
#' @importFrom plotwidgets hsl2col
hueOnly <- function(hexString){
return(hsl2col(as.matrix(c(hslGet(hexString,"h"),1,0.5))))
}
Expand All @@ -98,6 +88,7 @@ hueOnly <- function(hexString){
#' print("example")
#'
#' @export
#' @importFrom plotwidgets hsl2col
satOnly <- function(hexString){
return(hsl2col(as.matrix(c(1,hslGet(hexString,"s"),0.5))))
}
Expand All @@ -115,6 +106,7 @@ satOnly <- function(hexString){
#' print("example")
#'
#' @export
#' @importFrom plotwidgets col2hsl
hslGet <- function(hexString, channel=c("H","S","V")){
values <- list()
for(hex in hexString){
Expand All @@ -135,6 +127,7 @@ hslGet <- function(hexString, channel=c("H","S","V")){
#' print("example")
#'
#' @export
#' @importFrom plotwidgets col2hsl
isWarm <- function(hexString){
hue <- col2hsl(hexString)["H",][[1]]
sat <- col2hsl(hexString)["S",][[1]]
Expand Down Expand Up @@ -162,6 +155,8 @@ isWarm <- function(hexString){
#' print("example")
#'
#' @export
#' @importFrom circlize chordDiagram
#' @importFrom circlize circos.clear
colorCircle <- function(frames, extra = FALSE){
palette <- chromaRenv$colorHueRef
if(extra) palette <- chromaRenv$colorHueRefExtra
Expand All @@ -188,6 +183,7 @@ colorCircle <- function(frames, extra = FALSE){
#' print("example")
#'
#' @export
#' @importFrom plotwidgets col2hsl
getHueRef <- function(hexString, extra = FALSE){
palette <- chromaRenv$colorHueRef
if(extra) palette <- chromaRenv$colorHueRefExtra
Expand Down Expand Up @@ -363,11 +359,12 @@ plotFrameline <- function(frames, verbose = 0, summary = TRUE, vivid = FALSE, ti
#'
#' plotTimeWindows
#'
#' @param left frames
#' @param verbose frames
#' @param vivid frames
#' @param title frames
#' @param subtitle frames
#' @param left left
#' @param frames frames
#' @param verbose verbose
#' @param vivid vivid
#' @param title title
#' @param subtitle subtitle
#'
#' @return none
#'
Expand Down Expand Up @@ -684,10 +681,10 @@ theme_semiVoid <- function(xaxis = FALSE){
#'
#' extractFramePalette
#'
#' @param jpegFramePath jpegFramePath
#' @param paletteDim paletteDim
#' @param title title
#' @param subtitle subtitle
#' @param img_path img_path
#' @param palette_dim palette_dim
#' @param max_res max_res
#' @param graphics graphics
#'
#' @return none
#'
Expand Down
7 changes: 6 additions & 1 deletion chromaR/R/parsing.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@
#' print("example")
#'
#' @export
#' @importFrom utils choose.files
#' @importFrom utils read.csv
#' @importFrom tools file_path_sans_ext
#' @importFrom grDevices rgb
getFrames <- function(paths=c(NULL),names=c(NULL),orderBySeason=FALSE){
#=================================================
#= 1 - retrieve files and names =
#=================================================
if((Sys.info()['sysname']=="Windows")&(length(paths)==0)){
paths <- choose.files(caption = "Select files",multi = TRUE, #get file paths
paths <- utils::choose.files(caption = "Select files",multi = TRUE, #get file paths
filters = matrix(c("All files","*.*","Csv files","*.csv"),
ncol = 2, byrow = TRUE ))
} else {
Expand Down Expand Up @@ -64,6 +68,7 @@ getFrames <- function(paths=c(NULL),names=c(NULL),orderBySeason=FALSE){
#' print("example")
#'
#' @export
#' @importFrom grDevices rgb
groupframes <- function(frames,seconds=NULL,fps=chromaRenv$fps){
if(is.null(seconds)) {
seconds <- round(length(frames$frameId)/(fps*chromaRenv$linesize$bold))
Expand Down
2 changes: 1 addition & 1 deletion chromaR/chromaR.Rproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ StripTrailingWhitespace: Yes
BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
PackageCheckArgs: --as-cran
PackageBuildArgs: --resave-data
8 changes: 4 additions & 4 deletions chromaR/man/extractFramePalette.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 57 additions & 0 deletions chromaR/man/matrix.Rd
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
\name{matrix}
\alias{matrix}
\docType{data}
\title{
matrix
}
\description{
description
}
\usage{data("matrix")}
\format{
The format is:
List of 3
$ :'data.frame': 196160 obs. of 6 variables:
..$ R : num [1:196160] 0 0 0 0 0 0 0 0 0 0 ...
..$ G : num [1:196160] 0 0 0 0 0 0 0 0 0 0 ...
..$ B : num [1:196160] 0 0 0 0 0 0 0 0 0 0 ...
..$ hex : chr [1:196160] "#000000" "#000000" "#000000" "#000000" ...
..$ lum : num [1:196160] 0 0 0 0 0 0 0 0 0 0 ...
..$ frameId: int [1:196160] 1 2 3 4 5 6 7 8 9 10 ...
..- attr(*, "avgRGB")= chr "#292A22"
..- attr(*, "title")= chr "s1e1"
..- attr(*, "duration")= num 8173
$ :'data.frame': 198950 obs. of 6 variables:
..$ R : num [1:198950] 0 0 0 0 0 0 0 0 0 0 ...
..$ G : num [1:198950] 0 0 0 0 0 0 0 0 0 0 ...
..$ B : num [1:198950] 0 0 0 0 0 0 0 0 0 0 ...
..$ hex : chr [1:198950] "#000000" "#000000" "#000000" "#000000" ...
..$ lum : num [1:198950] 0 0 0 0 0 0 0 0 0 0 ...
..$ frameId: int [1:198950] 1 2 3 4 5 6 7 8 9 10 ...
..- attr(*, "avgRGB")= chr "#2D312A"
..- attr(*, "title")= chr "s1e2"
..- attr(*, "duration")= num 8290
$ :'data.frame': 185945 obs. of 6 variables:
..$ R : num [1:185945] 0 0 0 0 0 0 0 0 0 0 ...
..$ G : num [1:185945] 0 0 0 0 0 0 0 0 0 0 ...
..$ B : num [1:185945] 0 0 0 0 0 0 0 0 0 0 ...
..$ hex : chr [1:185945] "#000000" "#000000" "#000000" "#000000" ...
..$ lum : num [1:185945] 0 0 0 0 0 0 0 0 0 0 ...
..$ frameId: int [1:185945] 1 2 3 4 5 6 7 8 9 10 ...
..- attr(*, "avgRGB")= chr "#252A29"
..- attr(*, "title")= chr "s1e3"
..- attr(*, "duration")= num 7748
}
\details{
details
}
\source{
source
}
\references{
references
}
\examples{
data(matrix)
}
\keyword{datasets}
Loading

0 comments on commit f40cccb

Please sign in to comment.