Skip to content

SanCamillo-NeurophysiologyLab/spot3d-obj2ply

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SPOT3D - .obj 2 .ply

This simple scripts converts a file .obj acquired with the new Structure Sensor 3 to a file .ply compatible with Spot3D (i.e. colorized vertices and scale in mm).

Usage

Create a python environment and install the requirements

python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

Run the script (from the activated environment)

python obj2ply.py input.obj output.ply

output.ply is an optional arguments. If it is missing the output will be input.ply.

If you want to overwrite the output file add the flag -f (or the equivalent --force).

The usage is simple, but you can find a reminder of that in the help

>>> python obj2ply.py -h
 ____   ____    ___   _____  _____  ____  
/ ___| |  _ \  / _ \ |_   _||___ / |  _ \ 
\___ \ | |_) || | | |  | |    |_ \ | | | |
 ___) ||  __/ | |_| |  | |   ___) || |_| |
|____/ |_|     \___/   |_|  |____/ |____/ 
                                          

           _        _   ____              _        
     ___  | |__    (_) |___ \      _ __  | | _   _ 
    / _ \ | '_ \   | |   __) |    | '_ \ | || | | |
 _ | (_) || |_) |  | |  / __/   _ | |_) || || |_| |
(_) \___/ |_.__/  _/ | |_____| (_)| .__/ |_| \__, |
                 |__/             |_|        |___/ 

usage: obj2ply.py [-h] [-f] [-v] input [output]

Convert obj file to colorized ply scaled in mm. Compatible with Spot3D.

positional arguments:
  input          the input .obj file
  output         the output .ply file. Default input.ply

optional arguments:
  -h, --help     show this help message and exit
  -f, --force    force to overwrite the output
  -v, --verbose  set verbose output

Credits

It is a simple python script which uses the pymeshlab library. The script is an adaptation of the very useful instruction on how to convert a .obj to .ply in meshlab.

Pipeline

  1. Load the .obj
  2. Scale the mesh from m to mm
  3. Centralize the mesh
  4. Rotate
  5. Subdivide the mesh
  6. Colorize the vertices
  7. Triangularize faces
  8. Export the .ply

About

Convert 3d objects from .obj to .ply compatible with SPOT3D

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages