CloudCompare / CloudComPy

Python wrapper for CloudCompare
Other
283 stars 40 forks source link

Cylindrical Neighbourhood #145

Open fusturnu opened 10 months ago

fusturnu commented 10 months ago

Hi, I have a problem with cc.CylindricalNeighbourhood(). When I ran this function it, took long long time and calculation didn't over. I mean the code runs to infinity :) I did the same thing with getPointsInSphericalNeighbourhood with the same data, calculation had done in 20 minutes successfully. I would like to ask why it takes too long, is there something wrong in my code? Here my code for SPHERICAL NEIGHBOURHOOD ` neighbourZ = [] mean = [] median = [] variance = [] range_Z = [] Pz_mean = [] Pz_median = []

for i in tqdm(range(0, cloud.size())): neighbours = octree.getPointsInSphericalNeighbourhood((sfX.getValue(i), sfY.getValue(i), sfZ.getValue(i)), r, level)

for k in range(0, len(neighboursCyl)):
    neighbourZ.append(neighboursCyl[k].point[2])

mean.append(np.mean(neighbourZ))
variance.append(np.var(neighbourZ))
range_Z.append(max(neighbourZ) - min(neighbourZ))
Pz_mean.append(np.mean(neighbourZ) - sfZ.getValue(i))
Pz_median.append(np.median(neighbourZ) - sfZ.getValue(i))
neighbourZ.clear()

`

Here my code for CYLINDRICAL NEIGHBOURHOOD ` neighbourZ = [] mean = [] median = [] variance = [] range_Z = [] Pz_mean = [] Pz_median = []

params = cc.CylindricalNeighbourhood() params.level = level params.radius = r params.maxHalfLength = 1

for i in tqdm(range(0, cloud.size())): params.center = (sfX.getValue(i), sfY.getValue(i), sfZ.getValue(i)) neighboursCyl = octree.getPointsInCylindricalNeighbourhood(params)

for k in range(0, len(neighboursCyl)):
    neighbourZ.append(neighboursCyl[k].point[2])

mean.append(np.mean(neighbourZ))
variance.append(np.var(neighbourZ))
range_Z.append(max(neighbourZ) - min(neighbourZ))
Pz_mean.append(np.mean(neighbourZ) - sfZ.getValue(i))
Pz_median.append(np.median(neighbourZ) - sfZ.getValue(i))
neighbourZ.clear()

`

prascle commented 10 months ago

Hi, It's not obvious at a first glance. How many nodes do you have in your cloud ? How do you choose the octree level depending on the radius ? How many neighbours do you have on average ? Following your progress bar, can you give an estimate of the number of nodes analysed per second ? Best, Paul

Le mar. 28 nov. 2023, 14:25, Yusuf Dogan @.***> a écrit :

Hi, I have a problem with cc.CylindricalNeighbourhood(). When I ran this function it, took long long time and calculation didn't over. I mean the code runs to infinity :) I did the same thing with getPointsInSphericalNeighbourhood with the same data, calculation had done in 20 minutes successfully. I would like to ask why it takes too long, is there something wrong in my code? Here my code for SPHERICAL NEIGHBOURHOOD `neighbourZ = [] mean = [] median = [] variance = [] range_Z = [] Pz_mean = [] Pz_median = []

for i in tqdm(range(0, cloud.size())): neighbours = octree.getPointsInSphericalNeighbourhood((sfX.getValue(i), sfY.getValue(i), sfZ.getValue(i)), r, level)

for k in range(0, len(neighboursCyl)): neighbourZ.append(neighboursCyl[k].point[2])

mean.append(np.mean(neighbourZ)) variance.append(np.var(neighbourZ)) range_Z.append(max(neighbourZ) - min(neighbourZ)) Pz_mean.append(np.mean(neighbourZ) - sfZ.getValue(i)) Pz_median.append(np.median(neighbourZ) - sfZ.getValue(i)) neighbourZ.clear()`

Here my code for CYLINDRICAL NEIGHBOURHOOD `neighbourZ = [] mean = [] median = [] variance = [] range_Z = [] Pz_mean = [] Pz_median = []

params = cc.CylindricalNeighbourhood() params.level = level params.radius = r params.maxHalfLength = 1

for i in tqdm(range(0, cloud.size())): params.center = (sfX.getValue(i), sfY.getValue(i), sfZ.getValue(i)) neighboursCyl = octree.getPointsInCylindricalNeighbourhood(params)

for k in range(0, len(neighboursCyl)): neighbourZ.append(neighboursCyl[k].point[2])

mean.append(np.mean(neighbourZ)) variance.append(np.var(neighbourZ)) range_Z.append(max(neighbourZ) - min(neighbourZ)) Pz_mean.append(np.mean(neighbourZ) - sfZ.getValue(i)) Pz_median.append(np.median(neighbourZ) - sfZ.getValue(i)) neighbourZ.clear()`

— Reply to this email directly, view it on GitHub https://github.com/CloudCompare/CloudComPy/issues/145, or unsubscribe https://github.com/notifications/unsubscribe-auth/APFRPQYIPHTGGXPP76VTIPTYGXQ4VAVCNFSM6AAAAAA75YJHC2VHI2DSMVQWIX3LMV43ASLTON2WKOZSGAYTINBTGUYTEMY . You are receiving this because you are subscribed to this thread.Message ID: @.***>