-
Notifications
You must be signed in to change notification settings - Fork 256
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
Removing boundary artifacts #567
Comments
sorry for the late reply - if i guess correctly the 2 parts of the mesh have some large overlapping... you can remove it by cutting both with a horizontal plane ( |
I had a try with it: import vedo as vd
import numpy as np
m1 = vd.Mesh("frag_3_final_dec.ply").c("green4").alpha(1)
m2 = vd.Mesh("frag_3__final_dec.ply").c("red4").alpha(1)
# m1.decimate(0.1).write('frag_3_final_dec.ply')
# m2.decimate(0.1).write('frag_3__final_dec.ply')
T = np.array([[-0.9969830354, -0.0742881466, -0.0224966296, 202.4966262662],
[0.0534353633, -0.4466713800, -0.8931009687, 363.3441404664],
[0.0562982151, -0.8916086303, 0.4492934024, 228.7605892738],
[0.0000000000, 0.0000000000, 0.0000000000, 1.0000000000]])
m3 = m1.clone()
m4 = m2.clone().applyTransform(T, reset=True)
a=60
m3.RotateX(a)
m4.RotateX(a)
m3.cutWithPlane((0,0,205),'-z')
m4.cutWithPlane((0,0,206),'z')
b3 = m3.boundaries().extractLargestRegion().c('green6')
b4 = m4.boundaries().extractLargestRegion().c('purple6')
pts3 = m3.points()
pts4 = m4.points()
pcl3 = vd.Points(pts3)
pcl4 = vd.Points(pts4)
lines=[]
pb = vd.ProgressBar(0, b3.NPoints())
for p in b3.points():
pb.print()
idx3 = pcl3.closestPoint(p, returnPointId=True)
idx4 = pcl4.closestPoint(p, returnPointId=True)
lines.append([pts3[idx3], pts4[idx4]])
pts3[idx3] = pts4[idx4]
m3.points(pts3) # update mesh vertices to seal the gap
m = vd.merge(m3,m4).clean().c('indigo5')
lns = vd.Lines(lines, lw=2)
vd.show(m3, m4, b3, b4, lns, axes=1)
vd.show(m, b3, b4, axes=1).close() you'll need to uncomment the two |
There is a method called Another idea could be to still cut with the plane to remove each side of the 2 meshes but then just forget about all faces and recreate the surface with |
Indeed, this didn't work plus it was quite slow.
Finally I found another solution, which seems to work quite nicely, by using the poisson reconstruction filter from pymeshlab: as you can see it seems to do quite some nice job. And here is the code snippet for the reference:
In any case, thanks a lot again @marcomusy. Your help is always valuable. |
Looks great ! Are you sure the result from the screened poisson is still manifold in the general case of overlapping point clouds? import vedo as vd
import numpy as np
m1 = vd.Mesh("frag_3_final.ply").c("green4")
m2 = vd.Mesh("frag_3__final.ply").c("red4")
T = np.array([[-0.9969830354, -0.0742881466, -0.0224966296, 202.4966262662],
[0.0534353633, -0.4466713800, -0.8931009687, 363.3441404664],
[0.0562982151, -0.8916086303, 0.4492934024, 228.7605892738],
[0.0000000000, 0.0000000000, 0.0000000000, 1.0000000000]])
m3 = m1.clone()
m4 = m2.clone().applyTransform(T, reset=True)
m3.rotateX(60).cutWithPlane((0,0,206),'-z')
m4.rotateX(60).cutWithPlane((0,0,206),'z')
m = vd.merge(m3,m4).clean()
mr = vd.recoSurface(m, dims=(100,100,30), radius=3).smooth()
vd.show([[m3, m4], mr], N=2, axes=1).close() at a first look the meshlab reconstruction looks better than the vtk one. |
As far as I understood, by checking on the manual, as well on some videos the result should be manifold (also checking on some of the output files they seem to be). For the overlapping regions the parameters that I used seem to do the trick for most of my models. Thus, I would stick with that and actually in the cases that it fails is due the bad retrieved sub-meshes. Yes, I noticed that the result from the meshlab lib is (or looks at least) quite good. |
Hi @marcomusy,
I have two sub-meshes, bottom and upper parts scanned with a 3d scanner, of a complete mesh which I then register in order to get this complete mesh:
Though the extracted transformation seems to work quite good, if you notice I am getting this kind of artifacts in the boundaries where it seems that the overlapping between the two sub-meshes is not perfect. I've tried to apply a smoothing filter but it didn't really help much thus I wanted to ask you if you have anything in mind that might help to get rid of or decrease the effect of these artifacts.
My initial idea was to trim the boundaries before the registration as discussed here but I still get some of them around the edges:
frag_3a.ply.zip
The text was updated successfully, but these errors were encountered: