Closed FPI-MT closed 1 year ago
Seems this didn't solve my problem and the error continues.
@FPI-MT thanks for making me aware of this issue. It was actually related to an internal function that is used to check the range of values of the input image (func_chech_range()). The following should now work,
require(OpenImageR)
path = system.file("tmp_images", "1.png", package = "OpenImageR")
# displays the file using a shiny app
imageShow(path)
image = readImage(path)
# displays a 3-dimensional image (array)
imageShow(image)
thr = image_thresholding(image, thresh = 0.5) # if the input image is 3-dimensional it will be converted internally to a matrix
# displays a 2-dimensional object (matrix)
imageShow(thr)
You can install the updated version from Github using,
remotes::install_github('mlampros/OpenImageR', dependencies = TRUE)
i'll submit the updated version to CRAN which will be available in the next days.
I'll close the issue for now feel free to re-open it in case the code does not work as expected
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:
I'm hit with the following error for imageShow if I do not pre-load the grid library.
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)