All things Raspberry Pi and Time Lapse

Posts tagged ‘pictures’

Hypnocube

I recently found the Hypnocube 4Cube, which is a grid of 64 RGB (Red/Green/Blue) LEDs laid out 4 LEDs wide, by 4 LEDs long, by 4 LEDs high. Pictures are at the bottom of this post. I wrote a little bit about in in my previous post here (bottom of the post). I decided to buy one and I am glad that I did! It was a very fun kit to build. It looks amazing at night with the lights off and the LEDs flashing different patterns and colors. I did a time lapse video as I built the cube and that is posted here (http://vimeo.com/59026344). The video is pretty long (10 minutes) but I think it is worth it to see some of the details in building. The pdf with building instructions is available from Hypnocube to download here (it is the 4Cube link – and the jig instructions are right below that).

I wrote a script (below) that used ImageMagick from the Linux command line added the date stamp onto the pictures. Basically it changed directories into the folder, then for each file it got the date and time from that picture, then put that stamp onto the picture. After this step I used an action in Photoshop to crop the images and do some basic image adjusting.

#!/bin/bash
var=$1
for x in $var
do
cd $x
for y in `ls`
do
name=`identify -format %[EXIF:DateTime] $y | cut -d “:” -f1-5`
convert $y -pointsize 50 -fill white -annotate +1000+1000 “$name” $y
done
cd ..
done

Their manual only includes instructions for Windows. But that wasn’t where I wanted to have it connected. After some searching around I figured out that the Hypnocube was located at /dev/ttyACM0 by running “dmesg | grep tty” and it was listed there. Then I installed the “screen” command and then typed in the command “screen /dev/ttyACM0 38400” and it works just like a putty session from Windows. Then to exit out of screen “CTRL+a+d” and it will exit. To return back to the session “screen -r” and it goes back to the session again. This works from a Fedora Linux desktop and also from a Debian based Linux distribution on a Raspberry Pi. This offers some really cool options like controlling the Hypnocube from my Android by using ConnectBot which is a ssh client for Android. So I can ssh into the Raspberry Pi or my desktop and then using the screen command I can “login” to the Hypnocube. Then using their commands I can switch to the next visualization or the previous one. I can lock it on the current one or pause it.

Pictures….

IMG_0009 IMG_0035IMG_0057IMG_0040IMG_5989IMG_5994IMG_5992IMG_9900IMG_9877

ImageMagick scripts

I found this post here about a guy who took all of his shots from a year and compiled them into a single image. This sounded like a cool idea, but I could never find the code for how this was accomplished. But I figured that it shouldn’t be too hard so I set about doing it for myself. I have 21 images so far and I compiled them into these two images. One from right to left. And the other from bottom to top.

Once I have more images it should look better as each section will be considerably smaller. I achieved these results using a command line program called ImageMagick on Linux. It was a very simple install ‘yum install ImageMagick’ (notice the capital letters) since I am using Fedora and that was all. Debian based distros may be something like ‘sudo apt-get install ImageMagick’ but I have not tried it. The weird thing though was that I was actually using the command line tool ‘convert’ from the command line instead of ‘ImageMagick’. Great documentation available at their site about the usage here. And documentation specifically about the cropping here. The command line usage looks like this:

convert input_file XxY+X+Y output_file

The program uses the X and Y axis for where to crop. The top left corner of the image is 0x0. The +X+Y is offset from that initial 0x0. Check out the scripts below for actual usage in the script. I did the math before I ran the script and that is where the 92 and 73 come from. I took the dimension of the image and divided by the number of images that I had. So the first image is 2048 wide and I had 21 images. Then I rounded that number down to get the 92 that was used in the script.

This first script is for the top image cutting columns of the image.

#!/bin/bash
# jamesmiller
# get list of files in current directory
files=`ls | grep “^rasplapse*”`
# set the initial crop point
x_factor=0
# for each file in the current directory
for x in $files
do
# ImageMagick convert program to crop the image
convert $x -crop 92×0+$x_factor+0 column_$x
# add to the initial crop point so the next image
# is not the same strip as the previous image
x_factor=$((x_factor + 92))
# add a border of white
#convert column_$x -border 1x column_$x
done
# get the list of newly created images
column_files=`ls | grep “^column*”`
# add all of the strips of images into one image
convert $column_files +append column_file.jpg

This script is for the bottom image cutting rows of the image.

#!/bin/bash
# jamesmiller
# get list of files in current directory
files=`ls -r | grep “^rasplapse*”`
# set the initial crop point
x_factor=0
# for each file in the current directory
for x in $files
do
# ImageMagick convert program to crop the image
convert $x -crop 0x73+0+$x_factor row_$x
# add to the initial crop point so the next image
# is not the same strip as the previous image
x_factor=$((x_factor + 73))
done
# get the list of newly created images
row_files=`ls -r | grep “^row*”`
# add all of the strips of images into one image
convert $row_files -append row_file.jpg

The very last line of each script is what compiles all of the strips of images into one image. NOTE: these scripts are meant to be executed in the folder containing the images. And they may need to be modified to suit other uses depending on the file naming structure and so forth.

I also tried these scripts using the pictures that were taken every 2 minutes. But even separating them out into three different pictures it didn’t turn out that neat. There was very little change across the picture because not that much moved in a single day.

Looking forward to using this technique on more pictures like the pictures shown above once I have more images!

Back up and running

It is all setup again – as of Saturday – and should be taking pictures. Here is a shot of what it looks like now. All of the tomato plants have been removed and the new ones will be planted soon.

Something that started to concern me was Daylight Savings time. This would be a problem if the camera changed time and then the power went out. The raspberry pi would pull the new time and it would be an hour off of what it was before. I contacted Canon about this potential issue. And they tried to sell me one of their newer cameras that has this feature. But they said that the Canon Powershot A510 does not have this feature. I could not find this option on the SX100 either. However this is a good thing as it means I am safe from having to worry about that. It will definitely be something to think about in the future however.

I changed the way the scripts were written and so I will post them and the updated crontab hopefully sometime early next week.

Pictures and Yesterday’s Time Lapse

The enclosure is setup outside my window and it taking pictures of our garden. This is so I can test it and make sure everything works correctly. Here are some pictures of the setup.

Here is the time lapse video that the setup shot on 7-16-2012. It was taking a picture once every 5 minutes.

https://vimeo.com/45938391

Raspberry Pi Flash Drive?

The Raspberry Pi project has plans (I think) on opening a shop selling t-shirts, mugs, caps, stickers, and little things like that. I had an idea about another item they could sell. Flash drives shaped like the Raspberry Pi logo. What gave me the idea is that I have a penguin – looks like Tux, the Linux penguin – and it is a 4GB flash drive. So that gave me the idea about a Raspberry Pi flash drive. I created one in Autodesk Maya, but it did not turn out that great. Here are some pictures of what I created.

ImageImage

These next pictures show my penguin Flash Drive. The penguin flash drive is made by a company named Emtec. It is a really neat design that the little white thing on the key chain works as a holder for the cap when the flash drive is in use.

ImageImageImageImageImage

I would definitely buy a Raspberry Pi flash drive. What about you?

Enclosure Photos

I thought it would be time to add some photos of the equipment that I have so far. More photos to come as more of the pieces arrive…

Side view of enclosure with mounting bracket attached.

Front view of the enclosure.

Another front view of the enclosure.

Back view of enclosure.

Top view with enclosure open.

View of the inside front of enclosure. The little silver thing with the wires coming out of the right side is the heater for the unit.

Inside back of enclosure. The fan will help cool the enclosure if need be, and the little circuit board controls both the fan and the heater. The black wires lead to the silver heater in the previous picture.

Some of the spare pieces for the enclosure.

Some of the pieces that came with the enclosure. The round item on the left is for the power cables to go through the enclosure and still be waterproof. The rest of the pieces are for mounting.

This is the data cable. It has a USB connection (on the right) and the connection to insert into the camera (on the left).

This is the power cable that is used to power the camera. The end on the left is what plugs into the camera.

Tag Cloud