Skip to content

Livox Viewer

Livox-SDK edited this page Jul 22, 2022 · 1 revision

1. Color Coding Strategy

1.1. Reflectivity:

  if (cur_reflectivity < 30)
  {
    result_r = 0;
    result_g = int(cur_reflectivity * 255 / 30) & 0xff;
    result_b = 0xff;
  }
  else if (cur_reflectivity < 90)
  {
    result_r = 0;
    result_g = 0xff;
    result_b = int((90 - cur_reflectivity) * 255 / 60) & 0xff;
  }
  else if (cur_reflectivity < 150)
  {
    result_r = ((cur_reflectivity - 90) * 255 / 60) & 0xff;
    result_g = 0xff;
    result_b = 0;
  }
  else
  {
    result_r = 0xff;
    result_g = int((255 - cur_reflectivity) * 255 / (256 - 150)) & 0xff;
    result_b = 0;
  }

1.2. Depth:

// Input custom variables from Color Coding Settings:
//	{min_distance, max_distance}
// Input variable of self distance:
//  {cur_distance}

// Color in HSV Space
   min_color_hue =  0.0; 	// Hue at closest distance
   max_color_hue = 0.33; 	// Hue at farthest distance
   color_saturation =  1.0;  // Satuation and Value are fixed
   color_value =  1.0;

// Perform linear interpolation by distance to get result hue
   result_color_hue = (cur_distance - min_distance)/
					  (max_distance - min_distance)*
					  (max_color_hue-min_color_hue) + min_color_hue;
   result_color_hue = clamp(result_color_hue, min_color_hue, max_color_hue);
  

1.3. Elevation:

// Input custom variables from Color Coding Settings:
//	{min_elavation, max_elavation}
// Input variable of self elavation:
//  {cur_elavation}

// Color in RGB Space
   min_color_g = 1; 	// Green value at lowest elavation
   max_color_g = 0; 	// Green value at highest elavation
   color_r =  1.0;   // Red and blue values are fixed
   color_r =  1.0;

// Perform linear interpolation by elavation to get result green value
   result_color_g = (cur_elavation - min_elavation)/
	 			    (max_elavation - min_distance)*
	 			    (max_color_g - min_color_g) + min_color_g;
   result_color_g = clamp(result_color_g, min_color_g, max_color_g);


Communication Protocol

o HAP 中文

o HAP English

Livox-Viewer2

o Color Coding Strategy

Clone this wiki locally