I have a csv file that encodes elevation data of a 9000x5000 resolution photo of a dam, and I want to generate an stl file that I can print on my 3d printer. The csv has 3 parameters: X, Y, and Z, where X & Y denote a pixel location on the photo and Z is the elevation of the topography at Pixel (X,Y).
I want a 3D stl file of the photo in question with the nooks, crannies, and hills denoted by the elevation data. I attempted to do this using the Python library numpy-stl, but I'm realizing that I just don't know enough about stl files to accomplish the print job.
Any information on how I can make this file, or on how stl files encode information would be remarkably helpful.
Generate stl mesh from csv
4.6k Views Asked by Robby Gottesman At
1
There are 1 best solutions below
Related Questions in PYTHON
- How to store a date/time in sqlite (or something similar to a date)
- Instagrapi recently showing HTTPError and UnknownError
- How to Retrieve Data from an MySQL Database and Display it in a GUI?
- How to create a regular expression to partition a string that terminates in either ": 45" or ",", without the ": "
- Python Geopandas unable to convert latitude longitude to points
- Influence of Unused FFN on Model Accuracy in PyTorch
- Seeking Python Libraries for Removing Extraneous Characters and Spaces in Text
- Writes to child subprocess.Popen.stdin don't work from within process group?
- Conda has two different python binarys (python and python3) with the same version for a single environment. Why?
- Problem with add new attribute in table with BOTO3 on python
- Can't install packages in python conda environment
- Setting diagonal of a matrix to zero
- List of numbers converted to list of strings to iterate over it. But receiving TypeError messages
- Basic Python Question: Shortening If Statements
- Python and regex, can't understand why some words are left out of the match
Related Questions in NUMPY
- Why numpy.vectorize calls vectorized function more times than elements in the vector?
- Producing filtered random samples which can be replicated using the same seed
- Numpy array methods are faster than numpy functions?
- When I create a series of spectrograms from a long audio file, the colour intesities vary noticably
- How do I fix a NumPy ValueError for an inhomogeneous array shape?
- How should I troubleshoot "RuntimeWarning: invalid value encountered in arccos" in NumPy?
- Unravel by multi-index/group
- Calculating IRR Using Numpy
- Integrating with an array of upper limits without sacrificing time efficiency
- Why doesn't this code work? - Backpropagation algorithm
- How to remove integers from a mixed numpy array containing sub-arrays and integers?
- How to transfer object dataframe in sklearn.ensemble methods
- Rust cannot borrow as mutable
- Why does the following code detect this matrix as a non-singular matrix?
- How to detect the exact boundary of a Sudoku using OpenCV when there are multiple external boundaries?
Related Questions in STL-FORMAT
- How to extract vertices and faces from a STL file
- Converting a gpx file to an stl file : reactJS
- AttributeError: Calling operator "bpy.ops.import_scene.obj" error, could not be found
- Stl-Format File Search Engine Not Preforming Searches Correctly
- Three.js stl rendering code doesn't display anything
- How to view the slices of a 3d stl file separately in Python?
- How to view the slices of a 3d image separately in Open3d Python?
- How to display a 3d image of .stl file
- Buggy Artifacts at Slicing .stl Models
- Android Studio (java) OpenGL ES 3D Model in STL Format
- Disappearing side walls when merging extruded polygons in PyVista
- Python VTKPlotLib how to remove existing mesh
- Calculating the thickness of an stl file
- Python code to check whether a point is inside a given mesh
- Python Dash STL Rendering with VTK
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
What you have is a collection of vertices. However, what STL encodes is a list of triangles. So what you need to do is to construct triangular mesh connecting your vertices. I assume that you want to code it yourself and I will provide you some hints on how to do it.
First, you should find out, whether your points are structured or not. By structured I mean that the x- and y-coordinates of the points form a regular grid (this is often the case when the data are obtained from airborne scanning).
If the points are structured
If the points are structured, you have a decent chance of constructing the mesh by yourself. Denote P(i,j) the point (X[i],Y[j],Z[i,j]), that is, the point whose first coordinate is the i-th number in the list of the x-coordinates, whose second coordinate is the j-th number in the list of y-coordinates and whose third coordinate is the z-coordinate corresponding to the first two. Figure 1 illustrates.
Now you need to decide the orientation of your triangles. They all should be either positively (counter-clockwise) or negatively oriented (clockwise). Assuming you decide for negative orientation, you can now create the triangle connecting the points P(i,j), P(i+1,j) and P(i+1,j+1). See Figure 2.
In the next step, you can create the neighbouring triangle with the same orientation, say P(i,j), P(i+1,j+1), P(i,j+1). See the darker triangle in Figure 3.
Proceeding the same way for all suitable i's and j's, you can obtain all the necessary triangles.
The only missing part is the normal for each triangle. This you can compute with a cross-product as suggested in this answer.
Now you are ready to write everything to your file. Following the description on Wikipedia, for each triangle you write its normal and the three vertices.
If the points aren't structured
In this situation you don't have much chance of creating your mesh without a significant study of meshing methods (you will probably need to learn about Delaunay triangulations). Fortunately, there are some libraries available. For instance, Fade2.5D is a C++ library that can help you and it is free of charge for personal non-commercial research. Maybe there is something similar available for Python as well.