STL Creation after Savitzky Filter

4 次查看(过去 30 天)
Hello All,
I have a program that will create STL files of these contours (see images). However, without using a Savitzky filter, the contours are very jagged. But, the triangulation only seems to work correctly when Savitszky filter is not used. Manipulate lines 46 and 47 to turn on or off the filter to see the difference.
Does anyone know how I can get the STLs being created correctly again but with using the Savitzky filter?
Thanks in advanced

回答(1 个)

Saurav
Saurav 2024-3-1
Hi Holden,
I understand that you wish to create contours using your program and obtain the same outcomes as when you do not utilize the Savitzky filter.
Savitzky-Golay smoothing filters are typically used to smooth out a noisy signal whose frequency span (without noise) is large. It is more effective at preserving high frequency signal components but less successful at rejecting noise.
There are restrictions on the “sgolayfilt” function: that the polynomial order needs to be less than frame length, and the input's length needs to be greater than frame length.
The function has an upper limit on how large you may keep the frame length and, consequently, the polynomial order because the input length in your scenario is already fixed.
Also, one needs to consider that if the boundaries of the objects are very complex, a simple smoothing might not be sufficient and may need a more specialized approach to handle such complexity.
Here is a workaround that can be followed:
  • In the function “sgolayfilt”, the second argument, with a value of 1, denotes a linear polynomial. This might be too simple to properly depict the data's contour. A higher polynomial order can produce a more refined shape.
  • The frame length is the third parameter of the "sgolayfit" function, and it denotes how many points the function uses for each fit. If the frame length is too short, it might not smooth the noise very well. On the other hand, if it is too long, it could end up smoothing away some of the important details of the data. To get the desired results, try out a few different frame lengths and see what works best.
To learn more about the function “sgolayfilt”, following documentation can be followed:
I hope this helps! Thanks.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by