This commit is contained in:
Nicolas Bertrand 2024-11-19 15:29:16 +01:00
parent 727ab37b0b
commit 745f95af8c
5 changed files with 10 additions and 6 deletions

View File

@ -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

View File

@ -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

View File

@ -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')

View File

@ -67,13 +67,13 @@
<form action="/object/create" method="POST">
<div class="modal-content">
<div class="field">
<label class="label">Nom du projet</label>
<label class="label has-text-white-dark">Nom du projet</label>
<div class="control">
<input class="input" type="text" name="project" placeholder="Nom du projet" required>
</div>
</div>
<div class="field">
<label class="label">Nom de l'objet</label>
<label class="label has-text-white-dark">Nom de l'objet</label>
<div class="control">
<input class="input" type="text" name="name" placeholder="Nom de l'objet" required>
</div>

View File

@ -158,6 +158,7 @@ export class Engine {
initScene(calibration: Calibration): void {
this.center = new THREE.Vector3(0, 0, 10);
this.scene = new THREE.Scene();
this.scene.background = new THREE.Color(0, 0, 0);
this.camera = new THREE.PerspectiveCamera(45, this.width / this.height, 0.001, 1000);
this.camera.position.set(0, 0, -30);