Giter VIP home page Giter VIP logo

lidrviewer's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

lidrviewer's Issues

Error in match.arg(backend) : 'arg' should be one of “rgl”

This is on Windows 10 x64 architecture.
Installed SDL using script (source("https://raw.githubusercontent.com/Jean-Romain/lidRviewer/master/sdl.R")) as admin
Installed lidRviewer devtools::install_github("Jean-Romain/lidRviewer").

plot(las) with rgl works (barely).

plot(las, backend = "lidRviewer")
Error in match.arg(backend) : 'arg' should be one of “rgl”

I installed lidR from the standard CRAN repository. With "lidRviewer" failing in the argument check for the backend parameter, maybe a different lidR install is needed?

system can't find i386

source("https://raw.githubusercontent.com/Jean-Romain/lidRviewer/master/sdl.R")
Downloading and installing SDL headers...

  • SDL headers downloaded
  • SDL headers uncompressed
  • SDL headers installed
    Downloading and installing SDL dll (x64)...
  • SDL dll downloaded
  • SDL dll uncompressed
  • SDL dll installed
    Downloading and installing SDL dll (i386)...
  • SDL dll installation skipped
    Installation of the SDL library: okWarning message:
    In normalizePath(path.expand(path), winslash, mustWork) :
    path[1]="D:/R/Rsetup/R-4.1.2/bin/x64/../i386/": 系统找不到指定的文件。

installation on macOS

I successfully installed on macOS. But the package still doesn't work.

First I installed the dependencies:

brew install sdl
brew install freeglut

I changed some of the source files like so:

#if defined(__APPLE__)
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#else
#include <GL/gl.h>
#include <GL/glu.h>
#endif

Then I deleted src/Makevars. Next, I created a configure file in the root folder:

#!/bin/bash
if [ $(uname) == "Linux" ]
then
  echo 'PKG_LIBS= -lGL -lGLU -lSDL -LSDmain' > ./src/Makevars
elif [ $(uname) == "Darwin" ]
then
  echo 'PKG_LIBS= -framework OpenGL -lSDL' > ./src/Makevars
fi

Now I can successfully install PointCloudViewer with:

R -e 'devtools::install(".")'

Finally, I tried an example to see if it worked:

#!/usr/bin/env Rscript

library(PointCloudViewer)

x   <- runif(1000, 0, 100)
y   <- runif(1000, 0, 100)
z   <- runif(1000, 0, 100)
col <- rainbow(10)
id  <- sample(1:10, length(x), replace = TRUE)
plot_xyzcol(x, y, z, col, id)

I can see the message Point cloud viewer must be closed before to run other R code, but I don't see any viewer.

Do you know what I might be missing?

Rgl is still default viewer

Hi JR,
I'm playing a bit with the 1.4.1 on a old dual core ( 64bit, 4gb RAM) with Ubuntu.
I tried to simply load and display the pointcloud (appr. 500Mb, 7.5M points) but RStudio opens it with rgl by default and not with this viewer.
I installed the necessary libs as described in the initial page and no error is reported. Any idea where to look for the issue? I'm definitely not experienced with ubuntu.

install SDL on ubuntu22.04 for use with RStudio-Server

When I go to install libsdl-dev I get the error

Package libsdl-dev is a virtual package provided by:
libsdl1.2-dev 1.2.15+dfsg2-6
libsdl1.2-compat-dev 1.2.52-3
You should explicitly select one to install.

E: Package 'libsdl-dev' has no installation candidate

apt-get install libsdl2-2.0-0 appears to install fine, but when I execute, the following happens. Any ideas? thanks!

devtools::install_github("Jean-Romain/lidRviewer")
Downloading GitHub repo Jean-Romain/lidRviewer@HEAD
Skipping 1 packages ahead of CRAN: Rcpp
── R CMD build ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
✔  checking for file ‘/tmp/RtmpantFq7/remotes22f58e3c5925be/Jean-Romain-lidRviewer-815fc53/DESCRIPTION’ (641ms)
─  preparing ‘lidRviewer’:
✔  checking DESCRIPTION meta-information
─  cleaning src
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
   Omitted ‘LazyData’ from DESCRIPTION
─  building ‘lidRviewer_0.2.0.tar.gz’
   Warning: invalid uid value replaced by that for user 'nobody'
   
Installing package into ‘/home/9nf/R/x86_64-pc-linux-gnu-library/4.2’
(as ‘lib’ is unspecified)
* installing *source* package ‘lidRviewer’ ...
** using staged installation
** libs
g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG  -I'/home/9nf/R/x86_64-pc-linux-gnu-library/4.2/Rcpp/include'    -fpic  -g -O2 -ffile-prefix-map=/build/r-base-LhKvHL/r-base-4.2.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -c RcppExports.cpp -o RcppExports.o
g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG  -I'/home/9nf/R/x86_64-pc-linux-gnu-library/4.2/Rcpp/include'    -fpic  -g -O2 -ffile-prefix-map=/build/r-base-LhKvHL/r-base-4.2.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -c camera.cpp -o camera.o
In file included from camera.cpp:1:
camera.h:4:10: fatal error: SDL/SDL.h: No such file or directory
    4 | #include <SDL/SDL.h>
      |          ^~~~~~~~~~~
