Open3D icon indicating copy to clipboard operation
Open3D copied to clipboard

About remove_radius_outlier function

Open GHCK57 opened this issue 3 years ago • 0 comments

Checklist

My Question

Hi

I am working on point cloud filtering. I have a point cloud data and I want to delete the noise from that data. I have pyqt GUI and 2 Qthread working on there. One of thread is handle the data to eliminate noises and another one is just printing text. Normally the threads work fine, there is no problem until the call "remove_radius_outlier" function

When call the "remove_radius_outlier" function in the thread, the other thread does not work fine.

I hope you understand me.

print(o3d.version) -> 0.15.1

import open3d as o3d
from PyQt5 import QtCore
from PyQt5.QtWidgets import *
import time
import sys
from PyQt5.QtGui import *

import os


window_size = (500,500)
class Window(QWidget):

    def __init__(self):
        super().__init__()        
        self.setWindowTitle("WINDOW")
        # setting geometry		
        self.setGeometry(100, 100, window_size[0], window_size[1])	
        self.Init_Start_GUI()
        self.show()
        

    def Init_Start_GUI(self):


        self.buttonstartsystem = QPushButton("BUTTON",self)
        
        button_x = 200
        button_y = 60        

        self.buttonstartsystem.setGeometry(int((window_size[0]-button_x)/2),int(window_size[1]-(window_size[1]/5)),button_x,button_y)
        self.buttonstartsystem.setFont(QFont('Ariel',15))
        self.buttonstartsystem.clicked.connect(self.buttonevent)


        self.mainpcd = o3d.io.read_point_cloud("D:\\GercekAsis\\Python_Workspace\\01-PythonCode\\Helpers\\data.txt",format='xyz') 

        self.o3DRenderThread = o3DRenderThread(self)
        self.o3DRenderThread.start()


        self.mythread = TestThread()
        self.mythread.start()
  
    def buttonevent(self):
        print("Button pressed")
 

class o3DRenderThread(QtCore.QThread):


    def __init__(self,parent):
        super(o3DRenderThread,self).__init__(parent=parent)        
        self.thisparent = parent
        print("Thread has started")

    def run(self):

        while True:
                      
            a = time.time() 
            #Call the some function a few time to hard it
            pcd = self.thisparent.mainpcd.remove_radius_outlier(nb_points=500, radius=1.75)                
            pcd = self.thisparent.mainpcd.remove_radius_outlier(nb_points=500, radius=1.75)                
            pcd = self.thisparent.mainpcd.remove_radius_outlier(nb_points=500, radius=1.75)                
            pcd = self.thisparent.mainpcd.remove_radius_outlier(nb_points=500, radius=1.75)                
            
            print("time is :" + str(time.time() - a ))
       

class TestThread (QtCore.QThread):

    def __init__(self):
        super().__init__()       
        
    def run(self):

        while(True):           
            print("in test thread")
            time.sleep(0.1)
            

if __name__ == '__main__':
    
    # create pyqt5 app
    App = QApplication(sys.argv)
    # create the instance of our Window
    window = Window()
    # start the app
    os._exit(App.exec_())

Point Cloud Data is

data.txt

GHCK57 avatar Sep 09 '22 14:09 GHCK57