diff --git a/calibration.py b/calibration.py index cca4b14..8ef749c 100755 --- a/calibration.py +++ b/calibration.py @@ -20,7 +20,10 @@ def print_error(msg: str): def calibrate(input_dir: str): # Load all images - image_names = list(filter(lambda x: x != 'calibration.json', sorted(os.listdir(input_dir)))) + image_names = sorted([ + x for x in os.listdir(input_dir) + if x != 'calibration.json' and x != 'all_on.jpg' and x != 'all_off.jpg' and x.endswith('.jpg') + ]) images = [np.asarray(Image.open(os.path.join(input_dir, x))) for x in image_names] # Camera parameters diff --git a/camera.py b/camera.py index f95434a..4e703e6 100644 --- a/camera.py +++ b/camera.py @@ -22,10 +22,10 @@ class RealCamera(Camera): def capture(self, output_path: str) -> bool: try: file_path = self.inner.capture(gp.GP_CAPTURE_IMAGE) - preview = self.inner.file_get(file_path.folder, file_path.name[:-3] + '.JPG', gp.GP_FILE_TYPE_NORMAL) + preview = self.inner.file_get(file_path.folder, file_path.name[:-3] + 'JPG', gp.GP_FILE_TYPE_NORMAL) raw = self.inner.file_get(file_path.folder, file_path.name, gp.GP_FILE_TYPE_RAW) - preview.sve(output_path + '.jpg') + preview.save(output_path + '.jpg') raw.save(output_path + '.cr2') return True diff --git a/routes/calibration.py b/routes/calibration.py index 0f58911..5c817c4 100644 --- a/routes/calibration.py +++ b/routes/calibration.py @@ -98,7 +98,7 @@ def cancel(): calibration.state = db.CalibrationState.HasData with conn: calibration.save(conn) - return redirect('/calibrate') + return redirect('/calibration/calibrate') @blueprint.route('/validate') diff --git a/templates/index.html b/templates/index.html index 43d48fb..b479aef 100644 --- a/templates/index.html +++ b/templates/index.html @@ -67,13 +67,13 @@