compilation terminated.
make: *** [/usr/lib/R/etc/Makeconf:178: camera.o] Error 1
ERROR: compilation failed for package ‘lidRviewer’
* removing ‘/home/9nf/R/x86_64-pc-linux-gnu-library/4.2/lidRviewer’
Warning message:
In i.p(...) :
  installation of package ‘/tmp/RtmpantFq7/file22f58e57e6adb5/lidRviewer_0.2.0.tar.gz’ had non-zero exit status

Running RStudio-server on ubuntu22.04

Compatability

Hello, will this be made compatible with R version 4.2.2? currently says it is "not available with this version of R"

alternatives

Hi,
I would love to use lidRviewer, but unfortunately I dont have admin rights on my maschine.
Is there any way to use it without admin rights?
Or are you aware of any possible alternatives? (E.g. stream it to QGIS pointcloud viewer)

Missing file

Attempting to install the package. Apparently, a file is missing. See error:

In file included from camera.cpp:1:
./camera.h:4:10: fatal error: 'SDL/SDL.h' file not found
#include <SDL/SDL.h>
^~~~~~~~~~~
1 error generated.
make: *** [camera.o] Error 1
ERROR: compilation failed for package ‘lidRviewer’

how to run in Rstudio environment

Hello,
I am trying to render a LAS file using R studio (server). When I just try to plot following the command you provide I get a sort of error message and my R session hangs.
In your documentation I see that you say that the R viewer should be stopped...not sure how this can be done in R studio actually.

asUtr<-readLAS("/data2/utrechtCenter.las")  
plot(lasUtr,backend="pcv") 
#> Point cloud viewer must be closed before to run other R code
#> No protocol specified
#> No protocol specified
#> No protocol specified 
#> No protocol specified

Thanks for help in advance.

SDL and OpenGL not found on MacOS

Hi there, I tried to install lidRviewer on my system:

platform       x86_64-apple-darwin17.0     
arch           x86_64                      
os             darwin17.0                  
system         x86_64, darwin17.0          
status                                     
major          4                           
minor          0.5                         
year           2021                        
month          03                          
day            31                          
svn rev        80133                       
language       R                           
version.string R version 4.0.5 (2021-03-31)
nickname       Shake and Throw   

I got the following error. Is there a known work-around?

> devtools::install_github("Jean-Romain/lidRviewer")
Downloading GitHub repo Jean-Romain/lidRviewer@HEAD
✓  checking for file ‘/private/var/folders/dl/t0tty2rx6n3ft5qmnht_v8rnpg83bb/T/RtmpwS9MDT/remotese1fa29c262ab/Jean-Romain-lidRviewer-01bcf48/DESCRIPTION’ ...
─  preparing ‘lidRviewer’:
✓  checking DESCRIPTION meta-information ...
─  cleaning src
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
─  building ‘lidRviewer_0.2.0.tar.gz’
   Warning: invalid uid value replaced by that for user 'nobody'
   Warning: invalid gid value replaced by that for user 'nobody'
   
* installing *source* package ‘lidRviewer’ ...
** using staged installation
** libs
clang++ -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c RcppExports.cpp -o RcppExports.o
In file included from RcppExports.cpp:4:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/Rcpp.h:57:
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/Rcpp/DataFrame.h:136:18: warning: unused variable 'data' [-Wunused-variable]
            SEXP data = Parent::get__();
                 ^
1 warning generated.
clang++ -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c camera.cpp -o camera.o
In file included from camera.cpp:1:
./camera.h:4:10: fatal error: 'SDL/SDL.h' file not found
#include <SDL/SDL.h>
         ^~~~~~~~~~~
1 error generated.
make: *** [camera.o] Error 1
ERROR: compilation failed for package ‘lidRviewer’
* removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/lidRviewer’
Warning message:
In i.p(...) :
  installation of package ‘/var/folders/dl/t0tty2rx6n3ft5qmnht_v8rnpg83bb/T//RtmpwS9MDT/filee1faac9d188/lidRviewer_0.2.0.tar.gz’ had non-zero exit status

Usage of id option in plot function

Hi,

great work. It is indeed very performing. I am just struggling to use the id option. Your example perfectly works. I am now trying to apply it to a LiDAR point cloud and would like to colourize the Z values with height colours. But somehow it is not clear to me how to use the "id" option in this case, except generating random colours. Also the regular specifications of color palettes does not work as used in rgl.

Could put an example for a LiDAR data set and rainbow(50) or height.colours(50) ?

Thanks, a lot.

Cannot install due to SDL.h not being found

Hi!

I'm running into the following error when attempting install:

devtools::install_github("Jean-Romain/PointCloudViewer")
Downloading GitHub repo Jean-Romain/PointCloudViewer@masterchecking for file/tmp/Rtmp8mfSL5/remotes67d83df20d72/Jean-Romain-PointCloudViewer-6101481/DESCRIPTION...preparingPointCloudViewer:checking DESCRIPTION meta-informationcleaning srcchecking for LF line-endings in source and make files and shell scriptschecking for empty or unneeded directoriesbuildingPointCloudViewer_0.2.0.tar.gz* installing *source* packagePointCloudViewer...
** using staged installation
** libs
x86_64-conda_cos6-linux-gnu-c++ -std=gnu++11 -I"/home/guslun/anaconda3/envs/renv/lib/R/include" -DNDEBUG  -I"/home/guslun/anaconda3/envs/renv/lib/R/library/Rcpp/include" -DNDEBUG -D_FORTIFY_SOURCE=2 -O2  -I/home/guslun/anaconda3/envs/renv/include -Wl,-rpath-link,/home/guslun/anaconda3/envs/renv/lib  -fpic  -fvisibility-inlines-hidden  -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -I/home/guslun/anaconda3/envs/renv/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/r-base_1562872960081/work=/usr/local/src/conda/r-base-3.6.1 -fdebug-prefix-map=/home/guslun/anaconda3/envs/renv=/usr/local/src/conda-prefix  -c RcppExports.cpp -o RcppExports.o
x86_64-conda_cos6-linux-gnu-c++ -std=gnu++11 -I"/home/guslun/anaconda3/envs/renv/lib/R/include" -DNDEBUG  -I"/home/guslun/anaconda3/envs/renv/lib/R/library/Rcpp/include" -DNDEBUG -D_FORTIFY_SOURCE=2 -O2  -I/home/guslun/anaconda3/envs/renv/include -Wl,-rpath-link,/home/guslun/anaconda3/envs/renv/lib  -fpic  -fvisibility-inlines-hidden  -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -I/home/guslun/anaconda3/envs/renv/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/r-base_1562872960081/work=/usr/local/src/conda/r-base-3.6.1 -fdebug-prefix-map=/home/guslun/anaconda3/envs/renv=/usr/local/src/conda-prefix  -c camera.cpp -o camera.o
In file included from camera.cpp:1:0:
camera.h:4:10: fatal error: SDL/SDL.h: No such file or directory
 #include <SDL/SDL.h>
          ^~~~~~~~~~~
compilation terminated.
make: *** [/home/guslun/anaconda3/envs/renv/lib/R/etc/Makeconf:175: camera.o] Error 1
ERROR: compilation failed for packagePointCloudViewer* removing/home/guslun/anaconda3/envs/renv/lib/R/library/PointCloudViewerError: Failed to install 'PointCloudViewer' from GitHub:
  (converted from warning) installation of package/tmp/Rtmp8mfSL5/file67d87b71489e/PointCloudViewer_0.2.0.tar.gzhad non-zero exit status

Both prereq libraries have been installed however, albeit with a warning for SDL that a newer verion is used as far as I understand the issue.

(renv) guslun@K2006559:~$ sudo apt-get install libsdl-dev freeglut3-dev
[sudo] password for guslun: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'libsdl1.2-dev' instead of 'libsdl-dev'
freeglut3-dev is already the newest version (2.8.1-3).
libsdl1.2-dev is already the newest version (1.2.15+dfsg2-0.1ubuntu0.1).
0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.
(renv) guslun@K2006559:~$ locate SDL.h
/usr/include/SDL/SDL.h

Is there a way of getting the installation to find SDL.h so I can use the package properly?

SDL2 compatibility

Fedora has moved to SDL2, and the current version of sdl.h is in /usr/include/SDL2 instead of /usr/include/SDL
(SDL2-devel.x86_64 2.26.2-1.fc36)

A symbolic link fixed that, but unfortunately SDL_BUTTON_WHEELUP and SDL_BUTTON_WHEELDOWN are not part of the current includes. I imagine there's a new specification, but I'm not familiar with SDL.

