使用Python从3D频谱图中导出.stl或.obj
我是Python和编程的新手。但是,对于一个艺术项目,我花了上周学习使用Python进行编程,并找到了情节图书馆。太神奇了!它如此改进了我的代码! 我编写了一个代码,该代码使我可以加载.wav文件,创建3D频谱图并将3D图像导出到.png或HTML文件。 但是,我实际上想拥有的是3D频谱图的.stl或.obj文件(请参见图像)。 我已经尝试了一些事情,例如。我找到了一个在.stl中转动.png的页面。这是一个很好的选择,但不是我想要的。我有了另一个想法,我将在哪里制作3D频谱图的x .png切片,然后从切片中构建.stl。
我想知道,也许您中的某人有另一个想法或建议将3D图导出到.stl/.obj文件中,甚至绘制了3D频谱图,并立即将其导出到.stl或.obj。
非常感谢您的帮助=) 最好的 甜心90 3D光谱图
I am very new to python and programming in general. However, for an art project, I have spent the last week learning to program using python and found the plotly library. So amazing! It improved my code so much!
I have written a code which lets me load in .wav files, creating a 3D spectrogram and exporting the 3D image to either a .png or html file.
However, what I actually wanted to have is an .stl or .obj file of the 3D spectrogram (see image attached).
I have already tried a few things, eg. I found a page which turns .png in .stl. It is a good alternative but it’s not what I was looking for. I had another idea where I would make x .png slices of the 3D spectrogram and then build a .stl from the slices.
I was wondering, maybe someone of you has another idea or advice to export the 3D plot into a .stl/.obj file or even plot a 3D spectrogram and immediately export it to .stl or .obj.
Thank you very much in advance for your help =)
Bests,
Sweetheart90
3D spectrogram plot
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不那么容易。您需要将顶点连接到三角网格(形状n,3,3)
然后,您可以使用MK_STL_MESH生成和Export_stl_mesh来保存:
我忘了提及几个要点来完成答案:
玩得开心
Not that easy. You need to connect your vertices to a triangle mesh (shape n, 3, 3)
Then you can use mk_stl_mesh to generate and export_stl_mesh to save:
I forgot to mention a couple of important points to complete the answer:
Have fun
我进一步尝试了一些事情。我在matplob lib中发现了MTRI函数,该功能应绘制带有三角形的3D表面。到目前为止,一切都很好。这是我的代码
,我收到错误:“ valueError:x和y必须是相等的1D数组”。
问题:
从编程的角度来看,我理解错误,因为freq_bins和时间戳的数组的长度不相同。但是,在图中,我看到每个时间戳值都具有“专用” freq_bins值和z值。因此,为什么我会收到此错误?
I have further tried things. I found the mtri function in matplob lib which should plot a 3D surface with triangles. so far so good. this is my code
Now, I receive the error: "ValueError: x and y must be equal-length 1D arrays".
Question:
From a programming point of view, I understand the error, as the length of the arrays of the freq_bins and the timestamps are not the same. However in the plot I see that every timestamps value has "dedicated" freq_bins values and also z values. Thus, why do I then receive this error?