|
@@ -336,7 +336,7 @@ class Panorama extends THREE.EventDispatcher{
|
|
|
range.maxPixel = p[1]
|
|
|
|
|
|
|
|
|
- /* let pixelCount = texture.image.width * texture.image.height
|
|
|
+ let pixelCount = texture.image.width * texture.image.height
|
|
|
const stopMemberCount = 50;
|
|
|
|
|
|
|
|
@@ -347,7 +347,7 @@ class Panorama extends THREE.EventDispatcher{
|
|
|
return (Math.abs(A.x - B.x)<=1 || Math.abs(A.x - B.x) == texture.image.width-1) && Math.abs(A.y - B.y)<=1
|
|
|
}
|
|
|
for(let i=0;i<pixelCount;i++){
|
|
|
- if(Math.abs(value - pixels[i]) < 2 ){
|
|
|
+ if(Math.abs(value - pixels[i]) == 0 ){
|
|
|
let row = Math.floor(i / texture.image.width)
|
|
|
let col = i % texture.image.width
|
|
|
let data = {x:col, y:row, value: pixels[i]}
|
|
@@ -358,20 +358,22 @@ class Panorama extends THREE.EventDispatcher{
|
|
|
}
|
|
|
}
|
|
|
let groups2 = groups.filter(e=>e.length>1)
|
|
|
- if(groups2.length == 0) groups2 = groups
|
|
|
+ if(groups2.length < 3) groups2 = groups
|
|
|
groups2.forEach(group=>{//x的因边界不好写,就只判断y尽量接近中间且范围不大不小即可
|
|
|
group.sort((a,b)=>{return a.y-b.y})
|
|
|
let minY = group[0].y
|
|
|
let maxY = group[group.length-1].y
|
|
|
let centerY = (minY + maxY) / 2
|
|
|
let rectRatio = (maxY - minY) * 1//除非竖的一列,否则一般y范围越大越好 Math.abs(2 - Potree.math.getBaseLog(maxY - minY, group.length)) //范围圆润度, 最好个数是y范围的平方
|
|
|
- group.score = group.length * 0.4 + rectRatio - Math.abs(texture.image.height/2 - centerY) * 0.02 //y尽量接近中间
|
|
|
+ group.score = group.length * 0.2 + rectRatio - Math.abs(texture.image.height/2 - centerY) * 0.5 //y尽量接近中间
|
|
|
+
|
|
|
group.center = group[Math.floor(group.length/2)] //忽略是否横向的中间
|
|
|
})
|
|
|
groups2.sort((b,a)=>{return a.score - b.score})
|
|
|
range[name+'Pixel'] = groups2[0]?.center
|
|
|
+ //range[name+'PixelGroup'] = groups2
|
|
|
console.log('groups2', this.id, name,groups2)
|
|
|
- }) */
|
|
|
+ })
|
|
|
|
|
|
}
|
|
|
range.min /= 10, range.max /= 10
|