在Meshlabserver中将自动默认值与过滤脚本一起使用

时间:2019-12-15 09:32:31

标签: meshlab

我想使用过滤器脚本来运行Hausdorff距离过滤器并通过顶点质量着色。 从GUI MeshLab创建* .mlx过滤器脚本时,我获得了Hausdorff距离过滤器中 SampleNum MaxDist 的默认计算值以及Colorize的 Max 值过滤器。

这些是* .mlx文件:

<!DOCTYPE FilterScript>
<FilterScript>
 <filter name="Remove Duplicate Vertices"/>
 <filter name="Hausdorff Distance">
  <Param value="0" tooltip="The mesh whose surface is sampled. For each sample we search the closest point on the Target Mesh." name="SampledMesh" type="RichMesh" description="Sampled Mesh"/>
  <Param value="1" tooltip="The mesh that is sampled for the comparison." name="TargetMesh" type="RichMesh" description="Target Mesh"/>
  <Param value="false" tooltip="Save the position and distance of all the used samples on both the two surfaces, creating two new layers with two point clouds representing the used samples." name="SaveSample" type="RichBool" description="Save Samples"/>
  <Param value="true" tooltip="For the search of maxima it is useful to sample vertices and edges of the mesh with a greater care. It is quite probably the the farthest points falls along edges or on mesh vertexes, and with uniform montecarlo sampling approachesthe probability of taking a sample over a vertex or an edge is theoretically null.&lt;br>On the other hand this kind of sampling could make the overall sampling distribution slightly biased and slightly affects the cumulative results." name="SampleVert" type="RichBool" description="Sample Vertexes"/>
  <Param value="true" tooltip="See the above comment." name="SampleEdge" type="RichBool" description="Sample Edges"/>
  <Param value="false" tooltip="See the above comment." name="SampleFauxEdge" type="RichBool" description="Sample FauxEdge"/>
  <Param value="true" tooltip="See the above comment." name="SampleFace" type="RichBool" description="Sample Faces"/>
  <Param value="30514" tooltip="The desired number of samples. It can be smaller or larger than the mesh size, and according to the choosed sampling strategy it will try to adapt." name="SampleNum" type="RichInt" description="Number of samples"/>
  <Param min="0" value="233.888" tooltip="Sample points for which we do not find anything whithin this distance are rejected and not considered neither for averaging nor for max." name="MaxDist" type="RichAbsPerc" description="Max Distance" max="468.287"/>
 </filter>
</FilterScript>
<!DOCTYPE FilterScript>
<FilterScript>
 <filter name="Colorize by vertex Quality">
  <Param value="0" tooltip="The value that will be mapped with the lower end of the scale (blue)" name="minVal" type="RichFloat" description="Min"/>
  <Param value="0.8" tooltip="The value that will be mapped with the upper end of the scale (red)" name="maxVal" type="RichFloat" description="Max"/>
  <Param min="0" value="0" tooltip="If not zero this value will be used for a percentile cropping of the quality values.&lt;br> If this parameter is set a value P to &lt;i>P&lt;/i> then the two values &lt;i>V_min,V_max&lt;/i> for which &lt;i>P&lt;/i>% of the vertices have a quality &lt;b>lower or greater than &lt;i>V_min,V_max&lt;/i> are used as min/max values for clamping.&lt;br>&lt;br> The automated percentile cropping is very useful for automatically discarding outliers." name="perc" type="RichDynamicFloat" description="Percentile Crop [0..100]" max="100"/>
  <Param value="false" tooltip="If true the min max range will be enlarged to be symmertic (so that green is always Zero)" name="zeroSym" type="RichBool" description="Zero Simmetric"/>
 </filter>
</FilterScript>

问题是,这些值是基于用于创建* .mlx文件的特定网格计算的,我想将其用于不适合这些网格的另一组网格。

是否有一种方法可以设置过滤脚本以使用当前模型的默认值(如在GUI中所做的那样-在其中使用默认值打开对话框)?

如果这不可能,我如何计算每个网格的3个值?

谢谢:)

1 个答案:

答案 0 :(得分:0)

Hausdorff Distance对话框出现在meshlab中时,并且在您单击Apply按钮之前,程序将为对话框中的参数分配一些默认值。

Hausdorff Distance Dialog

  • 样本数或 SampleNum 被计算为“采样网格”的顶点数
  • 最大距离或 MaxDist ,是“采样网格”的边界框对角线长度的5%

这些值仅用于加速距离计算,但您可以在其中放置任何内容。只需将Hausdorff.mlx文件更改为SampleNum=99999MaxDist=9999或任意数量的数字,您将获得相同的值。

对于Colorize by vertex Quality过滤器,最大值是0.0到1.0之间的数字,该值将乘以质量中的较大值以计算出质量的上限钳位值。因此Max=1.0应该是每个网格的安全值。

主题外:我不知道您是否知道MLX (or MeshLabXML)项目。这是一个Python库,可帮助您编写可由meshlabserver执行的.mlx文件。这可以帮助您自动创建适用于每对网格的.mlx过滤器。