Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
| pub:linux-webcam [2013/06/14 10:51] – angelegt Marco Krage | pub:linux-webcam [2014/03/16 22:25] (aktuell) – Marco Krage | ||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| ====== Linux Webcam ====== | ====== Linux Webcam ====== | ||
| - | * fswebcam http:// | + | < |
| - | < | + | ===== Live Image ===== |
| - | <div class=" | + | |
| - | </ | + | |
| + | - motion saves image every 15 seconds to ''/ | ||
| + | - after that '' | ||
| + | - this script copies '' | ||
| + | - index.html displays the '' | ||
| - | ===== webcam.sh | + | ===== Archiving |
| - | This script saves a fullsize image to /archiv named with current timestamp. At the same time a smaller image is saved to live.jpg for live view. | + | |
| - | <code bash webcam.sh> | + | |
| - | # | + | |
| - | # Aufloesungen Logitech C270 | + | |
| - | # 1280 x 720 // 800 x 438 // 720 x 394 | + | |
| - | SAVEPATH="/ | + | |
| - | TIMESTAMP=" | + | |
| - | #Save live image and archiv | + | - crontab runs '' |
| - | fswebcam | + | - it copys the '' |
| - | #copy pre live image to real live image | + | ===== Zeitraffer ===== |
| - | cp ${SAVEPATH}/ | + | <code bash> |
| + | Die Framerate gibt '' | ||
| - | #set rights | ||
| - | sudo chown www-data.users ${SAVEPATH}/ | ||
| - | sudo chmod 774 ${SAVEPATH}/ | ||
| - | #delete old archiv images, but kepp the last 1440 images | + | ===== Sourcecode on GitHub ===== |
| - | (ls -t ${SAVEPATH}/ | + | |
| - | </ | + | |
| - | ===== Crontab ===== | + | https://github.com/sinky/raspberrypi-webcam |
| - | Whe webcam script runs every minute from 8am to 6pm | + | <html> |
| - | <code bash Crontab> | + | <div class=" |
| - | + | ||
| - | ===== index.html ===== | + | |
| - | Does the browser magic | + | |
| - | <code html index.html>< | + | |
| - | <html lang=" | + | |
| - | < | + | |
| - | <meta charset=" | + | |
| - | < | + | |
| - | <meta name=" | + | |
| - | <!--[if IE]>< | + | |
| - | <style> | + | |
| - | img { max-width: 100%; height: auto; } | + | |
| - | p { margin-top: 0; } | + | |
| - | .hide { display: none; } | + | |
| - | </ | + | |
| - | </ | + | |
| - | <body> | + | |
| - | <div class=" | + | |
| - | < | + | |
| - | <p>by <a href=" | + | |
| - | <div class=" | + | |
| - | <img src=" | + | |
| - | < | + | |
| - | | + | |
| - | < | + | |
| - | <div id=" | + | |
| - | </ | + | |
| - | <script src=" | + | |
| - | < | + | |
| - | var liveReloadTime = 5000 // reload live image every x second | + | |
| - | , count = 0 // counter for timeline | + | |
| - | $(document).ready(function(){ | + | |
| - | /* = Live | + | |
| - | * ----------------------------------------------------*/ | + | |
| - | jQuery('# | + | |
| - | + | ||
| - | setInterval(reloadLive, | + | |
| - | function reloadLive(){ // set (new) live image every x second | + | |
| - | var timestamp = new Date().getTime(); | + | |
| - | // | + | |
| - | // | + | |
| - | jQuery('# | + | |
| - | console.log(' | + | |
| - | } | + | |
| - | + | ||
| - | /* = Timeline | + | |
| - | * ----------------------------------------------------*/ | + | |
| - | + | ||
| - | $.getJSON(' | + | |
| - | n: ' | + | |
| - | }, function(archiv) { | + | |
| - | console.log(archiv); | + | |
| - | addTimelineImage(archiv); | + | |
| - | setInterval(function(){ addTimelineImage(archiv); | + | |
| - | }); // END: getJSON | + | |
| - | + | ||
| - | function addTimelineImage(archiv) { | + | |
| - | | + | |
| - | var img = jQuery('< | + | |
| - | | + | |
| - | | + | |
| - | } | + | |
| - | } | + | |
| - | + | ||
| - | }); // END jQuery.ready | + | |
| - | </ | + | |
| - | </body> | + | |
| </ | </ | ||
| - | </ | ||
| - | |||
| - | ===== archiv.php ===== | ||
| - | Returns a json encoded array with (n) last images of archiv/ | ||
| - | <code php archiv.php><? | ||
| - | $path = " | ||
| - | |||
| - | $dh = opendir($path); | ||
| - | while (false !== ($filename = readdir($dh))) { | ||
| - | if (preg_match('& | ||
| - | $archiv[] = $filename; | ||
| - | } | ||
| - | } | ||
| - | natsort($archiv); | ||
| - | $archiv = array_reverse($archiv); | ||
| - | |||
| - | echo $_GET[' | ||
| - | </ | ||