Skip to content

Latest commit

 

History

History
227 lines (150 loc) · 4.58 KB

File metadata and controls

227 lines (150 loc) · 4.58 KB

TreeColour

TreeColour is a tool for adding color information to tree files based on various attributes or image data. It can color branches, trunks, or entire trees using attribute values or external images.

Usage

Attribute-based Coloring

Per-segment Attributes

treecolour <tree_file> <attribute>

Color by branch-level attributes in greyscale:

treecolour forest.txt diameter

Per-trunk Attributes

treecolour <tree_file> trunk <attribute>

Color by trunk-level attributes:

treecolour forest.txt trunk diameter

Per-tree Attributes

treecolour <tree_file> tree <attribute>

Color by tree-level attributes:

treecolour forest.txt tree height

RGB Value Specification

Per-segment RGB

treecolour <tree_file> <r>,<g>,<b>

Set RGB values or use attribute names:

treecolour forest.txt 1,length,diameter

Per-trunk RGB

treecolour <tree_file> trunk <r>,<g>,<b>
treecolour forest.txt trunk 1,length,diameter

Per-tree RGB

treecolour <tree_file> tree <r>,<g>,<b>
treecolour forest.txt tree 1,height,width

Image-based Coloring

Apply colors from an image to tree locations:

treecolour <tree_file> <image_file> <x_min>,<y_min>,<pixel_width>
treecolour forest.txt LAI_image.hdr 10.3,-12.4,0.2
  • x_min,y_min: Minimum coordinates of the image in world space
  • pixel_width: Size of each pixel in meters

Options

Color Scaling

  • --multiplier <value> or -m <value>: Apply uniform color scale multiplier
  • --scale <r>,<g>,<b> or -s <r>,<g>,<b>: Apply per-channel color scales

Color Modes

  • --gradient_rgb or -g: Use red→green→blue gradient instead of greyscale

Coloring Methods

Greyscale (Default)

Colors attributes using grayscale values based on attribute ranges.

RGB Gradient

Uses a red→green→blue color spectrum when --gradient_rgb is specified.

Image Mapping

Projects image colors onto tree locations based on spatial coordinates.

Examples

Basic Attribute Coloring

Color branches by diameter in greyscale:

treecolour trees.txt diameter

Color trunks by diameter with RGB gradient:

treecolour forest.txt trunk diameter --gradient_rgb

Color trees by height:

treecolour forest.txt tree height

RGB Attribute Mapping

Use multiple attributes for RGB channels:

treecolour forest.txt 1,length,diameter

Color trunks with custom RGB mapping:

treecolour forest.txt trunk 0.5,height,diameter

Image-based Coloring

Apply LAI (Leaf Area Index) image colors:

treecolour forest.txt lai_map.hdr 100.5,200.3,0.1

Apply RGB image with scaling:

treecolour trees.txt aerial.png 0,0,0.5 --scale 2,1,1.5

Advanced Scaling

Apply uniform scaling to all colors:

treecolour forest.txt diameter --multiplier 2.0 --gradient_rgb

Apply different scaling per color channel:

treecolour forest.txt 1,length,diameter --scale 1,0.8,1.2

Supported Attributes

The tool can use any attribute present in the tree file:

  • diameter - Branch diameter
  • length - Segment length
  • radius - Branch radius
  • height - Tree height (tree-level attribute)
  • volume - Branch or tree volume
  • Custom attributes from tree reconstruction

Supported Image Formats

  • HDR files (.hdr) - High dynamic range images
  • Standard formats (PNG, JPG, etc.) - Via STB image library

Output

The tool modifies the tree file in-place, adding or updating:

  • red attribute
  • green attribute
  • blue attribute

Color Replacement

If color attributes already exist, they are replaced with new values. If not, new color attributes are added to all segments.

Applications

Visualization

  • Color-code trees by biological properties
  • Highlight specific tree characteristics
  • Create visually informative tree renderings

Analysis

  • Visual quality assessment of tree attributes
  • Identify patterns in forest structure
  • Compare attribute distributions

Data Integration

  • Apply remote sensing data to tree models
  • Integrate LiDAR intensity with tree structure
  • Combine multiple data sources

Additional Information

  • Colors are applied consistently across tree hierarchies
  • Image-based coloring uses bilinear interpolation
  • For more detailed information on coloring algorithms, refer to the TreeColour source code at treetools/treetools/treecolour/treecolour.cpp.