Greetings,
While employing Treeiso to distinguish trees and subsequently segmenting the cloud based on integer values, I discerned that enhancing the quality of my work could be achieved by excluding clouds containing fewer than 1000 points. Notably, the trees identified through Treeiso consistently exhibit over 8000 points.
How to remove the smaller pointclouds?
Is there a way to remove pointclouds which has 1000points or lower?
Re: Is there a way to remove pointclouds which has 1000points or lower?
I guess you mean 'automatically'... Sadly I don't see any way to do it right now (apart from adding a line of code somewhere of course). Or maybe the Python interfaces could help.
Daniel, CloudCompare admin
Re: Is there a way to remove pointclouds which has 1000points or lower?
Hi,
I wrote a short script using the python GUI plugin recently which does something similar, basically it was meant to delete entities which weren't visible. I think the number of points is an attribute you can access through the python API, or definitely you can after passing the points to a numpy array.
Here's some untested code below. You would first select all the point clouds, then run the script, and the ones with less than 1000 points should disappear. (sometimes when I run my other version of this it crashes and I don't know why. usually it works though if I try again :) )
I wrote a short script using the python GUI plugin recently which does something similar, basically it was meant to delete entities which weren't visible. I think the number of points is an attribute you can access through the python API, or definitely you can after passing the points to a numpy array.
Here's some untested code below. You would first select all the point clouds, then run the script, and the ones with less than 1000 points should disappear. (sometimes when I run my other version of this it crashes and I don't know why. usually it works though if I try again :) )
Code: Select all
import cccorelib
import pycc
CC = pycc.GetInstance()
def main():
entities = CC.getSelectedEntities()
if not entities:
raise RuntimeError("No entities selected")
for entity in entities:
if len(entity.points)<1000: #did not test this, but something accessing the "points" attribute should work
CC.removeFromDB(entity)
CC.updateUI()
if __name__ == '__main__':
main()
Re: Is there a way to remove pointclouds which has 1000points or lower?
Nice, thanks for the post!
Just make sure not to select an entity and its children, as depending on the order this command is processed, you may try to access or remove an already deleted object.
Just make sure not to select an entity and its children, as depending on the order this command is processed, you may try to access or remove an already deleted object.
Daniel, CloudCompare admin