# How to remove indentation from an image border

I have the following image (fig 1) with the extracted points from the geomagic software (Please see the point list in the attached link).

https://pastebin.com/K51N8Kfa

I would like to know how I can remove the indented boundaries of the shape to make it uniform.

• You've given us an un-triangulated point cloud with no face information. Can you export the model from geomagic instead of just the points? I'm assuming you want to trim the top of the shape and the bottom so they're flat right? – flinty Jun 29 '20 at 18:11
• Thank you very much flinty! you have always been very helpful. Yes, exactly I need to trim the bottom and top border. As an output from the software, I have just a 2D JPG image and a cloud of points in 3D. It would be great if I can manipulate the points because my remaining work will be on points and not images. – Mehdi Ebadi Jun 29 '20 at 18:33

## 1 Answer

To my disappointment, I was unable to fix the mesh. Here's what did and maybe this will help somebody else. I generate the mesh and a bounding box. I then shrink the bounding box in the desired axis by 80% which is enough to level off the rough bits at the top and bottom. I then take the intersection of the mesh and the scaled box ... and nothing happens, because Mathematica's CSG / region handling is buggy and hard to use. My attempts to solidify the mesh, close the holes, RepairMesh etc. were useless in the end.

ncvxh = ResourceFunction["NonConvexHullMesh"];
bbox = BoundingRegion[Data3D];
scaledbbox = ScalingTransform[{1, 0.8, 1}, Mean[Data3D]][bbox];
Graphics3D[{msh, Opacity[.8], scaledbbox}]

RegionIntersection[DiscretizeGraphics@scaledbbox, msh]


Instead of using Mathematica's RegionIntersection I created the mesh as above and I then did Export["mesh.obj",msh] which allowed me to edit it in other software. However the mesh produced by "NonConvexHullMesh" has very poor topology and triangles going through each other. I suggest you look into geomagic's booleans and see if you can level off the top and bottom parts of the mesh using a cut.

• Thanks a lot, flinty. As you said I think the only way is dealing with Geomagic. – Mehdi Ebadi Jun 30 '20 at 2:56