Hi there, I would need some help with my code...its in python, and the thing I have to do is to make points of the matrix of the object be displayed in a way to make the first camera position as a start of the coordinate system! to clarify a bit, I have camera coordinates of the viewpoints, and than would just display the object matrix by referring to the world coordinates...now I have to make it referring to the first camera position?btw, no need to say that its total amateur of python involved!so any suggestions?
have a look...
matrix = extCam.GetViewTransformObject().GetMatrix()
matrix.Invert()
pointsFromThisView = list()
width = disparity.rows
for i in range(disparity.rows):
for j in range(disparity.rows):
if disparity[i,j] >= 0:
p = [_3dImage[i,j][0]*-1,_3dImage[i,j][1],_3dImage[i,j][2], 1] #camera coordinates
pp = matrix.MultiplyPoint(p) #world coordinates I first used
pointsFromThisView.append(p)
print "Points in the current view:", len(pointsFromThisView)
mergePoints.extend(pointsFromThisView)
print "Points after merging views:", len(mergePoints)
###############
coneSource = vtk.vtkConeSource()
coneSource.SetResolution(6)
mypoints = vtk.vtkPoints()
poly = vtk.vtkPolyData()
conn = vtk.vtkCellArray()
for p in mergePoints:
mypoints.InsertNextPoint(p[0],p[1],p[2])
a = conn.InsertNextCell(1)
poly.SetPoints(mypoints)
poly.SetVerts(conn)