Compare commits
2 Commits
stopi2-ins
...
insert
Author | SHA1 | Date |
---|---|---|
|
058f7a4b51 | |
|
e12fe81ed3 |
|
@ -53,6 +53,7 @@ project_settings_defaults = {
|
||||||
'export_options' : 'scale=1920:-1,crop=1920:1080:0:102',
|
'export_options' : 'scale=1920:-1,crop=1920:1080:0:102',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# TODO: replace hflip+vflip with flip option
|
||||||
camera_current_settings_defaults = {
|
camera_current_settings_defaults = {
|
||||||
'cam_w' : 800,
|
'cam_w' : 800,
|
||||||
'cam_h' : 600,
|
'cam_h' : 600,
|
||||||
|
@ -104,6 +105,7 @@ class webcam():
|
||||||
self.overlay = None
|
self.overlay = None
|
||||||
# Original frame for saving
|
# Original frame for saving
|
||||||
self.og_frame = None
|
self.og_frame = None
|
||||||
|
self.flip_img = bool(camera_settings['vflip'] or camera_settings['hflip'] )
|
||||||
self.onionskin = project_settings['onion_skin_onstartup']
|
self.onionskin = project_settings['onion_skin_onstartup']
|
||||||
self.onionskin_was_on = self.onionskin
|
self.onionskin_was_on = self.onionskin
|
||||||
self.liveview_only = False
|
self.liveview_only = False
|
||||||
|
@ -132,6 +134,8 @@ class webcam():
|
||||||
if not ret:
|
if not ret:
|
||||||
print(_("Failed to grab frame."))
|
print(_("Failed to grab frame."))
|
||||||
return False
|
return False
|
||||||
|
if self.flip_img:
|
||||||
|
overlay = cv2.flip(overlay, -1)
|
||||||
# Keep original pic in memory
|
# Keep original pic in memory
|
||||||
self.og_frame = overlay.copy()
|
self.og_frame = overlay.copy()
|
||||||
# Resize preview to fit screen
|
# Resize preview to fit screen
|
||||||
|
@ -212,9 +216,7 @@ class webcam():
|
||||||
return self.camera_current_settings
|
return self.camera_current_settings
|
||||||
|
|
||||||
def flip_image(self):
|
def flip_image(self):
|
||||||
self.frame = cv2.flip(self.frame, -1)
|
self.flip_img = not self.flip_img
|
||||||
# Also flip original file
|
|
||||||
self.og_frame = cv2.flip(self.og_frame, -1)
|
|
||||||
|
|
||||||
def focus(self, direction:str='-'):
|
def focus(self, direction:str='-'):
|
||||||
self.apply_setting(['lenspos'], 1)
|
self.apply_setting(['lenspos'], 1)
|
||||||
|
@ -449,7 +451,7 @@ class dslr():
|
||||||
self.onionskin_was_on = self.onionskin
|
self.onionskin_was_on = self.onionskin
|
||||||
self.liveview_only = False
|
self.liveview_only = False
|
||||||
self.lenspos = None
|
self.lenspos = None
|
||||||
self.flip_img = False
|
self.flip_img = bool(camera_settings['vflip'] or camera_settings['hflip'] )
|
||||||
self.cam_busy = False
|
self.cam_busy = False
|
||||||
self.camera_current_config = None
|
self.camera_current_config = None
|
||||||
self.cam = self.init_camera()
|
self.cam = self.init_camera()
|
||||||
|
@ -474,7 +476,6 @@ class dslr():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def find_file_ext(self, gp_name:str, full_path:str):
|
def find_file_ext(self, gp_name:str, full_path:str):
|
||||||
# TODO: use re to sub png with jpg ?
|
|
||||||
# extract dir path
|
# extract dir path
|
||||||
dirname = os.path.dirname(full_path)
|
dirname = os.path.dirname(full_path)
|
||||||
# extract filename from path
|
# extract filename from path
|
||||||
|
@ -500,7 +501,6 @@ class dslr():
|
||||||
if self.cam is None:
|
if self.cam is None:
|
||||||
self.cam = self.init_camera()
|
self.cam = self.init_camera()
|
||||||
if not self.cam_busy:
|
if not self.cam_busy:
|
||||||
# CHECK: Should we init and close dslr for each frame ?
|
|
||||||
# Check battery level
|
# Check battery level
|
||||||
battery_level = int(self.check_status_value(self.camera_current_config, 'batterylevel')[:-1])
|
battery_level = int(self.check_status_value(self.camera_current_config, 'batterylevel')[:-1])
|
||||||
if battery_level < 10:
|
if battery_level < 10:
|
||||||
|
@ -533,6 +533,7 @@ class dslr():
|
||||||
return False
|
return False
|
||||||
# Flip image if needed
|
# Flip image if needed
|
||||||
if self.flip_img:
|
if self.flip_img:
|
||||||
|
# Re-open filen flip and save
|
||||||
frm = cv2.imread(img_path)
|
frm = cv2.imread(img_path)
|
||||||
frm = cv2.flip(frm, -1)
|
frm = cv2.flip(frm, -1)
|
||||||
cv2.imwrite(img_path, frm)
|
cv2.imwrite(img_path, frm)
|
||||||
|
@ -603,7 +604,7 @@ class dslr():
|
||||||
return status
|
return status
|
||||||
|
|
||||||
def flip_image(self):
|
def flip_image(self):
|
||||||
self.flip_img = True
|
self.flip_img = not self.flip_img
|
||||||
|
|
||||||
def focus(self, direction:str='-'):
|
def focus(self, direction:str='-'):
|
||||||
if direction == '-':
|
if direction == '-':
|
||||||
|
@ -617,7 +618,6 @@ class dslr():
|
||||||
self.camera_current_config = self.gp.check_result(self.gp.gp_camera_get_config(self.cam))
|
self.camera_current_config = self.gp.check_result(self.gp.gp_camera_get_config(self.cam))
|
||||||
for setting in self.camera_current_settings:
|
for setting in self.camera_current_settings:
|
||||||
self.camera_current_settings[setting]['value'] = self.camera_current_settings[setting]['default']
|
self.camera_current_settings[setting]['value'] = self.camera_current_settings[setting]['default']
|
||||||
# TODO: use self.apply_setting() instead
|
|
||||||
self.apply_gphoto_setting(setting)
|
self.apply_gphoto_setting(setting)
|
||||||
status = self.gp.check_result(self.gp.gp_camera_set_config(self.cam, self.camera_current_config))
|
status = self.gp.check_result(self.gp.gp_camera_set_config(self.cam, self.camera_current_config))
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ Encore une fois, l'objectif est de créer un logiciel simple et minimaliste dans
|
||||||
* Pilotage de certains réglages de la caméra depuis la télécommande/clavier (balance des blancs, rotation de l'image, mise au point (picam V3), exposition...)
|
* Pilotage de certains réglages de la caméra depuis la télécommande/clavier (balance des blancs, rotation de l'image, mise au point (picam V3), exposition...)
|
||||||
* Prévisualisation de l'animation
|
* Prévisualisation de l'animation
|
||||||
* Exportation vidéo avec [ffmpeg](https://ffmpeg.org/)
|
* Exportation vidéo avec [ffmpeg](https://ffmpeg.org/)
|
||||||
* Interface localisée (anglais et français disponible pour le moment.)
|
* Textes localisés (anglais et français disponible pour le moment.)
|
||||||
|
|
||||||
## Banc de test
|
## Banc de test
|
||||||
|
|
||||||
|
@ -44,6 +44,7 @@ Des fonctions supplémentaires sont prévues :
|
||||||
|
|
||||||
* Mise à jour de la traduction FR
|
* Mise à jour de la traduction FR
|
||||||
* Réflexe numérique: utilisation du liveview de l'appareil (si je trouve un modèle compatible pour le développement)
|
* Réflexe numérique: utilisation du liveview de l'appareil (si je trouve un modèle compatible pour le développement)
|
||||||
|
* Mécanisme de mise à jour
|
||||||
|
|
||||||
## Contributions
|
## Contributions
|
||||||
|
|
||||||
|
@ -64,7 +65,7 @@ Dans un terminal :
|
||||||
3. Aller dans répertoire du projet : `cd stopi2`
|
3. Aller dans répertoire du projet : `cd stopi2`
|
||||||
4. Créer un environnement virtuel (venv) Python : `python -m venv ./`
|
4. Créer un environnement virtuel (venv) Python : `python -m venv ./`
|
||||||
- Mise à jour de l'environnement pypi: '`MAKEFLAGS="-j$(nproc)" pip install -vvv --upgrade pip setuptools wheel`
|
- Mise à jour de l'environnement pypi: '`MAKEFLAGS="-j$(nproc)" pip install -vvv --upgrade pip setuptools wheel`
|
||||||
- (Optionnel) Dans le cas de l'utilisation d'une "raspicam", il faudra ajouter le paramètre `--system-site-packages` pour avoir accès au module picamera2, et installer la librairie correspondante `python3-picamera2`.
|
- (Optionnel) Dans le cas de l'utilisation d'une "raspicam", il faudra ajouter le paramètre `--system-site-packages` à la commande de création de l'environnement virtuel pour avoir accès au module picamera2 du système, et installer la librairie correspondante `python3-picamera2`.
|
||||||
5. Activer l'environnement virtuel avec `source bin/activate`
|
5. Activer l'environnement virtuel avec `source bin/activate`
|
||||||
6. Installer les dépendances python (~150Mo) : `MAKEFLAGS="-j$(nproc)" pip install -r requirements.txt`
|
6. Installer les dépendances python (~150Mo) : `MAKEFLAGS="-j$(nproc)" pip install -r requirements.txt`
|
||||||
7. Activer l'éxécution du script : `chmod +x stopi2.sh`
|
7. Activer l'éxécution du script : `chmod +x stopi2.sh`
|
||||||
|
|
Loading…
Reference in New Issue