diff --git a/GCPMarkerAdditions/ImportMarkerFeatures.py b/GCPMarkerAdditions/ImportMarkerFeatures.py index 9378cbb..e76cca7 100644 --- a/GCPMarkerAdditions/ImportMarkerFeatures.py +++ b/GCPMarkerAdditions/ImportMarkerFeatures.py @@ -1,4 +1,4 @@ -__version__ = "1.0" +__version__ = "" from meshroom.core import desc @@ -6,6 +6,7 @@ import csv import json import struct +import itertools class ImportMarkerFeatures(desc.Node): category = 'Utils' @@ -50,11 +51,18 @@ class ImportMarkerFeatures(desc.Node): value = "", uid = [0] ), + desc.BoolParam( + name = "hack", + label = "Enable to Bypass 128-Tag Limit", + description = "This option skips the FeatureMatching node and directly generates a matches.txt file for cctag match.", + value = False, + uid = [0] + ), desc.ChoiceParam( name = "delimiter", label = "Delimiter", description = "Delimiter character used in the input CSV file.", - value = "space", + value = "comma", values = ["space", "tab", "comma", "colon", "semicolon"], exclusive = True, uid = [0] @@ -86,6 +94,13 @@ class ImportMarkerFeatures(desc.Node): description = "Output path for the features and descriptors files (*.feat, *.desc).", value = desc.Node.internalFolder, uid = [] + ), + desc.File( + name = "matches_out", + label = "Matches Folder", + description = "Link to the SFM node's Matches Folder input, witch supports multiple elements.", + value = desc.Node.internalFolder, + uid = [] ) ] @@ -95,7 +110,7 @@ def load_images(self, chunk, filepath, delimiter): with open(filepath) as file: gcp_file = csv.reader(file, delimiter=delimiter) - csv_data = [(row[2], float(row[0]), float(row[1]), float(row[4]), int(row[3])) for row in gcp_file] + csv_data = [(row[2], row[0], row[1], row[4], int(row[3])) for row in gcp_file] images.update({item[0]: [] for item in csv_data}) @@ -127,24 +142,32 @@ def write_describers(self, chunk, images, lookup): chunk.logManager.makeProgressBar(len(lookup)) found_markers = {i: 0 for i in list(set([marker[3] for img in images for marker in images[img]]))} + feature_lookup = {viewid: {} for viewid in lookup.values()} # feature_lookup[viewid][tagid] for i, img in enumerate(lookup): viewid = lookup[img] + feat = open(os.path.join(chunk.node.output.value, viewid + (".%s.feat" % chunk.node.type.value)), "w") desc = open(os.path.join(chunk.node.output.value, viewid + (".%s.desc" % chunk.node.type.value)), "wb") if img in images: + feat_idx = 0 markers = images[img] - desc.write(struct.pack('