[[searchwing-bilderkennung]]

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
searchwing-bilderkennung [2018/10/10 07:32]
beckmanf airbus competition und flug 7.10.18 eingefügt
searchwing-bilderkennung [2019/06/17 00:19]
wf68spef
Line 1: Line 1:
-==== Bilderkennung ​====+====== Image-Processing ======
  
-Das Ziel der Bilderkennung ist die Klassifikation der aufgenommenen Bilder von der DrohneIst auf dem Bild nur Wasser oder ist dort irgendetwas anderesbeispielsweise ein Boot?+By analysing the image with we receive from the camera, we can detect boats on the seaTo achieve thisdifferent algorithms and approaches from the image processing and deep learning domain can be used.
  
-=== Bildbeispiele ​===+===== Detection by using edgedetector and a 2d tracker in world coordinates =====
  
-Für die Entwicklung einer Bilderkennung benötigen wir Beispielfotos. Unsere Quellen bislang:+{{:ros.jpg?​nolink&​1311x744|ros.jpg}}
  
-  * [[searchwing-flug-20180328|Flug zum Bodensee am 28.2.2018]] +==== Code ====
-  * Bilder vom [[http://​v.bayern.de/​plus|Landesamt für Digitalisierung,​ Breitband und Vermessung]] +
-  * Wir haben Zugriff auf den [[http://​vislab.isr.ist.utl.pt/​seagull-dataset/​|Seagull Dataset]] +
-  * [[https://​www.kaggle.com/​c/​airbus-ship-detection|Kaggle Airbus Ship Detection Competition]] +
-  * [[searchwing-flug-virus-20181007|Flug am 7.10.2018 mit der Pipistrel Virus zum Bodensee]]+
  
-=== Bilderkennung mit OpenCV Haar Cascade Classifier ===+[[https://​gitlab.com/​searchwing/​development/​boatdetectorcpp|https://​gitlab.com/​searchwing/​development/​boatdetectorcpp]]
  
-Ich habe einige Fotos und Code für die Erkennung zusammengestelltDer Code ist hier:+==== Algorithms ==== 
 + 
 +=== 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 
 + 
 +{{:​0cae1334da2eb44438be608612fe6628.png}} 
 + 
 +
 + 
 +=== 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 
 + 
 +{{:​5ee30e4d3dc8729b80b2ca22e4b9f3af.png}} 
 + 
 +=== 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 
 + 
 +{{:​digikamdetections.png?​nolink&​878x498|asd}} 
 + 
 +
 + 
 +==== Used software ==== 
 + 
 +  * ROS 
 +      * Module communication 
 +      * Coordinatesystem transformations 
 +      * Recording and playback of datasets 
 +      * Visualisation 
 +  * MAVROS 
 +      * Communication with the drone via MAVLINK 
 +  * OpenCV 
 +      * Imageprocessing 
 +  * ARM Compute Library 
 +      * Imageprocessing 
 + 
 +==== Outlook ==== 
 + 
 +  * Deep Learning 
 +      * Test different approaches 
 +      * Runtime evaluation for embedded hardware 
 +  * Interfaces to send detections via MAVLINK to basestation 
 + 
 +==== Presentation on the topic ==== 
 + 
 +[[https://​media.freifunk.net/​v/​35c3oio-77-detection-of-refugee-boats-on-the-mediterranean-with-a-drone-by-using-foss|Click to go to the video]] 
 + 
 +===== Imagerecognition by using a OpenCV Haar Cascade Classifier ===== 
 + 
 +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|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.jpg?​1101x1044|Bilderkennung Beispiel}} 
 + 
 +Recified: 
 + 
 +{{:​bilderkennung-beispiel-detail.jpg?​1082x1027|Bilderkennung Beispiel Detail}} 
 + 
 +In this example the second boat with Persenning does not get detect. The boat above get detected. 
 + 
 +===== Datasets ===== 
 + 
 +For development and test purposes we need datasets. So far we got these datasets: 
 + 
 +  * [[:​searchwing-flug-20180328|Flug zum Bodensee am 28.2.2018]] 
 +  * [[http://​v.bayern.de/​plus|Landesamt ​für Digitalisierung,​ Breitband und Vermessung]] 
 +  * We got access to the [[http://​vislab.isr.ist.utl.pt/​seagull-dataset/​|Seagull Dataset]] 
 +  * [[https://​www.kaggle.com/​c/​airbus-ship-detection|Kaggle Airbus Ship Detection Competition]] 
 +  * [[:​searchwing-flug-virus-20181007|Flug am 7.10.2018 mit der Pipistrel Virus zum Bodensee]] 
 +  * [[https://​captain-whu.github.io/​DOTA/​|DOTA Airial Image Dataset (Wuhan Univ./​Cornell/​DLR)]]
  
-https://​git.etech.fh-augsburg.de/​friedrich.beckmann/​bilderkennung+===== Kamera kalibrieren (intrinsisch) =====
  
-Die Bilderkennung markiert ​in dem Bild mögliche BooteDas sieht dann so aus:+Um eine Kamera zu kalibriern muss ein Kamera Kalibrier Muster vor die Kamera gehalten werden ​in unterschiedlichen Positionen und jeweils ein Bild aufgenommen werdenMithilfe 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.
  
-{{::​bilderkennung-beispiel.jpg|Bilderkennung Beispiel}} ​+Schritt für Schritt Anleitung
  
-Und in der Vergrößerung so:+  - Download und Ausdruck des Musters. 
 +      - [[https://​www.mrpt.org/​downloads/​camera-calibration-checker-board_9x7.pdf|https://​www.mrpt.org/​downloads/​camera-calibration-checker-board_9x7.pdf]] 
 +      - Wichtig ist das das Pattern so groß wie möglich ausgedruckt wird 
 +  - Befestigung ohne Wellen auf einer steifen Unterlage 
 +  - Länge einer Zelle ausmessen. Die Größe wird später bei der Berechnung der Kalibrierung benötigt. 
 +  - Kamera fest aufstellen aufstellen, sodas man davor etwas Platz hat 
 +  - Kalibrierbilder erstellen 
 +      - {{:​450329a3af3b6dc669ef40710733da5d.png}} \\ (von [[http://​www.vision.caltech.edu/​bouguetj/​calib_doc/​htmls/​example.html|http://​www.vision.caltech.edu/​bouguetj/​calib_doc/​htmls/​example.html]]) 
 +      - Das Muster aus verschiedenen Winkeln ​in die Kamera halten 
 +      - Das Muster muss in jedem Bild vollständig zu sehen sein 
 +      - Das Muster muss grob jeden Teil des Kamerabildes mehrmals erfassen 
 +      - Das Muster darf muss scharf abgebildet werden - Bewegung vermeiden bei der Bildaufnahme um keinen Motionblur zu ereugen 
 +      - Das Muster darf nicht über 45° gekippt werden, sodass im Bild die Reihen und Spalten eindeutig unterscheidbar sind anhand der Anordnung 
 +      - Wichtig ist das die Auflösung der Bilder in der gleichen Auflösung erfolgen muss, in der man die Kameradaten letztendlich verwenden möchte 
 +      - Wichtig ist möglichst Kompressionsfreie Bilder aufzunehmen um Artefakte zu unterbinden,​ welche Kalibrierfehler erzeugen 
 +      - Praktische Hinweise für Raspberry Pi 
 +        - Videoaufnahme nicht verwenden, da dort starke Komprimierung verwendet wird 
 +        - Serienbildfunktion nutzen 
 +        - Manuelles Triggern der Kamera 
 +        - Aufnahme mittels ROS Toolchain möglich - verharren in jeder Lage für ca. 3 Sekunden 
 +  - Berechnung der Kalibrierung 
 +      - Tools 
 +        - Mittels MATLAB Tool[[https://​www.youtube.com/​watch?​v=g8SyzR0jZOA|https://​www.youtube.com/​watch?​v=g8SyzR0jZOA]] 
 +        - Mittels OpenCV Sample Code Tool: 
 +          - Anleitung: [[https://​docs.opencv.org/​3.4.3/​d4/​d94/​tutorial_camera_calibration.html|https://​docs.opencv.org/​3.4.3/​d4/​d94/​tutorial_camera_calibration.html]] 
 +          - Konfiguration der Inputbilder als XML file 
 +          - Starten des Kalibriervorgangs indem man die executable in ''​samples/​cpp/​tutorial_code/​calib3d/​camera_calibration/'' ​ mit dem XML file als parameter aufruft 
 +      - Der berechnete mittlere Fehler (RMS) der Kalibrierung sollte sich im Bereich < = 1 Pixel bewegen
  
-{{::​bilderkennung-beispiel-detail.jpg|Bilderkennung Beispiel Detail}} 
  
-In diesem Beispiel wird das zweite Boot mit der blauen Persenning nicht erkannt. Das Boot darüber ist mit dem blauen Rechteck markiert. 
  • searchwing-bilderkennung.txt
  • Last modified: 2021/05/31 22:03
  • by beckmanf