|
@@ -12,15 +12,24 @@ import rasterio |
|
|
|
|
|
|
|
|
arg_parser = argparse.ArgumentParser(description='Export SVG composition of FLIR images as TIFF with thermo layer') |
|
|
arg_parser = argparse.ArgumentParser(description='Export SVG composition of FLIR images as TIFF with thermo layer') |
|
|
|
|
|
|
|
|
arg_parser.add_argument('Input', |
|
|
|
|
|
metavar='input_svg', |
|
|
|
|
|
type=str, |
|
|
|
|
|
help='Path to the input SVG file cotaining xlinks to FLIR images') |
|
|
|
|
|
|
|
|
|
|
|
arg_parser.add_argument('Output', |
|
|
|
|
|
metavar='output_tiff', |
|
|
|
|
|
type=str, |
|
|
|
|
|
help='Output filename') |
|
|
|
|
|
|
|
|
arg_parser.add_argument( |
|
|
|
|
|
'Input', |
|
|
|
|
|
metavar='input_svg', |
|
|
|
|
|
type=str, |
|
|
|
|
|
help='Path to the input SVG file cotaining xlinks to FLIR images') |
|
|
|
|
|
|
|
|
|
|
|
arg_parser.add_argument( |
|
|
|
|
|
'Output', |
|
|
|
|
|
metavar='output_tiff', |
|
|
|
|
|
type=str, |
|
|
|
|
|
help='Output filename' |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
arg_parser.add_argument( |
|
|
|
|
|
'--use-mask', action='store_true', |
|
|
|
|
|
help="Using soft edges for smooth transitions between tiles", |
|
|
|
|
|
dest='use_mask' |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
args = arg_parser.parse_args() |
|
|
args = arg_parser.parse_args() |
|
@@ -89,15 +98,20 @@ def make_thermalpng_svg(): |
|
|
root = tree.getroot() |
|
|
root = tree.getroot() |
|
|
# print(ET.tostring(root)) |
|
|
# print(ET.tostring(root)) |
|
|
# tile_rows = root.xpath('//image', namespaces={'n': "http://www.w3.org/2000/svg"}) |
|
|
# tile_rows = root.xpath('//image', namespaces={'n': "http://www.w3.org/2000/svg"}) |
|
|
# print(dir(root)) |
|
|
|
|
|
tile_elements = root.xpath('//*[@class="thermal_image"]') |
|
|
tile_elements = root.xpath('//*[@class="thermal_image"]') |
|
|
linkattrib ='{http://www.w3.org/1999/xlink}href' |
|
|
linkattrib ='{http://www.w3.org/1999/xlink}href' |
|
|
for tile in tile_elements: |
|
|
for tile in tile_elements: |
|
|
new_file_path = os.path.join(THERMALPNG_DIR, tile.attrib[linkattrib] + '.thermal.png') |
|
|
new_file_path = os.path.join(THERMALPNG_DIR, tile.attrib[linkattrib] + '.thermal.png') |
|
|
tile.attrib[linkattrib] = new_file_path |
|
|
tile.attrib[linkattrib] = new_file_path |
|
|
# Post Production |
|
|
# Post Production |
|
|
# tile.attrib["mask"] = 'url(#tilefademask)' |
|
|
|
|
|
# tile.attrib["style"] = 'opacity:.7' |
|
|
|
|
|
|
|
|
if args.use_mask: |
|
|
|
|
|
# mask_rect = root.xpath('//*[@id="mask_rect"]') |
|
|
|
|
|
# mask_rect_filter = root.xpath('//*[@id="mask_rect_filter"]') |
|
|
|
|
|
# print(mask_rect) |
|
|
|
|
|
# print(mask_rect_filter) |
|
|
|
|
|
for tile in tile_elements: |
|
|
|
|
|
tile.attrib["mask"] = 'url(#tilefademask)' |
|
|
|
|
|
# tile.attrib["style"] = 'opacity:.7' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# newxml = ET.tostring(tree, encoding="unicode") |
|
|
# newxml = ET.tostring(tree, encoding="unicode") |
|
|