Skip to content

vignette could add library(grid) as part of instructions #28

Closed
@FPI-MT

Description

@FPI-MT

My R skills are not great, so I apologize if this is too obvious and I just didn't learn the proper method.

I suggest that the vignette can be improved by indicating that the system library "grid" should be loaded.

why:
I use RStudio and it does not load 'grid' automatically. While going through the vignette at this stage:

path = file.path(getwd(), 'vignette_1', 'image2.jpg')
im = readImage(path)
thr = image_thresholding(im, thresh = 0.5)           # if the input image is 3-dimensional it will be converted internally to a matrix
imageShow(thr)

I'm hit with the following error for imageShow if I do not pre-load the grid library.

Error: Error converting object to arma::Cube<T>:
Input array must have exactly 3 dimensions.

The reason for this is that thr is a 2D matrix since rgb_2gray() is called. imageShow() then uses grid.raster. While the code used in image_thresholding() does call grid::grid.raster(), if grid isn't loaded into library, the above error is produced.

The only reason I was able to figure this out was because I stumbled across a test somewhere that said "image_thresholding" failed, but it wasn't clear why. I'm afraid I don't know where thatpage is anymore.

R version 4.2.1 (2022-06-23 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions