use 0.75 percentille as choice for intensity cap

This commit is contained in:
mschuetz 2016-01-06 14:04:52 +01:00
parent 94844fad51
commit 5f2cd319a1
3 changed files with 26 additions and 16 deletions

View File

@ -12093,17 +12093,22 @@ Potree.Viewer = function(domElement, args){
var attributes = pointcloud.pcoGeometry.root.geometry.attributes;
if(attributes.intensity){
var array = attributes.intensity.array;
var max = 0;
for(var j = 0; j < array.length; j++){
max = Math.max(array[j]);
}
if(max <= 1){
// chose max value from the 0.75 percentile
var ordered = [];
for(var j = 0; j < array.length; j++){
ordered.push(array[j]);
}
ordered.sort();
var capIndex = parseInt((ordered.length - 1) * 0.75);
var cap = ordered[capIndex];
if(cap <= 1){
scope.intensityMax = 1;
}else if(max <= 256){
}else if(cap <= 256){
scope.intensityMax = 255;
}else{
scope.intensityMax = max;
scope.intensityMax = cap;
}
}
}

File diff suppressed because one or more lines are too long

View File

@ -1163,17 +1163,22 @@ Potree.Viewer = function(domElement, args){
var attributes = pointcloud.pcoGeometry.root.geometry.attributes;
if(attributes.intensity){
var array = attributes.intensity.array;
var max = 0;
for(var j = 0; j < array.length; j++){
max = Math.max(array[j]);
}
if(max <= 1){
// chose max value from the 0.75 percentile
var ordered = [];
for(var j = 0; j < array.length; j++){
ordered.push(array[j]);
}
ordered.sort();
var capIndex = parseInt((ordered.length - 1) * 0.75);
var cap = ordered[capIndex];
if(cap <= 1){
scope.intensityMax = 1;
}else if(max <= 256){
}else if(cap <= 256){
scope.intensityMax = 255;
}else{
scope.intensityMax = max;
scope.intensityMax = cap;
}
}
}