Exemple #1
0
 # assign configuration
 config = configs[args['config']]
 
 
 
 # ===============================================================================
 # action: clean
 # ===============================================================================
 # 
 # clean all automatically generated files.
 #
 if (args['action'] == 'clean'):
     
     print "\n=== deleting generated files from directory {0} ===\n".format(args['dir'])
     
     MatchboxLib.clearDirectory(args['dir'])
     if len(args['featdir']) > 0:
         MatchboxLib.clearDirectory(args['featdir'])
     exit()
 
 # ===============================================================================
 # action: extract
 # ===============================================================================
 #
 # extract all relevant features for the duplicate detection task
 #
 if (args['action'] == 'extract') or (args['action'] == 'all'):
     
     print "\n=== extracting features from directory {0} ===\n".format(args['dir'])
     
     MatchboxLib.extractFeatures(config, args['dir'], args['sdk'],args['threads'], args['clahe'], args['featdir'], "SIFTComparison",args['downsample'])
Exemple #2
0
    config = configs[args['config']]

    if (args['binaryonly']):
        args['binary'] = True

    # ===============================================================================
    # action: clean
    # ===============================================================================
    # 
    # clean all automatically generated files.
    #
    if (args['action'] == 'clean'):

        print "\n=== deleting generated files from directory {0} ===\n".format(args['dir'])

        MatchboxLib.clearDirectory(args['dir'])
        if len(args['featdir']) > 0:
            MatchboxLib.clearDirectory(args['featdir'], args['verbose'])
        exit()

    # ===============================================================================
    # action: extract
    # ===============================================================================
    #
    # extract all relevant features for the duplicate detection task
    #
    if (args['action'] == 'extract') or (args['action'] == 'all'):
        
        print "\n=== extracting features from directory {0} ===\n".format(args['dir'])
        
        MatchboxLib.extractFeatures(config, args['dir'], args['sdk'], args['threads'], args['clahe'], args['featdir'], "SIFTComparison", args['downsample'], args['verbose'], args['binary'], args['binaryonly'])
            # create dirs for collection 2
            print "... feature directory: {0}/col2".format(args['featdir'])
            if not os.path.exists("{0}/col2".format(args['featdir'])):
                feat_dir2 = "{0}/col2".format(args['featdir'])
                os.makedirs(feat_dir2)
                
        else:
            
            feat_dir1 = args['dir1']
            feat_dir2 = args['dir2']
        
        # extract features
        
        # extract features for collection 1
        print "\n=== extracting features from directory {0} ===\n".format(args['dir1'])
        MatchboxLib.extractFeatures(config, args['dir1'], args['sdk'],args['threads'], args['clahe'], feat_dir1, "SIFTComparison")
        
        # extract features for collection 2
        print "\n=== extracting features from directory {0} ===\n".format(args['dir2'])
        MatchboxLib.extractFeatures(config, args['dir2'], args['sdk'],args['threads'], args['clahe'], feat_dir2, "SIFTComparison")
    
        print "\n=== calculating Bag of Words ===\n".format(args['dir2'])
        if not os.path.exists("{0}/bow.xml".format(feat_dir1)):
            MatchboxLib.calculateBoW(config, feat_dir1, args['filter'], args['precluster'])

        print "\n=== Searching for referencing images in both collections ===\n"
        
        print "... extract BoW Histograms of collection2"
        MatchboxLib.extractBoWHistograms(config,args['dir1'], args['threads'], feat_dir1, "{0}/bow.xml".format(feat_dir1))
        MatchboxLib.extractBoWHistograms(config,args['dir2'], args['threads'], feat_dir2, "{0}/bow.xml".format(feat_dir1))
    
Exemple #4
0
    if len(args['featdir']) > 0:
        feature_directory = args['featdir']

    # ===============================================================================
    # action: clean
    # ===============================================================================
    #
    # clean all automatically generated files.
    #
    if (args['action'] == 'clean'):

        print "\n=== deleting generated files from directory {0} ===\n".format(
            feature_directory)

        MatchboxLib.clearDirectory(feature_directory, args['verbose'])

    # ===============================================================================
    # action: extract
    # ===============================================================================
    #
    # extract all relevant features for the duplicate detection task
    #
    if (args['action'] == 'extract') or (args['action'] == 'all'):

        print "\n=== extracting features from directory {0} ===\n".format(
            collection_directory)

        MatchboxLib.extractFeatures(config, collection_directory, args['sdk'],
                                    args['threads'], args['clahe'],
                                    feature_directory, "SIFTComparison",
            print "... feature directory: {0}/col2".format(args["featdir"])
            if not os.path.exists("{0}/col2".format(args["featdir"])):
                feat_dir2 = "{0}/col2".format(args["featdir"])
                os.makedirs(feat_dir2)

        else:

            feat_dir1 = args["dir1"]
            feat_dir2 = args["dir2"]

        # extract features

        # extract features for collection 1
        print "\n=== extracting features from directory {0} ===\n".format(args["dir1"])
        MatchboxLib.extractFeatures(
            config, args["dir1"], args["sdk"], args["threads"], args["clahe"], feat_dir1, "SIFTComparison"
        )

        # extract features for collection 2
        print "\n=== extracting features from directory {0} ===\n".format(args["dir2"])
        MatchboxLib.extractFeatures(
            config, args["dir2"], args["sdk"], args["threads"], args["clahe"], feat_dir2, "SIFTComparison"
        )

        print "\n=== calculating Bag of Words ===\n".format(args["dir2"])
        if not os.path.exists("{0}/bow.xml".format(feat_dir1)):
            MatchboxLib.calculateBoW(config, feat_dir1, args["filter"], args["precluster"])

        print "\n=== Searching for referencing images in both collections ===\n"

        print "... extract BoW Histograms of collection2"