mlampros/OpenImageR

imageShow needs path or image object

kmezhoud opened this issue · 4 comments

Dear Lampros,

img <- readImage("test.jpeg")
imageShow(img)  ## does not display image
imageShow("test.jpeg") ## display image

In the vignette, I am trying

path = 'image1.jpeg'
im = readImage(path)
imageShow(im)

Does not work for me

R version 3.4.3 (2017-11-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] shiny_1.0.5      OpenImageR_1.0.8

loaded via a namespace (and not attached):
 [1] Rook_1.1-1         purrr_0.2.4        colorspace_1.3-2   htmltools_0.3.6   
 [5] viridisLite_0.2.0  yaml_2.1.16        XML_3.98-1.9       rlang_0.1.6       
 [9] pillar_1.1.0       glue_1.2.0         RColorBrewer_1.1-2 bindrcpp_0.2      
[13] jpeg_0.1-8         bindr_0.1          plyr_1.8.4         stringr_1.2.0     
[17] munsell_0.4.3      gtable_0.2.0       visNetwork_2.0.3   htmlwidgets_1.0   
[21] codetools_0.2-15   knitr_1.18         httpuv_1.3.5       DiagrammeR_0.9.2  
[25] Rcpp_0.12.15       xtable_1.8-2       readr_1.1.1        scales_0.5.0      
[29] jsonlite_1.5       rgexf_0.15.3       mime_0.5           gridExtra_2.3     
[33] brew_1.0-6         ggplot2_2.2.1      hms_0.4.1          png_0.1-7         
[37] digest_0.6.14      stringi_1.1.6      tiff_0.1-5         dplyr_0.7.4       
[41] grid_3.4.3         influenceR_0.1.0   tools_3.4.3        magrittr_1.5      
[45] mxnet_0.10.1       lazyeval_0.2.1     tibble_1.4.2       tidyr_0.7.2       
[49] pkgconfig_2.0.1    rsconnect_0.8.5    downloader_0.4     assertthat_0.2.0  
[53] rstudioapi_0.7     viridis_0.4.1      R6_2.2.2           igraph_1.1.2      
[57] compiler_3.4.3   

Thanks,

@kmezhoud I'm sorry for the late reply,

according to the CRAN package check results OpenImageR should also work for a Macintosh OS.

Would you mind checking if the test.jpeg image exists in your current directory? For instance on a unix OS

getwd()

list.files()

would list all existing files.

Otherwise I would consider to give the full path of the image,

path = "your_home_directory/test.jpeg"

img <- readImage(path)

dim(img)

Let me know if this was actually the issue.

Ahhh,
I think, doesn't work into R Notebook only.
yes, imageShow(im) works in console.
But in imageShow document, the argument in a file_path and not raster object.
Thanks

library(OpenImageR)
list.files()
im <- OpenImageR::readImage("image0216.jpg")
imageShow(im)
dim(im)
[1] "image0216.jpg" "index.nb.html" "index.Rmd"    
[1]  768 1024    3

@kmezhoud,

file_path can be either a character string, a matrix (2-dimensional), a data.frame (2-dimensional) or a 3-dimensional array (documentation).
If that is the case then OpenImageR should work also in an R Notebook (.Rmd file).

I close the issue for now, feel free to reopen it.