[[searchwing-bilderkennung]]

This is an old revision of the document!


Image-Processing

By analysing the image with we receive from the camera, we can detect boats on the sea. To achieve this, different algorithms and approaches from the image processing and deep learning domain can be used.

ros.jpg

Assumptions for the algorithms

  • By flying over the sea with 50-80km/h boats can be assumed to stand almost still in relation to the drone
  • Waves appear and dissapear over time
  • Approach to detect boats
    • Detect parts in the image which dont change over time
    • Redect parts by checking the same position in consecutive frames
    • If parts look the same, save them
    • If something is redetected over 3 frames, we can assume this could be a boat

Proposal / boat detector

  • Detection of randomly looking objects in the water
    • Classical image processing ( no deep learning)
    • Processing chain depicted in the image
  • There false positives after inital detection
  • Calculation of the 3D Position of the Objects
    • In world coordinates
    • By using a camera calibration
  • Code optimized for ARM Platforms
    • By using ARM related flags for OpenCV
    • Alternative: Compute Library for even faster processing
  • Runtime
    • 0,8 sec @ 8 MegaPixel(3240×2480 Pixel) @ Raspberry Pi 3

Tracking

  • Redetect boats in consecutive frames
    • Get more information/images about the same boats
      • See image below
    • Reduce false-positive rate
      • Valid detections only if we redetect the same boat
    • Algorithms
      • Association Problem
        • Euclidean distance based cost matrix between each possible track and detection
        • Solve global neigherest neighbor assignement problem by using Hungarian Algorithm
      • Tracking
        • Different trackingmodels possible
        • Constant position
        • Kalman constant position
        • Kalman constant velocity

Output

  • Save boat images on harddisk
  • Metadata for each detection is saved in exif-datablock of each detected boat
    • GPS Position
    • GPS Time
  • Visualization of the detection in digikam

asd

  • ROS
    • Module communication
    • Coordinatesystem transformations
    • Recording and playback of datasets
    • Visualisation
  • MAVROS
    • Communication with the drone via MAVLINK
  • OpenCV
    • Imageprocessing
  • ARM Compute Library
    • Imageprocessing
  • Deep Learning
    • Test different approaches
    • Runtime evaluation for embedded hardware
  • Interfaces to send detections via MAVLINK to basestation

I composed a few images to train a Haar Cascade Classifier. The code is over here:

https://git.etech.fh-augsburg.de/friedrich.beckmann/bilderkennung

The detected boats can be seen in the following image. They are marked by a blue rectangle.

Bilderkennung Beispiel

Recified:

Bilderkennung Beispiel Detail

In this example the second boat with Persenning does not get detect. The boat above get detected.

Um eine Kamera zu kalibriern muss ein Kamera Kalibrier Muster vor die Kamera gehalten werden in unterschiedlichen Positionen und jeweils ein Bild aufgenommen werden. Mithilfe der Bilder können dann die Eigenschaften / Intrinsischen Parameter berechnet werden. Dazu zählen zum Beispiel die Brennweite und Verzerrungsparameter der Kamera. Mithilfe der Parameter können dann prinzipiell 3D Punkte aus einem Kamerabild berechnet werden, die Tiefeninformation fehlt hierfür aber natürlich.

Schritt für Schritt Anleitung

  1. Download und Ausdruck des Musters.
    1. Wichtig ist das das Pattern so groß wie möglich ausgedruckt wird
  2. Befestigung ohne Wellen auf einer steifen Unterlage
  3. Länge einer Zelle ausmessen. Die Größe wird später bei der Berechnung der Kalibrierung benötigt.
  4. Kamera fest aufstellen aufstellen, sodas man davor etwas Platz hat
  5. Kalibrierbilder erstellen
    1. Das Muster aus verschiedenen Winkeln in die Kamera halten
    2. Das Muster muss in jedem Bild vollständig zu sehen sein
    3. Das Muster muss grob jeden Teil des Kamerabildes mehrmals erfassen
    4. Das Muster darf muss scharf abgebildet werden - Bewegung vermeiden bei der Bildaufnahme um keinen Motionblur zu ereugen
    5. Das Muster darf nicht über 45° gekippt werden, sodass im Bild die Reihen und Spalten eindeutig unterscheidbar sind anhand der Anordnung
    6. Wichtig ist das die Auflösung der Bilder in der gleichen Auflösung erfolgen muss, in der man die Kameradaten letztendlich verwenden möchte
    7. Wichtig ist möglichst Kompressionsfreie Bilder aufzunehmen um Artefakte zu unterbinden, welche Kalibrierfehler erzeugen
    8. Praktische Hinweise für Raspberry Pi
      1. Videoaufnahme nicht verwenden, da dort starke Komprimierung verwendet wird
      2. Serienbildfunktion nutzen
      3. Manuelles Triggern der Kamera
      4. Aufnahme mittels ROS Toolchain möglich - verharren in jeder Lage für ca. 3 Sekunden
  6. Berechnung der Kalibrierung
    1. Tools
      1. Mittels OpenCV Sample Code Tool:
        1. Konfiguration der Inputbilder als XML file
        2. Starten des Kalibriervorgangs indem man die executable in samples/cpp/tutorial_code/calib3d/camera_calibration/ mit dem XML file als parameter aufruft
    2. Der berechnete mittlere Fehler (RMS) der Kalibrierung sollte sich im Bereich < = 1 Pixel bewegen
  • searchwing-bilderkennung.1560723584.txt.gz
  • Last modified: 2019/06/17 00:19
  • by wf68spef