def showNormals(s,figm=None,algo='sobel',color=(1,0,0),as2D=False): s.getNormals(algo) if as2D: if figm is None: figm = plt.figure() I = (s.n.copy()+1.0)*0.5 # make non negative I[np.logical_not(s.mask),0] = 0.; I[np.logical_not(s.mask),1] = 0.; I[np.logical_not(s.mask),2] = 0.; plt.imshow(I) else: if figm is None: figm = mlab.figure(bgcolor=(1,1,1)) M = Sphere(2) M.plotFanzy(figm,1.0,linewidth=1) mlab.points3d(s.n[s.mask,0],s.n[s.mask,1],s.n[s.mask,2], scale_factor=0.01, color=color, figure=figm, mode='point',mask_points=1) return figm
# figm1 = rgbd.showNormals(as2D=True); # figm1.show() # plt.show() # plt.show() # figm2 = rgbd.showWeightedNormals(algo=algo) # fig = rgbd.showAxialSigma() # fig = rgbd.showLateralSigma(theta=30.0) #fig = rgbd.bilateralDepthFiltering(theta=30.0) # figm0 = rgbd.showPc(showNormals=True,algo=algo) # figm1 = rgbd.showNormals() # show raw normals figm1 = mlab.figure(bgcolor=(1, 1, 1)) M = Sphere(2) M.plotFanzy(figm1, 1.0) from js.utils.plot.colors import colorScheme rgbd.n[2, :] *= -1. figm1 = rgbd.showNormals(figm=figm1, color=colorScheme("labelMap")["orange"]) # show clustered normals figm3 = mlab.figure(bgcolor=(1, 1, 1)) M = Sphere(2) M.plotFanzy(figm1, 1.0) mlab.points3d(n[0, :], n[1, :], n[2, :], -z[-1, :], colormap='jet', mode='point') # for k in range(K):
# figm1.show() # plt.show() # plt.show() # figm2 = rgbd.showWeightedNormals(algo=algo) # fig = rgbd.showAxialSigma() # fig = rgbd.showLateralSigma(theta=30.0) #fig = rgbd.bilateralDepthFiltering(theta=30.0) # figm0 = rgbd.showPc(showNormals=True,algo=algo) # figm1 = rgbd.showNormals() # show raw normals figm1 = mlab.figure(bgcolor=(1,1,1)) M = Sphere(2) M.plotFanzy(figm1,1.0) from js.utils.plot.colors import colorScheme rgbd.n[2,:] *= -1. figm1=rgbd.showNormals(figm=figm1,color=colorScheme("labelMap")["orange"]) # show clustered normals figm3 = mlab.figure(bgcolor=(1,1,1)) M = Sphere(2) M.plotFanzy(figm1,1.0) mlab.points3d(n[0,:],n[1,:],n[2,:],-z[-1,:],colormap='jet', mode='point') # for k in range(K): # ids = z[-1,:]==k # if np.count_nonzero(ids) > 0: # mlab.points3d(n[0,ids],n[1,ids],n[2,ids],color=((float(k)/K),0,0), # mode='point') mlab.show(stop=True)