• Aucun résultat trouvé

Dossier PIMS : traitement d’image avec RaspBerry Pi

N/A
N/A
Protected

Academic year: 2022

Partager "Dossier PIMS : traitement d’image avec RaspBerry Pi"

Copied!
4
0
0

Texte intégral

(1)

Dossier PIMS : traitement d’image avec RaspBerry Pi   

   

Commandes linux utiles en console : 

Pour créer un programme python, il suffit de créer un fichier texte avec extension ‘.py’,   et ayant pour première ligne :  

#!/usr/bin/python3 

Pour exécuter un script test.py situé dans un dossier ‘src’ lui même dans un dossier 

‘programmes’, il faut ouvrir un terminal (Menu > Accessoires > Terminal), se placer dans le  répertoire du fichier (pour cela taper ‘cd programmes/src’) et rendre le script executable (taper 

‘chmod +x test.py’) puis exécuter le script en tapant : ‘./test.py’. 

Utile  : La commande ‘ls’ affiche le contenu du répertoire courant. 

Tuto pour apprendre à se déplacer dans les fichiers en ligne de commande sur linux 

https://openclassrooms.com/courses/reprenez­le­controle­a­l­aide­de­linux/la­structure­des­dos siers­et­fichiers 

       

Bibliothèques utilisées et références/documentations :   

Python : (on utilise en particulier les modules time et io) 

https://docs.python.org/3/library/index.html    Bibliothèque standard  https://docs.python.org/3/reference/index.html    Synthaxe du langage   

 

Numpy : gestion, création, manipulation des tableaux (ndarray) à plusieurs dimensions  (matrices des images) 

http://docs.scipy.org/doc/numpy/reference/ 

   

scipy.misc : ouverture d’image sous forme de tableau numpy (ndarray), enregistrement en  fichier image, affichage d’image. 

http://docs.scipy.org/doc/scipy/reference/misc.html    

 

scipy.ndimage : filtrage, convolution, mesures (moyennes, histogrammes, etc…)  http://docs.scipy.org/doc/scipy/reference/ndimage.html 

   

(2)

python3­picamera : Utiliser la caméra de Raspberry Pi dans un script Python 

https://www.raspberrypi.org/documentation/usage/camera/python/README.md   Mini  doc 

https://picamera.readthedocs.org/en/release­1.10/  Doc générale 

http://picamera.readthedocs.org/en/release­1.0/api.html  Fonctions de la classe  PiCamera 

http://picamera.readthedocs.org/en/release­1.10/api_camera.html#module­picamera.ca mera  Fixer balance des blancs 

http://picamera.readthedocs.org/en/release­1.0/recipes2.html   Captures formats bruts  (rgb ou yuv) 

   

RPi.GPIO : Pour utiliser les broches (et controler des LEDs, des moteurs, récupérer un signal  d’une photodiode…) 

http://deusyss.developpez.com/tutoriels/RaspberryPi/PythonEtLeGpio/   Tuto   

 

Bibliographie :   

Interruptions en python : 

http://raspi.tv/2013/how­to­use­interrupts­with­python­on­the­raspberry­pi­and­rpi­gpio   

                                         

(3)

       

Overlaying ? ­fin 4) Basic Recipes   

Données brutes de picamera ?   

import time  import picamera  import picamera.array  import cv2 

 

with picamera.PiCamera() as camera: 

    camera.start_preview()      time.sleep(2) 

    with picamera.array.PiRGBArray(camera) as stream: 

        camera.capture(stream, format='bgr') 

        # At this point the image is available as stream.array          image = stream.array 

   

Fixer les paramètres de prise de vue   

● To fix exposure time, set the   shutter_speed  attribute to a reasonable value.  Limité par  framerate ! 

● To fix exposure gains, let   analog_gain  and   digital_gain  settle on reasonable values, then  set   exposure_mode  to 'off'. 

● To fix white balance, set the   awb_mode  to 'off', then set   awb_gains  to a (red, blue) tuple  of gains. 

● Optionally, set   iso  to a fixed value. 

 

with picamera.PiCamera() as camera: 

    camera.resolution = (1280, 720)      camera.framerate = 30 

    # Wait for the automatic gain control to settle      time.sleep(2) 

    # Now fix the values 

    camera.shutter_speed = camera.exposure_speed      camera.exposure_mode = 'off' 

    g = camera.awb_gains      camera.awb_mode = 'off'      camera.awb_gains = g 

(4)

 

Références

Documents relatifs

And just like how the previous Flask example showed how you can have the same code work on multiple pins, you’ll set up this project so that if you want to control more devices in

Capturing images and video using a Raspberry Pi Camera Module is a great way to get started with programming and making computing tangible:.. students can use button presses,

Pi model B and case, from PC Supplies LTD UP - PART 2 1 2 BACKING Keeping the SD card images safe and restoring backups GAFFER TAPE 1 6 BASH Learn some lashup scripts with

In order to build the project, you’ll need a Raspberry Pi, official Camera Module, and that fake CCTV housing.. “The Camera Module is the most expensive part,”

Most of the robot will be easy to take apart – just remove a few wires – but you’ll also have to snip those cable ties and probably unsolder the battery pack and extra wires on the

Open-source licences are designed to make it easy to share your software and hardware with the community of makers, allowing other people to have fun building your project,

very month in The MagPi, we have projects filling the pages that hook up directly to Raspberry Pi using the GPIO pins running down the side of the board.. They’re pretty easy

With Bluetooth hardware on your Raspberry Pi board, it’s easy to connect to a device wirelessly, a process known as ‘pairing’O. You can pair wireless gaming controllers, like