You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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)
The text was updated successfully, but these errors were encountered:
@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,
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)
The text was updated successfully, but these errors were encountered: