[Liblas-commits] hg: examples for assigning color information from rasters

liblas-commits at liblas.org liblas-commits at liblas.org
Fri Dec 17 22:21:45 EST 2010


changeset 3bb734e126b0 in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=3bb734e126b0
summary: examples for assigning color information from rasters

diffstat:

 doc/start.txt             |  107 ++++++++++++++++++++++++++++++++++++++++-----
 doc/utilities/las2las.txt |   10 ++-
 2 files changed, 100 insertions(+), 17 deletions(-)

diffs (178 lines):

diff -r d44837072a6a -r 3bb734e126b0 doc/start.txt
--- a/doc/start.txt	Fri Dec 17 13:04:42 2010 -0600
+++ b/doc/start.txt	Fri Dec 17 21:21:37 2010 -0600
@@ -141,11 +141,12 @@
     Min X, Y, Z: 		-83.43, 39.01, 170.58, 
     Max X, Y, Z: 		-83.43, 39.01, 170.76,
 
-The ``srs.las`` file had a scale of 0.01, or two decimal places of precision 
-for its X, Y, and Z coordinates.  For UTM data, this is ok, because it implies 
-an implicit precision of 1 cm.  For decimal degree data of the unprojected plate carrée 
-coordinate system, it causes us to lose a bunch of precision.  We need to 
-set our scale values to something that can hold more precision in our case:
+The ``srs.las`` file had a scale of 0.01, or two decimal places of precision
+for its X, Y, and Z coordinates. For UTM data, this is ok, because it implies
+an implicit precision of 1 cm. For decimal degree data of the unprojected
+Plate Carrée coordinate system, it causes us to lose a bunch of precision. We
+need to set our scale values to something that can hold more precision in our
+case:
 
 ::
 
@@ -170,14 +171,15 @@
 add a twist -- we want to change the vertical datum on the data from WGS84
 to NAVD88.
 
-.. warning::
+.. warning:
 
-    A number of requirements are needed before you can do vertical datum transformations 
-    with libLAS.  The most important is GDAL, of course, but you also need a 
-    very current (possibly even unreleased) version of `Proj.4`_ and the vertical 
-    datum .gtx transformation files. If you're using :ref:`osgeo4w_install`, you 
-    already have all of this installed when you installed libLAS.  For Linux 
-    or other Unix platforms, you should be aware of these requirements.
+    A number of requirements are needed before you can do vertical datum
+   transformations with libLAS. The most important is GDAL support, of course,
+   but you also need a very current (possibly even unreleased) version of
+   `Proj.4`_ and the vertical datum .gtx transformation files. If you're using
+   :ref:`osgeo4w_install`, you already have all of this installed when you
+   installed libLAS. For Linux or other Unix platforms, you should be aware of
+   these requirements.
     
 Assuming you have all of the prerequisites in place, we can do the vertical 
 datum transformation quite simply (again, worrying about precision as well):
@@ -192,6 +194,83 @@
 other ways to have these operations happen using `WKT`_ and even GeoTIFF 
 keys, but this is the most simple way to do things via command line.
 
+Assigning color information to a LAS file
+..............................................................................
+
+.. note::
+
+    The following example assumes you are working with the `Autzen_Stadium`_
+    example file that is available from the http://liblas.org/sample sample
+    library.
+
+   
+Frequent availability of combined terrestrial LiDAR and image captures means 
+that its now possible to obtain .las files that you can stylize with RGB 
+imagery.  The LAS 1.2 specification provides two different point data 
+types that allow storing RGB data as 16 bit integers, but the tools to 
+do the actual intersection operation have been somewhat limited.  
+
+libLAS 1.6+ allows you to assign color information to a .las file if `GDAL`_ 
+is linked in at compile-time.  
+
+.. note::
+    The :ref:`LAS specifications <specifications>` only allow two different
+    point format types to store color information -- point format 2 and point
+    format 3. The difference between point format 2 and point format 3 is that
+    3 also has time stored on it. Additionally, only LAS 1.2 and 1.3 versions
+    support storing color information, but libLAS only can write LAS 1.2 as of
+    libLAS 1.6.0.
+
+
+
+1. Unzip the `Autzen Stadium <Autzen_Stadium>`_ data.
+    
+    ::
+    
+        $ unzip Autzen_Stadium.zip
+        Archive:  Autzen_Stadium.zip
+         creating: Autzen_Stadium/
+         inflating: Autzen_Stadium/image.tif  
+         inflating: Autzen_Stadium/lidar.las 
+
+2. Issue the :ref:`las2las <las2las>` call
+
+    ::
+    
+        $   las2las -i lidar.las \
+                    --color-source image.tif \
+                    -o output.las \
+                    --file-format 1.2 \
+                    --point-format 3 \
+                    -v
+
+    ::
+    
+        Opening lidar.las to fetch Header
+        Setting format to: 1.2
+        Setting point format to: 3
+        Fetching color from ' image.tif' using bands '1, 2, 3' for R, G, B
+        Writing output:
+         - : output.las
+        0...10...20...30...40...50...60...70...80...90...100 - done.
+
+3.  Inspect the :ref:`lasinfo <lasinfo>` output and see color information 
+    attached.
+
+    ::
+        
+        lasinfo output.las
+        
+        ...
+        
+          Minimum Color:	39 56 56 
+          Maximum Color:	252 254 251
+
+.. note::
+    :ref:`assign_color` contains more detailed information about this process.
+ 
+
+
 .. _`CMake`: http://www.cmake.org/
 .. _`CTest`: http://cmake.org/cmake/help/ctest-2-8-docs.html
 .. _`CMake 2.8.0+`: http://www.cmake.org/cmake/help/cmake-2-8-docs.html
@@ -208,4 +287,6 @@
 .. _`EPSG`: http://www.epsg-registry.org/
 .. _`EPSG:4326`: http://spatialreference.org/ref/epsg/4326/
 .. _`Proj.4`: http://trac.osgeo.org/proj/
-.. _`WKT`: http://en.wikipedia.org/wiki/Well-known_text#Spatial_reference_systems
\ No newline at end of file
+.. _`WKT`: http://en.wikipedia.org/wiki/Well-known_text#Spatial_reference_systems
+.. _`GDAL`: http://gdal.org
+.. _`Autzen_Stadium`: http://liblas.org/samples/Autzen_Stadium.zip
diff -r d44837072a6a -r 3bb734e126b0 doc/utilities/las2las.txt
--- a/doc/utilities/las2las.txt	Fri Dec 17 13:04:42 2010 -0600
+++ b/doc/utilities/las2las.txt	Fri Dec 17 21:21:37 2010 -0600
@@ -244,6 +244,7 @@
 
 removes all VLRs from in.las when writing the new output.las file.   
 
+.. _assign_color:
 
 Adding color from an image
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -257,17 +258,17 @@
 and sets the point format to ``3`` so it can store color information.  It 
 also re-orders the color bands to have the 3rd band in the image be red, 1st 
 band be green, and second band be blue.  Additionally, the color values are 
-then multiplied by the --color-source-scale factor or 257 to rescale the 
-8bit image data to 16bit color data.
+then multiplied by the --color-source-scale factor or 256 to rescale the 
+8 bit image data to 16 bit color data.
 
 ::
 
     las2las -i input.las \
             --color-source image.img \
             -o output.las \
-            --format 1.2 \
+            --file-format 1.2 \
             --point-format 3 \
-            --color-source-scale 257 \
+            --color-source-scale 256 \
             --color-source-bands 3 1 2
 
 .. note::
@@ -275,6 +276,7 @@
     coordinate system of the LAS file, you should use GDAL VRTs to cause the 
     image to be warped and reprojected as part of the read process.  See 
     http://www.gdal.org/gdal_vrttut.html for more detail.
+    
 .. warning::
     `GDAL`_ support must be enabled for this to work.
 


More information about the Liblas-commits mailing list