Closed NickMortimer closed 1 year ago
def strip_image(file):
try:
with open(file, "r") as read_file:
data = json.load(read_file)
if data.get('imageData'):
data['imageData'] = None
# Serializing json
json_object = json.dumps(data, indent=2)
# Writing to sample.json
with open(file, "w") as outfile:
outfile.write(json_object)
return {'file':file, 'Strip':'True'}
return {'file':file, 'Strip':'False'}
except:
return {'file':file, 'Strip':'Bad'}
def process_json(dependencies, targets):
output = pd.DataFrame.from_records([strip_image(file) for file in dependencies])
output.to_csv(targets[0])
def loadshapes(file):
print(file)
lines =[]
with open(file, "r") as read_file:
data = json.load(read_file)
#data = json.loads(''.join(lines).replace("\n", "").replace("'", '"').replace('u"', '"'))
data =pd.DataFrame(data['shapes'])
data['FilePath'] =file
return(data)
def process_labelme(dependencies, targets):
jsonfiles = glob.glob(os.path.join(os.path.dirname(targets[0]),'*.json'))
if jsonfiles:
data = pd.concat([loadshapes(file) for file in jsonfiles])
else:
data = pd.DataFrame()
data.to_csv(targets[0],index=False)
completed and added using labelme +code from above
Identify ground control points in the images. possibly using label me
https://github.com/NickMortimer/labelme