{"id":2097,"date":"2016-08-17T02:26:34","date_gmt":"2016-08-17T02:26:34","guid":{"rendered":"http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/?p=2097"},"modified":"2016-08-17T02:34:16","modified_gmt":"2016-08-17T02:34:16","slug":"taking-time-lapse-photos-with-your-raspberry-pi","status":"publish","type":"post","link":"http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/taking-time-lapse-photos-with-your-raspberry-pi\/","title":{"rendered":"Taking Time Lapse Photos with Your Raspberry Pi"},"content":{"rendered":"\n<!-- Facebook Like Button v1.9.6 BEGIN [http:\/\/blog.bottomlessinc.com] -->\n<iframe src=\"http:\/\/www.facebook.com\/plugins\/like.php?href=http%3A%2F%2Finspiredtoeducate.net%2Finspiredtoeducate%2Ftaking-time-lapse-photos-with-your-raspberry-pi%2F&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=like&amp;colorscheme=light\" scrolling=\"no\" frameborder=\"0\" allowTransparency=\"true\" style=\"border:none; overflow:hidden; width:450px; height: 30px; align: left; margin: 2px 0px 2px 0px\"><\/iframe>\n<!-- Facebook Like Button END -->\n<p><a href=\"http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-content\/uploads\/2016\/08\/simpleCV.png\" rel=\"attachment wp-att-2096\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-2096\" src=\"http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-content\/uploads\/2016\/08\/simpleCV.png\" alt=\"Simple CV\" width=\"743\" height=\"484\" srcset=\"http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-content\/uploads\/2016\/08\/simpleCV.png 743w, http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-content\/uploads\/2016\/08\/simpleCV-300x195.png 300w\" sizes=\"(max-width: 743px) 100vw, 743px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">One of my friends from <a href=\"http:\/\/sparkmacon.com\" target=\"_blank\">SparkMacon makerspace<\/a> had a question about taking time lapse photos using a <a href=\"https:\/\/www.raspberrypi.org\/\" target=\"_blank\">Raspberry Pi<\/a>. \u00a0Since this feels like a fun starter project for many makers, I wanted to share an approach using an easy computer vision library, <a href=\"http:\/\/tutorial.simplecv.org\/en\/latest\/\" target=\"_blank\">SimpleCV<\/a>. \u00a0\u00a0SimpleCV by <\/span><a href=\"http:\/\/www.sightmachine.com\/\"><span style=\"font-weight: 400;\">http:\/\/www.sightmachine.com\/<\/span><\/a><span style=\"font-weight: 400;\"> \u00a0enables novice programmers to build computer vision experiences using Python and concise code patterns. \u00a0This code should also work on Mac, Linux, Windows, and a Raspberry Pi.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">To utilize SimpleCV on your Raspberry Pi, follow the install instructions located <\/span><a href=\"http:\/\/simplecv.readthedocs.io\/en\/latest\/HOWTO-Install%20on%20RaspberryPi.html\"><span style=\"font-weight: 400;\">here<\/span><\/a><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p>Make sure to install a web camera or the Raspberry Pi camera module.<\/p>\n<p><span style=\"font-weight: 400;\">If you\u2019re not familiar with the Python programming language, you can learn the basics from <\/span><a href=\"https:\/\/www.codecademy.com\/learn\/python\"><span style=\"font-weight: 400;\">CodeAcademy.com<\/span><\/a><span style=\"font-weight: 400;\"> . \u00a0\u00a0I have a few free e-books located on <\/span><a href=\"http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/5-fun-ways-to-learn-python\/\"><span style=\"font-weight: 400;\">this blog post<\/span><\/a><span style=\"font-weight: 400;\">. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">I found a time lapse capture script by <\/span><a href=\"https:\/\/github.com\/larsyencken\/simplecv-demo\/blob\/master\/01b-timelapse.py\"><span style=\"font-weight: 400;\">larsyencken on github.<\/span><\/a><span style=\"font-weight: 400;\"> \u00a0\u00a0That looks really simple. \u00a0 Copy the following code into a text file named \u201ctime_lapse.py.\u201d \u00a0\u00a0<\/span><\/p>\n<p><code><br \/>\nimport os<br \/>\nimport SimpleCV<br \/>\nimport time<\/p>\n<p># get access to the camera<br \/>\ncam = SimpleCV.Camera()<\/p>\n<p># setup a display<br \/>\ndisp = SimpleCV.Display((1024, 768))<\/p>\n<p># this variable is used for naming each file or frame.<br \/>\ni = 0<\/p>\n<p>while disp.isNotDone():<br \/>\n    # wait 2 seconds<br \/>\n    time.sleep(2)<\/p>\n<p>    # capture the image. Display it. Save the image as a JPEG.<br \/>\n    img = cam.getImage()<br \/>\n    img.save(disp)<br \/>\n    img.save('%.06d.jpg' % i)<\/p>\n<p>    # change the filename counter variable.<br \/>\n    i += 1<\/p>\n<p>    if disp.lastLeftButton:<br \/>\n        break<br \/>\n<\/code><\/p>\n<p><span style=\"font-weight: 400;\">You can run this code by executing the following command:<\/span><\/p>\n<p><span style=\"font-weight: 400;\">python time_lapse.py<\/span><\/p>\n<p><span style=\"font-weight: 400;\">After running this script, your program should capture a new image every two seconds. \u00a0Each frame will be numbered.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">If you\u2019re interested in learning more with SimpleCV, make sure to check out <\/span><a href=\"http:\/\/tutorial.simplecv.org\/en\/latest\/\"><span style=\"font-weight: 400;\">their documentation resources<\/span><\/a><span style=\"font-weight: 400;\">. \u00a0\u00a0It\u2019s a fun and easy way to do computer vision.<\/span><\/p>\n<p>\nWhat other cool ways could you use SimpleCV?  We would enjoy hearing your ideas!\n<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n\n<!-- Facebook Like Button v1.9.6 BEGIN [http:\/\/blog.bottomlessinc.com] -->\n<iframe src=\"http:\/\/www.facebook.com\/plugins\/like.php?href=http%3A%2F%2Finspiredtoeducate.net%2Finspiredtoeducate%2Ftaking-time-lapse-photos-with-your-raspberry-pi%2F&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=like&amp;colorscheme=light\" scrolling=\"no\" frameborder=\"0\" allowTransparency=\"true\" style=\"border:none; overflow:hidden; width:450px; height: 30px; align: left; margin: 2px 0px 2px 0px\"><\/iframe>\n<!-- Facebook Like Button END -->\n","protected":false},"excerpt":{"rendered":"<p>One of my friends from SparkMacon makerspace had a question about taking time lapse photos using a Raspberry Pi. \u00a0Since this feels like a fun starter project for many makers, I wanted to share an approach using an easy computer vision library, SimpleCV. \u00a0\u00a0SimpleCV by http:\/\/www.sightmachine.com\/ \u00a0enables novice programmers to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[24,16,23,8],"tags":[],"_links":{"self":[{"href":"http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-json\/wp\/v2\/posts\/2097"}],"collection":[{"href":"http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-json\/wp\/v2\/comments?post=2097"}],"version-history":[{"count":4,"href":"http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-json\/wp\/v2\/posts\/2097\/revisions"}],"predecessor-version":[{"id":2101,"href":"http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-json\/wp\/v2\/posts\/2097\/revisions\/2101"}],"wp:attachment":[{"href":"http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-json\/wp\/v2\/media?parent=2097"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-json\/wp\/v2\/categories?post=2097"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-json\/wp\/v2\/tags?post=2097"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}