How to fill surface with interpolated values?

조회 수: 14 (최근 30일)
Giuseppe Parisi
Giuseppe Parisi 2022년 6월 19일
댓글: Image Analyst 2022년 6월 21일
Hi,
I'm working on a mesh, resulting from an stl file . I extracted the mesh with gridtrimesh.m
This is the mesh plotted over the stl object:
As you cas see, there are some holes (for instance, the one in the red rectangle).
How can I fill the holes?
I tried with interp2, but it seems that it can't "go" beyond the surface borders.
Do you have any suggestion?
Thank you in advance for any replies.

채택된 답변

Image Analyst
Image Analyst 2022년 6월 20일
Maybe you can use scatteredInterpolant
See attached demo.

추가 답변 (1개)

the cyclist
the cyclist 2022년 6월 19일
편집: the cyclist 2022년 6월 19일
Your code does not seem to have a call to interp2, so I'm not sure what might have gone wrong there.
If you did not specify an extrapolation method explicitly, then the implicit method that MATLAB uses may have filled in NaN, depending on the interpolation method. For example, linear interpolation will fill NaN in the extrapolation region, if you do not specify the extrapolation method.
  댓글 수: 8
the cyclist
the cyclist 2022년 6월 21일
I have a hypothesis about what is going on here, but I'm not certain.
It seems from your image that the colored mesh is only covering the top surface of the gray image, and not "curling" under, to cover the parts of the face that curve underneath.
You can see that nearer the jaw, the mesh lines drop straight down to the next surface, but do not capture that inward-curving part of the surface. (I am imagining the color as if it were all dropped straight down like rain, rather than a net that would grip all sides of the face.)
This makes sense to me, because meshgrid will only yield one value of Z for each (X,Y) pair.
[Maybe you realized all this already.]
I don't have enough experience to suggest a way to fix this. @Image Analyst's idea of using scatteredInterpolant seems like a good one, though.
Image Analyst
Image Analyst 2022년 6월 21일
scatteredInterpolant will only get you the top surface. It will not curl under and give you the bottom surface. However, if that's okay, you can use it but you should find those spurious spikes and filter them out so you just have valid data.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by