Cleaning
This commit is contained in:
parent
727ab37b0b
commit
745f95af8c
|
|
@ -20,7 +20,10 @@ def print_error(msg: str):
|
||||||
|
|
||||||
def calibrate(input_dir: str):
|
def calibrate(input_dir: str):
|
||||||
# Load all images
|
# 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]
|
images = [np.asarray(Image.open(os.path.join(input_dir, x))) for x in image_names]
|
||||||
|
|
||||||
# Camera parameters
|
# Camera parameters
|
||||||
|
|
|
||||||
|
|
@ -22,10 +22,10 @@ class RealCamera(Camera):
|
||||||
def capture(self, output_path: str) -> bool:
|
def capture(self, output_path: str) -> bool:
|
||||||
try:
|
try:
|
||||||
file_path = self.inner.capture(gp.GP_CAPTURE_IMAGE)
|
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)
|
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')
|
raw.save(output_path + '.cr2')
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ def cancel():
|
||||||
calibration.state = db.CalibrationState.HasData
|
calibration.state = db.CalibrationState.HasData
|
||||||
with conn:
|
with conn:
|
||||||
calibration.save(conn)
|
calibration.save(conn)
|
||||||
return redirect('/calibrate')
|
return redirect('/calibration/calibrate')
|
||||||
|
|
||||||
|
|
||||||
@blueprint.route('/validate')
|
@blueprint.route('/validate')
|
||||||
|
|
|
||||||
|
|
@ -67,13 +67,13 @@
|
||||||
<form action="/object/create" method="POST">
|
<form action="/object/create" method="POST">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label class="label">Nom du projet</label>
|
<label class="label has-text-white-dark">Nom du projet</label>
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<input class="input" type="text" name="project" placeholder="Nom du projet" required>
|
<input class="input" type="text" name="project" placeholder="Nom du projet" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
<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">
|
<div class="control">
|
||||||
<input class="input" type="text" name="name" placeholder="Nom de l'objet" required>
|
<input class="input" type="text" name="name" placeholder="Nom de l'objet" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -158,6 +158,7 @@ export class Engine {
|
||||||
initScene(calibration: Calibration): void {
|
initScene(calibration: Calibration): void {
|
||||||
this.center = new THREE.Vector3(0, 0, 10);
|
this.center = new THREE.Vector3(0, 0, 10);
|
||||||
this.scene = new THREE.Scene();
|
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 = new THREE.PerspectiveCamera(45, this.width / this.height, 0.001, 1000);
|
||||||
this.camera.position.set(0, 0, -30);
|
this.camera.position.set(0, 0, -30);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue