[SciPy-User] STL from nArray (Delauney)

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

[SciPy-User] STL from nArray (Delauney)

Samuel Maybury
Hi all,
I’m self-taught in Python for my university honours project and its been one hell of a journey. Simply put I’m designing a 3D scanner-printer hybrid to aid in the creation of prosthetic limbs. So long story short I’m running the system on an RPi and you can find more information here, if you want to help: https://github.com/AcrimoniousMirth/Project-Adam-3D-SCANNER-CODE

So, in essence I have an array of form [[x1 y1 z1] [x2 y2 z2]… [xn yn zn]] and I need to turn it into an STL mesh. A forum member pointed me in the direction of scipy’s Delauney triangulation. 
Now, the values were appended into the array such that each group (of unknown size) will have the same z value and the next will have the closest z value to that. Due to how it was generated (with OpenCv) I can’t be entirely sure but I believe each group with the same z value was written in the same order and so the first of z1 should be close to the first of z2.

Your help is greatly appreciated as this is very new territory to me and I’m not sure where to start. This is the final hurdle in the way of me graduating with a pretty good accreditation and two charities are interested in the idea so it’d be a blessing to get it working!


Many thanks,
     Sam


_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: STL from nArray (Delauney)

Robert Kern-2
On Fri, Mar 2, 2018 at 12:46 PM, Samuel Maybury <[hidden email]> wrote:
>
> Hi all,
> I’m self-taught in Python for my university honours project and its been one hell of a journey. Simply put I’m designing a 3D scanner-printer hybrid to aid in the creation of prosthetic limbs. So long story short I’m running the system on an RPi and you can find more information here, if you want to help: https://github.com/AcrimoniousMirth/Project-Adam-3D-SCANNER-CODE
>
> So, in essence I have an array of form [[x1 y1 z1] [x2 y2 z2]… [xn yn zn]] and I need to turn it into an STL mesh. A forum member pointed me in the direction of scipy’s Delauney triangulation.
> Now, the values were appended into the array such that each group (of unknown size) will have the same z value and the next will have the closest z value to that. Due to how it was generated (with OpenCv) I can’t be entirely sure but I believe each group with the same z value was written in the same order and so the first of z1 should be close to the first of z2.
>
> Your help is greatly appreciated as this is very new territory to me and I’m not sure where to start. This is the final hurdle in the way of me graduating with a pretty good accreditation and two charities are interested in the idea so it’d be a blessing to get it working!

A Delaunay triangulation does not get you very far. We don't have much in scipy for doing mesh reconstruction from point clouds. Typically, you want to do this in an interactive environment so you can tweak parameters. Consider using MeshLab for this purpose:

  http://www.meshlab.net/

--
Robert Kern

_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: STL from nArray (Delauney)

Samuel Maybury
Hi Robert,
    Thanks for your reply! I’ll take a look. The shapes that would be scanned are very simple: cylindrical with rounded end and no holes. Wouldn’t the triangulation be able to handle the tessellation of that?

Many thanks,
                       Sam



Sent from my iPad
On 2 Mar 2018, at 10:38 pm, Robert Kern <[hidden email]> wrote:

On Fri, Mar 2, 2018 at 12:46 PM, Samuel Maybury <[hidden email]> wrote:
>
> Hi all,
> I’m self-taught in Python for my university honours project and its been one hell of a journey. Simply put I’m designing a 3D scanner-printer hybrid to aid in the creation of prosthetic limbs. So long story short I’m running the system on an RPi and you can find more information here, if you want to help: https://github.com/AcrimoniousMirth/Project-Adam-3D-SCANNER-CODE
>
> So, in essence I have an array of form [[x1 y1 z1] [x2 y2 z2]… [xn yn zn]] and I need to turn it into an STL mesh. A forum member pointed me in the direction of scipy’s Delauney triangulation.
> Now, the values were appended into the array such that each group (of unknown size) will have the same z value and the next will have the closest z value to that. Due to how it was generated (with OpenCv) I can’t be entirely sure but I believe each group with the same z value was written in the same order and so the first of z1 should be close to the first of z2.
>
> Your help is greatly appreciated as this is very new territory to me and I’m not sure where to start. This is the final hurdle in the way of me graduating with a pretty good accreditation and two charities are interested in the idea so it’d be a blessing to get it working!

A Delaunay triangulation does not get you very far. We don't have much in scipy for doing mesh reconstruction from point clouds. Typically, you want to do this in an interactive environment so you can tweak parameters. Consider using MeshLab for this purpose:

  http://www.meshlab.net/

--
Robert Kern
_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user

_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: STL from nArray (Delauney)

Prabhu Ramachandran-2
In reply to this post by Samuel Maybury
On 3/3/18 2:16 AM, Samuel Maybury wrote:
Hi all,
I’m self-taught in Python for my university honours project and its been one hell of a journey. Simply put I’m designing a 3D scanner-printer hybrid to aid in the creation of prosthetic limbs. So long story short I’m running the system on an RPi and you can find more information here, if you want to help: https://github.com/AcrimoniousMirth/Project-Adam-3D-SCANNER-CODE

So, in essence I have an array of form [[x1 y1 z1] [x2 y2 z2]… [xn yn zn]] and I need to turn it into an STL mesh. A forum member pointed me in the direction of scipy’s Delauney triangulation. 
Now, the values were appended into the array such that each group (of unknown size) will have the same z value and the next will have the closest z value to that. Due to how it was generated (with OpenCv) I can’t be entirely sure but I believe each group with the same z value was written in the same order and so the first of z1 should be close to the first of z2.

Your help is greatly appreciated as this is very new territory to me and I’m not sure where to start. This is the final hurdle in the way of me graduating with a pretty good accreditation and two charities are interested in the idea so it’d be a blessing to get it working!
This isn't going to do the triangulation but is handy to manipulate STL files from Python:

https://github.com/WoLpH/numpy-stl

cheers,
Prabhu

_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: STL from nArray (Delauney)

Samuel Maybury
Hi Prabhu,
      Yes, I looked at numpy-STL first, it was actually the creator, Rick Van Hattem, who suggested I look at Delaunay :)

On 3 Mar 2018, at 4:08 am, Prabhu Ramachandran <[hidden email]> wrote:

On 3/3/18 2:16 AM, Samuel Maybury wrote:
Hi all,
I’m self-taught in Python for my university honours project and its been one hell of a journey. Simply put I’m designing a 3D scanner-printer hybrid to aid in the creation of prosthetic limbs. So long story short I’m running the system on an RPi and you can find more information here, if you want to help: https://github.com/AcrimoniousMirth/Project-Adam-3D-SCANNER-CODEhttps://github.com/AcrimoniousMirth/Project-Adam-3D-SCANNER-CODE

So, in essence I have an array of form [[x1 y1 z1] [x2 y2 z2]… [xn yn zn]] and I need to turn it into an STL mesh. A forum member pointed me in the direction of scipy’s Delauney triangulation. 
Now, the values were appended into the array such that each group (of unknown size) will have the same z value and the next will have the closest z value to that. Due to how it was generated (with OpenCv) I can’t be entirely sure but I believe each group with the same z value was written in the same order and so the first of z1 should be close to the first of z2.

Your help is greatly appreciated as this is very new territory to me and I’m not sure where to start. This is the final hurdle in the way of me graduating with a pretty good accreditation and two charities are interested in the idea so it’d be a blessing to get it working!
This isn't going to do the triangulation but is handy to manipulate STL files from Python:

https://github.com/WoLpH/numpy-stl

cheers,
Prabhu
_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user

_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: STL from nArray (Delauney)

Hazen Babcock-2
In reply to this post by Prabhu Ramachandran-2
On 03/02/2018 11:17 PM, [hidden email] wrote:

>
> Message: 3
> Date: Fri, 02 Mar 2018 22:44:04 +0000
> From: Samuel Maybury <[hidden email]>
> To: SciPy Users List <[hidden email]>
> Subject: Re: [SciPy-User] STL from nArray (Delauney)
> Message-ID: <[hidden email]>
> Content-Type: text/plain; charset="utf-8"
>
> Hi Robert,
>      Thanks for your reply! I?ll take a look. The shapes that would be scanned are very simple: cylindrical with rounded end and no holes. Wouldn?t the triangulation be able to handle the tessellation of that?
>
> Many thanks,
>                         Sam
>

If they are really simple you might consider programmatically creating
an OpenSCAD file with the appropriate shapes (cylinder + sphere on the
end?), then using OpenSCAD to create the STL file.

http://www.openscad.org/

-Hazen
_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: STL from nArray (Delauney)

Samuel Maybury
      Well the illustration of cylinder + sphere was simply to give an idea of the general shape of the objects being scanned (and stored in the numpy array). Creating one would serve no purpose.
      I’ve done more research and I believe the pyntcloud Library will work much better. Currently struggling to get numba to install on my Pi though.

Many thanks,
                       Sam

> On 3 Mar 2018, at 6:08 pm, Hazen Babcock <[hidden email]> wrote:
>
>> On 03/02/2018 11:17 PM, [hidden email] wrote:
>> Message: 3
>> Date: Fri, 02 Mar 2018 22:44:04 +0000
>> From: Samuel Maybury <[hidden email]>
>> To: SciPy Users List <[hidden email]>
>> Subject: Re: [SciPy-User] STL from nArray (Delauney)
>> Message-ID: <[hidden email]>
>> Content-Type: text/plain; charset="utf-8"
>> Hi Robert,
>>     Thanks for your reply! I?ll take a look. The shapes that would be scanned are very simple: cylindrical with rounded end and no holes. Wouldn?t the triangulation be able to handle the tessellation of that?
>> Many thanks,
>>                        Sam
>
> If they are really simple you might consider programmatically creating an OpenSCAD file with the appropriate shapes (cylinder + sphere on the end?), then using OpenSCAD to create the STL file.
>
> http://www.openscad.org/
>
> -Hazen
> _______________________________________________
> SciPy-User mailing list
> [hidden email]
> https://mail.python.org/mailman/listinfo/scipy-user
_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user