Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
openatelier:projet:lightbox [2022/04/12 17:16] emoc [Raspberry Pi + camera] |
openatelier:projet:lightbox [2022/05/15 21:01] (Version actuelle) emoc [Ressources] |
||
---|---|---|---|
Ligne 5: | Ligne 5: | ||
(Page créée le 8 avril 2022) | (Page créée le 8 avril 2022) | ||
- | Une boite d'éclairage pour photographier des photomontages | + | Premier prototype pour une boite d'éclairage pour photographier des photomontages |
Structure en tube PVC IRO, styroglass translucide, raspberry pi avec camera | Structure en tube PVC IRO, styroglass translucide, raspberry pi avec camera | ||
Ligne 141: | Ligne 141: | ||
</accordion> | </accordion> | ||
+ | **Commentaires : pour une fixation en force afin d'avoir une structure rigide, peuvent difficilement être démontées.** | ||
===== Pièce de soutien pour la camera ===== | ===== Pièce de soutien pour la camera ===== | ||
Ligne 210: | Ligne 211: | ||
Modèle de la caméra : **Raspberry Pi camera Rev. 1.3** (definition 2592 x 1944) \\ | Modèle de la caméra : **Raspberry Pi camera Rev. 1.3** (definition 2592 x 1944) \\ | ||
Modèle Rpi : **Raspberry Pi 2 Model B v1.2** (Citron) | Modèle Rpi : **Raspberry Pi 2 Model B v1.2** (Citron) | ||
+ | |||
+ | Pour avoir des infos complètes sur le modèle de Rpi ''cat /proc/cpuinfo'', la ligne «Revision» donne la version qu'on peut retrouver dans [[https://elinux.org/RPi_HardwareHistory|cette liste]] (dans le cas présent : Revision a22042, 2 Model B (with BCM2837) ) | ||
Brancher et configurer la camera ([[|source]]) : | Brancher et configurer la camera ([[|source]]) : | ||
Ligne 230: | Ligne 233: | ||
{{:openatelier:projet:lightbox:raspberry_pi_2_pinout.png?direct&800|}} | {{:openatelier:projet:lightbox:raspberry_pi_2_pinout.png?direct&800|}} | ||
+ | |||
+ | Le bouton est relié à GND (broche 6) à droite, et pour le signal à GPIO17 (broche 11) | ||
+ | |||
+ | ==== Réglages de la définition d'écran ==== | ||
+ | |||
+ | À quelle définition s'affiche le rpi sur mon écran ? -> ''fbset'' | ||
+ | |||
+ | probleme affichage camera : l'affichage de la preview coupe l'affichage du rpi (il est plus ou moins planté...) | ||
+ | * 1. augmenter la mémoire GPU ? (dans ''/boot/config.txt'') | ||
+ | * 2. réduire la définition ? https://www.raspberrypi.com/documentation/computers/config_txt.html#hdmi_group | ||
+ | |||
+ | J'essaie la solution 2: | ||
+ | sudo nano /boot/config.txt | ||
+ | Et définir les 2 variables | ||
+ | hdmi_group=1 | ||
+ | hdmi_mode=4 # 720p en théorie, en pratique fbset renvoie 1184x624 ? | ||
+ | |||
+ | https://fr.m.wikipedia.org/wiki/720p | ||
+ | |||
===== Utilisation directe de l'imprimante à sublimation ===== | ===== Utilisation directe de l'imprimante à sublimation ===== | ||
Comment imprimer directement sur l'imprimante [[materiel:imprimante_canon_selphy_cp730|Canon Selphy CP730]] ? | Comment imprimer directement sur l'imprimante [[materiel:imprimante_canon_selphy_cp730|Canon Selphy CP730]] ? | ||
+ | |||
+ | ''hostnamectl # renvoie la version du système'' | ||
+ | |||
+ | -> Raspbian GNU/Linux 9 (stretch) | ||
+ | |||
+ | <code bash> | ||
+ | sudo apt update # mise à jour | ||
+ | sudo apt install cups # installation | ||
+ | sudo apt install gcc libtool libssl-dev libc-dev libjpeg62-turbo-dev libpng-dev libtiff5-dev | ||
+ | sudo apt install libcups2-dev | ||
+ | sudo apt install printer-driver-gutenprint | ||
+ | </code> | ||
+ | |||
+ | télécharger gutenprint : | ||
+ | https://sourceforge.net/projects/gimp-print/files/gutenprint-5.3/5.3.3/gutenprint-5.3.3.tar.xz/download \\ | ||
+ | extraire et se rendre dans le dossier, puis | ||
+ | |||
+ | <code> | ||
+ | ./configure | ||
+ | make clean | ||
+ | make | ||
+ | sudo make install | ||
+ | </code> | ||
+ | |||
+ | ''sudo usermod -a -G lpadmin pi # ajouter l'utilisateur pi au groupe lpadmin'' | ||
+ | |||
+ | ''sudo service cups restart # redémarrer cups'' | ||
+ | |||
+ | |||
Ligne 242: | Ligne 293: | ||
https://raspberry-lab.fr/Composants/Utilisation-Camera-sur-Raspberry-Pi-Francais/ | https://raspberry-lab.fr/Composants/Utilisation-Camera-sur-Raspberry-Pi-Francais/ | ||
- | |||
- | https://www.gotronic.fr/pj2-tutopicam-1585.pdf | ||
https://raspberrytips.fr/camera-raspberry-pi-comme-webcam/ | https://raspberrytips.fr/camera-raspberry-pi-comme-webcam/ | ||
Ligne 252: | Ligne 301: | ||
https://pyimagesearch.com/2016/08/29/common-errors-using-the-raspberry-pi-camera-module/ | https://pyimagesearch.com/2016/08/29/common-errors-using-the-raspberry-pi-camera-module/ | ||
+ | |||
+ | ===== Code ===== | ||
+ | |||
+ | Comment faire quand la preview reste présente à l'écran alors que le programme est terminé ? \\ | ||
+ | -> ouvrir un terminal avec <key>CTRL+ALT+T</key> et taper en aveugle ''pkill python3'' | ||
+ | |||
+ | En cours ! | ||
<code python> | <code python> | ||
Ligne 258: | Ligne 314: | ||
from time import sleep | from time import sleep | ||
import datetime | import datetime | ||
+ | from gpiozero import Button | ||
+ | |||
+ | button = Button(17) | ||
# camera = PiCamera() | # camera = PiCamera() | ||
Ligne 266: | Ligne 325: | ||
# camera.vflip = True | # camera.vflip = True | ||
camera.rotation = 180 | camera.rotation = 180 | ||
+ | # camera.sensor_mode = 2 | ||
camera.resolution = (2592, 1944) | camera.resolution = (2592, 1944) | ||
camera.framerate = 15 # necessaire pour changer la resolution | camera.framerate = 15 # necessaire pour changer la resolution | ||
camera.preview_fullscreen=False | camera.preview_fullscreen=False | ||
- | camera.preview_window=(620, 120, 648, 486) | + | camera.preview_window=(50, 120, 648, 486) |
+ | camera.led = False # éteindre la LED de la caméra | ||
camera.start_preview() | camera.start_preview() | ||
Ligne 294: | Ligne 354: | ||
camera.annotate_text = "awb_mode: fluorescent" | camera.annotate_text = "awb_mode: fluorescent" | ||
+ | while True: | ||
+ | try: | ||
+ | button.wait_for_press() | ||
+ | # jpg ou png indiqué par l'extension | ||
+ | camera.capture('/home/pi/Desktop/picam_' + str(datetime.datetime.now()) + '.png') | ||
+ | except KeyboardInterrupt: | ||
+ | camera.stop_preview() | ||
+ | camera.close() | ||
+ | break | ||
+ | | ||
#~ for awb in camera.AWB_MODES: | #~ for awb in camera.AWB_MODES: | ||
#~ camera.awb_mode = awb | #~ camera.awb_mode = awb | ||
Ligne 300: | Ligne 369: | ||
#~ sleep(3) | #~ sleep(3) | ||
sleep(5) | sleep(5) | ||
- | # camera.capture('/home/pi/Desktop/image_test_1.jpg') | ||
- | # jpg ou png indiqué par l'extension | ||
- | camera.capture('/home/pi/Desktop/picam_' + str(datetime.datetime.now()) + '.png') | ||
- | camera.stop_preview() | ||
- | |||
</code> | </code> | ||
+ | \ | ||
==== Ressources ==== | ==== Ressources ==== | ||
Ligne 311: | Ligne 376: | ||
Démarrer avec la caméra : https://projects.raspberrypi.org/fr-FR/projects/getting-started-with-picamera/0 \\ | Démarrer avec la caméra : https://projects.raspberrypi.org/fr-FR/projects/getting-started-with-picamera/0 \\ | ||
Documentation **picamera** : https://picamera.readthedocs.io/en/release-1.13/ \\ | Documentation **picamera** : https://picamera.readthedocs.io/en/release-1.13/ \\ | ||
+ | Utiliser les **GPIO** avec la lib. RPi.GPIO : https://roboticsbackend.com/raspberry-pi-gpio-interrupts-tutorial/ \\ | ||
+ | Doc GPIO Zero : https://gpiozero.readthedocs.io/en/stable/ \\ | ||
+ | Quelques exemples **GPIO Zero** : https://www.framboiseetcompagnie.fr/1220-2/ \\ | ||
+ | Pour un rendu cohérent des images (luminosité, constraste, etc.), voir https://picamera.readthedocs.io/en/release-1.13/recipes1.html?highlight=capture#capturing-consistent-images \\ | ||
+ | overlay avec imagemagick : https://raspi.tv/2014/overlaying-text-and-graphics-on-a-photo-and-tweeting-it-pt-5-twitter-app-series \\ | ||
+ | overlay avec picamera : https://picamera.readthedocs.io/en/release-1.13/recipes1.html?highlight=overlay#overlaying-images-on-the-preview \\ | ||
+ | application de stopmotion avec rpi+picamera : https://github.com/russb78/pi-mation \\ | ||
+ | application photobooth : https://github.com/reuterbal/photobooth | ||
+ | |||
+ | Sur les tubes PVC : | ||
+ | * https://www.thingiverse.com/thing:932732 | ||
+ | * https://www.thingiverse.com/thing:195140 | ||
+ | * https://www.thingiverse.com/thing:5353826 | ||
+ | * https://www.printables.com/fr/search/models?q=pvc%20pipe&o=rating | ||
+ | * https://www.printables.com/fr/model/62087-complex-pvc-round-shelf-bracket |