From 1c45c1a7f758f18eb88d0661a06c48c154969958 Mon Sep 17 00:00:00 2001 From: Hoop77 <p.badenhoop@gmx.de> Date: Fri, 17 Aug 2018 18:28:21 +0200 Subject: [PATCH] doku --- doc/descisions-and-problems.md | 11 +++++++++++ .../catkin_ws/src/car/include/camera/AsyncCapture.h | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/doc/descisions-and-problems.md b/doc/descisions-and-problems.md index 4b43571..6e8f0e6 100644 --- a/doc/descisions-and-problems.md +++ b/doc/descisions-and-problems.md @@ -111,5 +111,16 @@ Geschwindigkeitskontrolle In der config.json Datei befindet sich das Attribut 'trottleGain'. Dies ist ein Faktor, der mit im STM-Modul mit dem Wert aus der Message 'SetThrottle' multipliziert wird. Setzt man diesen Wert also auf 0.1, dann fährt das Auto nur noch maximal 10& der Maximalgeschwindigkeit. +Kameraaufnahme +-------------- + +Am Anfang haben wir zur Aufnahme von Kamerabildern immer opencv's VideoCapture Klasse benutzt. +Es hat sich herausgestellt, dass hierdurch teilweise 4 Frames hintereinander dasselbe Bild aufgenommen wurde. +Die Kamera nimmt also nur mit einem Bruchteil der eigentlichen Framerate auf. +Die Lösung war an dieser Stelle die GStreamer Library zu benutzen. +Bilder sollen ab nun nicht mehr mit VideoCapture, sondern mit der von mir geschriebenen Klasse 'AsyncCapture' aufgenommen werden. +Der Vorteil an AsyncCapture ist zudem, dass die Bilder in einem anderen Thread aufgenommen werden. +Beim Aufruf der Methode 'start()' wird ein Callback übergeben, welches aufgerufen wird, sobald ein neuer Frame (vom Typ cv::Mat) aufgenommen wurde. + \ No newline at end of file diff --git a/src/odroid/catkin_ws/src/car/include/camera/AsyncCapture.h b/src/odroid/catkin_ws/src/car/include/camera/AsyncCapture.h index 1a4ad1f..7cb8453 100644 --- a/src/odroid/catkin_ws/src/car/include/camera/AsyncCapture.h +++ b/src/odroid/catkin_ws/src/car/include/camera/AsyncCapture.h @@ -31,6 +31,14 @@ public: AsyncCapture & operator=(AsyncCapture && other) noexcept; + /** + * Start capturing frames. This function returns immediately. + * @param callback gets called when a new frame was captured. + * Attention: There is no deep copy involed in passing the frame to the callback + * and furthermore, the internal buffer (pixel data) will be freed afterwards. + * If you do want to make a copy of the frame, you must call frame.clone()! + * Otherwise you'll run into undefined behavior or segmentation faults! + */ void start(const OnFrameCapturedCallback & callback); void stop(); -- GitLab