question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Finding percentage and removing overlaping points in multiple point clouds

See original GitHub issue

Hi @marcomusy,

Is it possible to use vedo to find the percentage of overlapping points and remove them from multiple loaded point clouds?

For example in the image below: image I have loaded 3 different point clouds (i.e. red, orange, yellow) which they overlap to each other. Then I would like to find how much do they overlap and keep only the points where there is not overlapping area.

import numpy as np
import vedo as vd
import natsort
from wcmatch import glob

folder = ./7-scenes-redkitchen/'
pcd_files = natsort.natsorted(glob.glob(folder + '**/*.ply', flags=glob.BRACE | glob.GLOBSTAR))

tranf_files = natsort.natsorted(glob.glob(folder + '**/*.txt', flags=glob.BRACE | glob.GLOBSTAR))

pcds = []
for i, input_path in enumerate(pcd_files):
    t = np.loadtxt(tranf_files[i], skiprows=1)
   pcd = vd.Points(input_path).color(i).applyTransform(t, reset=True)
   pcds.append(pcd)

   vd.show(pcds, axes=1).close()

7-scenes-redkitchen.zip

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
marcomusycommented, Feb 18, 2022

yes, you may use mypcl.averageSize() or mypcl.diagonalSize()

1reaction
ttsesmcommented, Feb 18, 2022

Thanks Marco, I confirm that now it works as supposed.

Regarding the actual issue subject, below is a method to extract the overlapping percentage of two point clouds (considering that they are aligned) based on their points distance:

import numpy as np
import vedo as vd

def get_overlap_ratio(pcd1_, pcd2_, visualize=False):
    pcd2_.distanceTo(pcd1_).addScalarBar()

    if visualize:
        vd.show(pcd1_, pcd2_, axes=1).close()

    overlapping_points = np.where(pcd2_.pointdata['Distance'] < 0.1) # 0.1 is the distance to consider that two points are overlapping

    match_points = (pcd2_.pointdata['Distance'] < 0.1).sum() # or len(overlapping_points)

    overlap_ratio = match_points / len(pcd2_.points())

    return overlap_ratio * 100, overlapping_points

The overlapping_points contain the indexes of the points, which can be cleared out by pcd.delete() if someone wants to delete these points.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Expected Overlap Estimation over Unstructured Point Cloud ...
We present an iterative overlap estimation technique to augment existing point cloud registration algorithms that can achieve high performance in difficult ...
Read more >
Two overlapping point clouds before registration.
This analysis has been performed for each point cloud. Figure 3 and 4 put in evidence, for two overlapping point clouds, the possible...
Read more >
A method for data density reduction in overlapped airborne ...
The traditional method for mitigating data density on overlapped airborne LiDAR strips is the accuracy-based approach. For example, the “Cut by ...
Read more >
Removing points from overlapping scans by specific scans
Removing points from overlapping scans by specific scans ... Hi all, I'm fairly new to Cloud Compare and point clouds in general so...
Read more >
Fast and Robust Registration of Partially Overlapping Point ...
The overlap ratio measures the overlap between point clouds as the percentage of points in the source point cloud that, when aligned, are...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found