Beispiel #1
0
 def addGesture(self, name, points):
     self.pointClouds.append(PointCloud(name, points))
     num = 0
     for i in range(len(self.pointClouds)):
         if self.pointClouds[i].name == name:
             num += 1
     return num
def get_plane():
    # s = 2*np.pi
    pc = PointCloud()
    for x in np.linspace(0, 1, 20):
        for y in np.linspace(0, 1, 20):
            pc.add_point(x, y, x)
    return pc
Beispiel #3
0
 def setPointCloudsDemo(self):
     self.pointClouds.append(
         PointCloud("T", [
             Point(30, 7, 1),
             Point(103, 7, 1),
             Point(66, 7, 2),
             Point(66, 87, 2)
         ]))
     self.pointClouds.append(
         PointCloud("N", [
             Point(177, 92, 1),
             Point(177, 2, 1),
             Point(182, 1, 2),
             Point(246, 95, 2),
             Point(247, 87, 3),
             Point(247, 1, 3)
         ]))
Beispiel #4
0
 def recognize(self, points):
     candidate = PointCloud("", points)
     #print("here", len(points))
     u = -1
     b = math.inf
     for i in range(len(self.pointClouds)):
         d = GreedyCloudMatch(candidate.points, self.pointClouds[i])
         if (d < b):
             b = d
             u = i
     return "No match" if u == -1 else self.pointClouds[u].name
def get_circle():
    pc = PointCloud()
    t = np.linspace(0, 2 * np.pi, 1000)
    points = []
    for k in t:
        x = np.cos(k)  # + .03*np.sin(10*k)
        y = np.sin(k)  # + .03*np.sin(10*k)
        pc.add_point(x, y, 0)
    # for _ in xrange(100):
    #     x = 2*(np.random.random()-0.5)
    #     y = 2*(np.random.random()-0.5)
    #     pc.add_point(x, y, 0)
    for pt in pc.points:
        pt.normal = -pt.position / np.sqrt(np.dot(pt.position, pt.position))
    return pc
def get_sphere():
    r = 1
    pc = PointCloud()
    for phi in np.linspace(0, np.pi, 10):
        for theta in np.linspace(0, 2 * np.pi, 10):
            z = r * np.cos(phi)
            x = r * np.sin(phi) * np.cos(theta)
            y = r * np.sin(phi) * np.sin(theta)
            # dx = (random.random() - 0.5)/ 10
            # dy = (random.random() - 0.5)/ 10
            # dz = (random.random() - 0.5)/ 10
            # pc.add_point(x+dx,y+dy,z+dz)
            pc.add_point(x, y, z)
    for pt in pc.points:
        pt.normal = -pt.position / np.sqrt(np.dot(pt.position, pt.position))

    return pc
Beispiel #7
0
from skimage import filters
import os
import time
start_time = time.time()

FILE_NAME = "T_joint_attempt_2.txt"
PIT_ANGLE = int(input('Define PIT indentation angle in degrees:'))

os.chdir("t-scans/T_joint_scans/")
print("Loading point cloud...")

if os.path.exists(FILE_NAME) == True:
    print(FILE_NAME)
    npArr = np.loadtxt(fname=FILE_NAME)
    npArr = np.delete(npArr, 3, 1)
    pcd = PointCloud(npArr, type='NPARR')
    print("Preprocessing point cloud...")
    pcd.deleteZPoints(0)
    #pcd.setOffset(0, 0, -120)
    #pcd.pcd = o3d.geometry.PointCloud.remove_statistical_outlier(pcd.pcd, 1000, 1)[0]
    pcd.getParameters()
    #np.save(processed_file, np.asarray(pcd.pcd.points))
else:
    print('Cannot access file')
    exit()

#pcd.pcd = o3d.geometry.PointCloud.remove_statistical_outlier(pcd.pcd, 1000, 1)[0]
pcd.getPointCloudLines()  # Construct arrays of point cloud lines
img = pcd.pcd_to_image()
npArr = pcd.img_to_pcd(img)
pcd = PointCloud(npArr, type='NPARR')
Beispiel #8
0
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Fri Jul  6 13:25:59 2018

@author: cameron
"""
import pointCloud.PointCloud

filePath = '/home/cameron/Dropbox/T2_Dataset/molGeom/T2_2_num_molGeom.cif'
pc = PointCloud(filePath)
pc.plot()