Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
nir_traits = {}
vis_traits = {}
# build img paths list
img_paths = []
# get imgs paths, filter out the json paths
for p in parameters['files']:
if p[-4:] == '.jpg' or p[-4:] == '.png':
img_paths.append(p)
print "printing img_paths..."
print img_paths
# build file objs - list of dicts
file_objs = []
for f in parameters['filelist']:
fmd = (extractors.download_file_metadata_jsonld(parameters['host'], parameters['secretKey'], f['id'], extractorName))[0]
#print "printing fmd..."
#print fmd
angle = fmd['content']['rotation_angle'] # -1, 0, 90, 180, 270
perspective = fmd['content']['perspective'] # 'side-view' / 'top-view'
if perspective == 'top-view': angle = -1 # set tv angle to be -1 for later sorting
camera_type = fmd['content']['camera_type'] # 'visible/RGB' / 'near-infrared'
image_id = f['id']
for p in img_paths:
print "printing p.."
print p
path = (re.findall(str(image_id), p))
print "printing path founded.."
print path
if path != []:
file_objs.append({'perspective':perspective, 'angle':angle, 'camera_type':camera_type, 'image_path': p, 'image_id': image_id})
(fields, traits) = pcia.get_traits_table()
# get imgs paths, filter out the json paths
img_paths = []
for p in parameters['files']:
if p[-4:] == '.jpg' or p[-4:] == '.png':
img_paths.append(p)
# build list of file descriptor dictionaries with sensor info
file_objs = []
for f in parameters['filelist']:
found_info = False
image_id = f['id']
# Get from file metadata if possible
file_md = extractors.download_file_metadata_jsonld(parameters['host'], parameters['secretKey'], f['id'])
for md in file_md:
if 'content' in md:
mdc = md['content']
if ('rotation_angle' in mdc) and ('perspective' in mdc) and ('camera_type' in mdc):
found_info = True
# perspective = 'side-view' / 'top-view'
perspective = mdc['perspective']
# angle = -1, 0, 90, 180, 270; set top-view angle to be -1 for later sorting
angle = mdc['rotation_angle'] if perspective != 'top-view' else -1
# camera_type = 'visible/RGB' / 'near-infrared'
camera_type = mdc['camera_type']
for pth in img_paths:
if re.findall(str(image_id), pth) != []:
file_objs.append({
'perspective': perspective,