1
$\begingroup$

I am using a grayscale image to generate a 3D topology, with the help of ListPlot3D. However, the output mesh resolution is far too high for my purposes. I need to find a way to reduce the output mesh resolution generated by ListPlot3D[].

I have searched extensively through the documentation and this site for a way to resolve this, but I haven't figured it out yet. Currently, this is my code:

currentImData = ImageData[image];
mesh = ListPlot3D[currentImData*50, PlotRange -> All, 
 Filling -> Bottom, FillingStyle -> Orange]

Is there a simple argument that I've been missing that allows me to specify the resolution of the output mesh?

Edit: Here are some images to better demonstrate. The first is the input image, and the second is the output given:

Input image

High poly count

It can be seen that the poly count is very high for the output. I would like to have a much lower poly count so that, when exported, the 3D file (.stl) takes up less memory.

$\endgroup$
  • $\begingroup$ Your added example doesn't evaluate in Mathemetica v12 $\endgroup$ – Ulrich Neumann Jul 14 at 20:53
  • $\begingroup$ Thanks, I must've accidentally deleted a part of the code. I simplified it and verified the updated code is working in 12.1. $\endgroup$ – Jmeeks29ig Jul 14 at 23:20
  • $\begingroup$ It's still not running on v12.0 $\endgroup$ – Ulrich Neumann Jul 15 at 7:05
3
$\begingroup$

Try to use the options MeshFunctions and Mesh

For example

image = Import["ExampleData/ocelot.jpg"]

enter image description here

currentImData = ImageData[ImageResize[image, 30]];
mesh = ListPlot3D[currentImData, InterpolationOrder -> 2,AspectRatio -> 1, 
PlotRange -> {{0, Dimensions[currentImData][[1]]}, {0,Dimensions[currentImData][[2]]}, {0, 1 }}, Filling -> Bottom,FillingStyle -> Orange, 
Mesh ->  {Range[0, 1, .1]} ,MeshFunctions -> {#3 &}]

enter image description here

Perhaps that's what you are looking for?

| improve this answer | |
$\endgroup$
  • $\begingroup$ Thanks, that looks good, however it still seems to have a pretty high poly count. I tried uploading an image to demonstrate what I meant but it wasn't working, so I'll try and update my question with some images. Basically, I just want to have a lower poly count for exporting to a 3D .stl file. $\endgroup$ – Jmeeks29ig Jul 14 at 20:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.