Eliminare 'src/LFBulkExtractionToDB.py'
This commit is contained in:
parent
ae47cc326f
commit
dffb1c25f3
|
|
@ -1,40 +0,0 @@
|
||||||
from pathlib import Path
|
|
||||||
import tqdm
|
|
||||||
|
|
||||||
import LFUtilities
|
|
||||||
import BEBLIDExtractorQ as lf
|
|
||||||
import argparse
|
|
||||||
import os
|
|
||||||
from LFDB import LFDB
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
parser = argparse.ArgumentParser(description='LF bulk extraction')
|
|
||||||
parser.add_argument('src', type=str, help='img src folder path')
|
|
||||||
parser.add_argument('dest', type=str, help='LF DB file')
|
|
||||||
|
|
||||||
args = parser.parse_args()
|
|
||||||
src = args.src
|
|
||||||
dest = args.dest
|
|
||||||
|
|
||||||
lf_db = LFDB(dest)
|
|
||||||
|
|
||||||
paths = Path(src).rglob('*.*')
|
|
||||||
paths_list = list(paths)
|
|
||||||
|
|
||||||
print('Extracting lf...')
|
|
||||||
for path in tqdm.tqdm(paths_list):
|
|
||||||
try:
|
|
||||||
kp, des = lf.extract(os.path.join(path.parent, path.name))
|
|
||||||
features = LFUtilities.pickle_keypoints(kp, des)
|
|
||||||
blob = LFUtilities.serialize_object(features)
|
|
||||||
filename = os.path.splitext(path.name)[0]
|
|
||||||
lf_db.put(filename, blob)
|
|
||||||
except Exception as e:
|
|
||||||
print("cannot process '%s'" % path)
|
|
||||||
print(e)
|
|
||||||
pass
|
|
||||||
|
|
||||||
lf_db.commit()
|
|
||||||
lf_db.close()
|
|
||||||
print('lf extracted.')
|
|
||||||
Loading…
Reference in New Issue