camera.cpp: In member function ‘void Camera::OnMouseButton(const SDL_MouseButtonEvent&)’:
camera.cpp:162:29: error: ‘SDL_BUTTON_WHEELUP’ was not declared in this scope; did you mean ‘SDL_BUTTON_MIDDLE’?
162 | else if ((event.button == SDL_BUTTON_WHEELUP) && (event.type == SDL_MOUSEBUTTONDOWN))
| ^~~~~~~~~~~~~~~~~~
| SDL_BUTTON_MIDDLE
camera.cpp:169:29: error: ‘SDL_BUTTON_WHEELDOWN’ was not declared in this scope
169 | else if ((event.button == SDL_BUTTON_WHEELDOWN) && (event.type == SDL_MOUSEBUTTONDOWN))
| ^~~~~~~~~~~~~~~~~~~~
make: *** [/usr/lib64/R/etc/Makeconf:177: camera.o] Error 1
ERROR: compilation failed for package ‘lidRviewer’

Failing to plot voxel values using the PCV

Dear Jean-Romain,

I've been using your R packages quite heavily lately, but now I'm running into issues I cannot quite fix. Thanks to your lidR plug-ins I've calculated voxels that represent LAD. Plotting these voxels with a correct color scheme did not work for me with the basic rgl viewer, that is why I tried the pcv instead. All the voxels appear with the same color (as can be seen in the picture below), while the LAD values should tell otherwise. FYI: for testing I took your Megaplot.laz, I'm using Windows 10 and there are 249690 voxels in the dataframe.

The calculation of the LAD voxels:

library(lidR)
library(lidRplugins)
library(PointCloudViewer)
LASfile <- system.file("extdata", "Megaplot.laz", package="lidR")
las = readLAS(LASfile)
voxelsLAD = grid_metrics3d(las, ~LAD(z=las@data$Z, dz = 1, k= 0.5, z0= 1), 5)
plot(voxelsLAD, color = "lad", colorPalette = heat.colors(5), bg = "black", legend = TRUE)

The plotting done with rgl:

plot(voxelsLAD, color = "lad", colorPalette = heat.colors(5), bg = "black", legend = TRUE)

The plotting done with pcv:

plot_xyzcol(voxelsLAD$X, voxelsLAD$Y, voxelsLAD$Z, col = heat.colors(10), id = cut(voxelsLAD$lad, 10, label = FALSE))

The cut(voxelsLAD$lad, 10, label = FALSE) results in a large integer looking like so: [1] 5 5 7 9 10 10 9 9 8 8 8 8 8 8 8 8 8 8 7 7 5 4 3 2 1 1 1 1 1 5 5 7 9 10 ...

The issue is that the colorramp is not applying itself to the LAD values. Any idea what is going wrong here? Thanks!

image

`color="RGB"` doesn’t work

Hello,

plot(las1, color="RGB", backend = "lidRviewer") return the following stacktrace :

Erreur dans lidRviewer::plot_xyzrgb(x@data$X, x@data$Y, x@data$Z, x@data$R,  : 
  'id' must contain integers
9. stop("'id' must contain integers")
8. lidRviewer::plot_xyzrgb(x@data$X, x@data$Y, x@data$Z, x@data$R,
x@data$G, x@data$B, args$size) à <text>#1
7. eval(parse(text = "lidRviewer::plot_xyzrgb(x@data$X, x@data$Y, x@data$Z, x@data$R, x@data$G, x@data$B, args$size)"))
6. eval(parse(text = "lidRviewer::plot_xyzrgb(x@data$X, x@data$Y, x@data$Z, x@data$R, x@data$G, x@data$B, args$size)"))
5. lasplot(x, bg, idcolor, pal, clear_artifacts, axis, legend, args,
add, voxel, breaks)
4. plot.LAS(x, y, ..., color = color, pal = pal, bg = bg, breaks = breaks,
nbreaks = nbreaks, backend = backend, clear_artifacts = clear_artifacts,
axis = axis, legend = legend, add = add, voxel = voxel, NAcol = NAcol,
mapview = mapview)
3. .local(x, y = y, ...)
2. plot(las1, color = "RGB", backend = "lidRviewer")
1. plot(las1, color = "RGB", backend = "lidRviewer")

It works with backend="rgl" or with color="Classification", color="Intensity", etc. Only the combo color="RGB", backend = "lidRviewer" return the error.

Can't install PointCloudViewer

Hi Jean,
It says the following warning. Warning in install.packages : package ‘PointCloudViewer’ is not available (for R version 3.6.3).

I exactly followed the steps advised in this link. Then it showed another issue after following the 2nd step for windows installation which is:

source("https://raw.githubusercontent.com/Jean-Romain/PointCloudViewer/master/sdl.R")
#> Downloading and installing SDL headers...
#> - SDL headers downloaded
#> - SDL headers uncompressed
#> Error in file.copy(includes, inc, recursive = TRUE) : more 'from' files than 'to' files
#> In addition: Warning message:
#> In dir.create(inc) : cannot create dir 'C:\PROGRA~1\R\R-36~1.3\include\SDL', reason 'Permission denied'
#> Called from: file.copy(includes, inc, recursive = TRUE)

Please let me know what could be the solution for installing this package.

Thanks and Regards,
Yogendra

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.