-
Notifications
You must be signed in to change notification settings - Fork 264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Visualizing Descriptors #83
Comments
Indeed But I´m not sure I understand what are you aiming for.. in any case the |
Hi import numpy as np
from scipy.interpolate import Rbf, NearestNDInterpolator as Near
from vtkplotter import *
mesh = load(datadir+"bunny.obj").normalize()
pts = mesh.points()
# make a test subset of points where descriptor is known
ptsubset = pts[:100]
# assume the descriptor value is some func of the point coord y
x, y, z = ptsubset[:,0], ptsubset[:,1], ptsubset[:,2]
desc = 3*sin(4*y)
# build the interpolator to determine the descriptor value
# for the rest of mesh vertices:
itr = Rbf(x, y, z, desc) # Radial Basis Function interpolator
#itr = Near(ptsubset, desc) # Nearest-neighbour interpolator
# interpolate desciptor values on the set of mesh vertices
xi, yi, zi = pts[:,0], pts[:,1], pts[:,2]
interpolated_desc = itr(xi, yi, zi)
rpts = Points(ptsubset, r=10, c='white')
mesh.pointColors(interpolated_desc, cmap='rainbow').addScalarBar()
show(rpts, mesh, axes=1, bg="w")
just create any other |
Hello Again :) Regarding plotting several meshes!! it didn't work with me, especially that each mesh has it's own title and let's say values, like what follows: mesh1 = vtkmeshe.pointColors(interpolated_desc_nearmean, cmap='hsv').addScalarBar()
show(rpts,mesh1,title= "Mean Curvature Descriptor", axis = 0)
mesh2 = vtkmeshe.pointColors(interpolated_desc_neargauss, cmap='hsv').addScalarBar()
show(rpts,mesh1,mesh2,title= "Shape Index Descriptor", axis = 0) I have the same scalar bar since all meshes are normalized to the same range, but different titles as well as different parameters. The second mesh appears when I close the first window of the first mesh, I have more than two mesh even but I guess rule will validate for many meshes. |
You can plot things in many different ways and combinations... and create copies with mesh1 = vtkmeshe.pointColors(interpolated_desc_nearmean, cmap='hsv').addScalarBar()
# ...
show(rpts,mesh1, at=0, N=2, title= "Mean Curvature Descriptor", axes=0)
show(rpts,mesh2, at=1, interactive=1) or use |
show(rpts,mesh1, Text('some comment'), at=0, N=3, title= "window title", axes=0)
show(rpts,mesh2, Text('some other\ncomment'), at=1, interactive=True) You can find plenty of examples here to explore the possibilities. |
I was able to solve the last situation for obj files, but the visualizing is the same... getting objects, in the same way, I showed you, not sure what I'm missing!! |
I cannot reproduce your output image... from vtkplotter import *
mesh = load(datadir+"spider.ply").normalize()
pts = mesh.points()
ptsubset = [i for i in range(0, mesh.N(), 10)]
rpts = Points(pts[ptsubset], r=5, c='white')
show(mesh, rpts) it looks like your are rotating your points... but it seems unrelated to vtkplotter.. |
Hi,
Thanks for this wonderful library!
my problem is as the following, I want to visualize 3D descriptors on the mesh, what I tend to do is like this:
my interest points are 3D coordinates they are the interest points on my mesh, and then I applied extracting descriptors on these points, so the output of
fourier_n
is summarized by this:[3655.+0.00000000e+00j -43.+1.17658631e+03j -43.+5.87507409e+02j -43.+3.90797931e+02j -43.+2.92180107e+02j -43.+2.32798157e+02j -43.+1.93033293e+02j -43.+1.64477297e+02j -43.+1.42925909e+02j -43.+1.26043295e+02j -43.+1.12427827e+02j -43.+1.01187441e+02j -43.+9.17273171e+01j -43.+8.36355483e+01j -43.+7.66178118e+01j -43.+7.04581695e+01j -43.+6.49945684e+01j -43.+6.01029870e+01j -43.+5.56868665e+01j -43.+5.16698780e+01j -43.+4.79908603e+01j -43.+4.46002021e+01j -43.+4.14572113e+01j -43.+3.85281695e+01j -43.+3.57848725e+01j -43.+3.32035203e+01j -43.+3.07638620e+01j -43.+2.84485311e+01j -43.+2.62425211e+01j -43.+2.41327696e+01j
it's the output of
fourier_n = np.fft.fftn(interest_points)
but the problem I faced is this error:
"Complex numpy arrays cannot be converted to vtk arrays."\ AssertionError: Complex numpy arrays cannot be converted to vtk arrays.Use real() or imag() to get a component of the array before passing it to vtk.
Any assist is appreciated please!
The text was updated successfully, but these errors were encountered: