meshlabxml/texture.py
def param_texture_from_rasters(script, textName="TEMP3D.png", texsize=1024,
                               colorCorrection=True, colorCorrectionFilterSize=1,
                               useDistanceWeight=True, useImgBorderWeight=True,
                               useAlphaWeight=False, cleanIsolatedTriangles=True,
                               stretchingAllowed=False, textureGutter=4):
    """Set texture

    """
    filter_xml = ''.join([
        '  <filter name="Parameterization + texturing from registered rasters">\n',
        '    <Param name="textureSize"',
        'value="%d"' % texsize,
        'description="Texture size"',
        'type="RichInt"',
        'tooltip="Specifies the dimension of the generated texture"',
        '/>\n',
        '    <Param name="textureName"',
        'value="%s"' % textName,
        'description="Texture name"',
        'type="RichString"',
        'tooltip="Specifies the name of the file into which the texture image will be saved"',
        '/>\n',
        '    <Param name="colorCorrection"',
        'value="%s"' % str(colorCorrection).lower(),
        'description="Color correction"',
        'type="RichBool"',
        'tooltip="If true, the final texture is corrected so as to ensure seamless transitions"',
        '/>\n',
        '    <Param name="colorCorrectionFilterSize"',
        'value="%d"' % colorCorrectionFilterSize,
        'description="Color correction filter"',
        'type="RichInt"',
        'tooltip="It is the radius (in pixel) of the kernel that is used to compute the difference between corresponding texels in different rasters. Default is 1 that generate a 3x3 kernel. Highest values increase the robustness of the color correction process in the case of strong image-to-geometry misalignments"',
        '/>\n',
        '    <Param name="useDistanceWeight"',
        'value="%s"' % str(useDistanceWeight).lower(),
        'description="Use distance weight"',
        'type="RichBool"',
        'tooltip="Includes a weight accounting for the distance to the camera during the computation of reference images"',
        '/>\n',
        '    <Param name="useImgBorderWeight"',
        'value="%s"' % str(useImgBorderWeight).lower(),
        'description="Use image border weight"',
        'type="RichBool"',
        'tooltip="Includes a weight accounting for the distance to the image border during the computation of reference images"',
        '/>\n',
        '    <Param name="useAlphaWeight"',
        'value="%s"' % str(useAlphaWeight).lower(),
        'description="Use image alpha weight"',
        'type="RichBool"',
        'tooltip="If true, alpha channel of the image is used as additional weight. In this way it is possible to mask-out parts of the images that should not be projected on the mesh. Please note this is not a transparency effect, but just influences the weigthing between different images"',
        '/>\n',
        '    <Param name="cleanIsolatedTriangles"',
        'value="%s"' % str(cleanIsolatedTriangles).lower(),
        'description="Clean isolated triangles"',
        'type="RichBool"',
        'tooltip="Remove all patches compound of a single triangle by aggregating them to adjacent patches"',
        '/>\n',
        '    <Param name="stretchingAllowed"',
        'value="%s"' % str(stretchingAllowed).lower(),
        'description="UV stretching"',
        'type="RichBool"',
        'tooltip="If true, texture coordinates are stretched so as to cover the full interval [0,1] for both directions"',
        '/>\n',
        '    <Param name="textureGutter"',
        'value="%d"' % textureGutter,
        'description="Texture gutter"',
        'type="RichInt"',
        'tooltip="Extra boundary to add to each patch before packing in texture space (in pixels)"',
        '/>\n',
        '  </filter>\n'])
    util.write_filter(script, filter_xml)
    return None
def param_texture_from_rasters(script, textName="TEMP3D.png", texsize=1024,
                               colorCorrection=True, colorCorrectionFilterSize=1,
                               useDistanceWeight=True, useImgBorderWeight=True,
                               useAlphaWeight=False, cleanIsolatedTriangles=True,
                               stretchingAllowed=False, textureGutter=4):
    """Set texture

    """
    filter_xml = ''.join([
        '  <filter name="Parameterization + texturing from registered rasters">\n',
        '    <Param name="textureSize"',
        'value="%d"' % texsize,
        'description="Texture size"',
        'type="RichInt"',
        'tooltip="Specifies the dimension of the generated texture"',
        '/>\n',
        '    <Param name="textureName"',
        'value="%s"' % textName,
        'description="Texture name"',
        'type="RichString"',
        'tooltip="Specifies the name of the file into which the texture image will be saved"',
        '/>\n',
        '    <Param name="colorCorrection"',
        'value="%s"' % str(colorCorrection).lower(),
        'description="Color correction"',
        'type="RichBool"',
        'tooltip="If true, the final texture is corrected so as to ensure seamless transitions"',
        '/>\n',
        '    <Param name="colorCorrectionFilterSize"',
        'value="%d"' % colorCorrectionFilterSize,
        'description="Color correction filter"',
        'type="RichInt"',
        'tooltip="It is the radius (in pixel) of the kernel that is used to compute the difference between corresponding texels in different rasters. Default is 1 that generate a 3x3 kernel. Highest values increase the robustness of the color correction process in the case of strong image-to-geometry misalignments"',
        '/>\n',
        '    <Param name="useDistanceWeight"',
        'value="%s"' % str(useDistanceWeight).lower(),
        'description="Use distance weight"',
        'type="RichBool"',
        'tooltip="Includes a weight accounting for the distance to the camera during the computation of reference images"',
        '/>\n',
        '    <Param name="useImgBorderWeight"',
        'value="%s"' % str(useImgBorderWeight).lower(),
        'description="Use image border weight"',
        'type="RichBool"',
        'tooltip="Includes a weight accounting for the distance to the image border during the computation of reference images"',
        '/>\n',
        '    <Param name="useAlphaWeight"',
        'value="%s"' % str(useAlphaWeight).lower(),
        'description="Use image alpha weight"',
        'type="RichBool"',
        'tooltip="If true, alpha channel of the image is used as additional weight. In this way it is possible to mask-out parts of the images that should not be projected on the mesh. Please note this is not a transparency effect, but just influences the weigthing between different images"',
        '/>\n',
        '    <Param name="cleanIsolatedTriangles"',
        'value="%s"' % str(cleanIsolatedTriangles).lower(),
        'description="Clean isolated triangles"',
        'type="RichBool"',
        'tooltip="Remove all patches compound of a single triangle by aggregating them to adjacent patches"',
        '/>\n',
        '    <Param name="stretchingAllowed"',
        'value="%s"' % str(stretchingAllowed).lower(),
        'description="UV stretching"',
        'type="RichBool"',
        'tooltip="If true, texture coordinates are stretched so as to cover the full interval [0,1] for both directions"',
        '/>\n',
        '    <Param name="textureGutter"',
        'value="%d"' % textureGutter,
        'description="Texture gutter"',
        'type="RichInt"',
        'tooltip="Extra boundary to add to each patch before packing in texture space (in pixels)"',
        '/>\n',
        '  </filter>\n'])
    util.write_filter(script, filter_xml)
    return None
Set texture