Vermischtes

As Cyanogen Inc closed down its operations in December 2016, CyanogenMod was affected too and my OnePlus One (OPO) did not receive updates anymore. This is not ideal, as new and old bugs have will remain. For instance did my phone often not reconnect to the 4G network, when a wifi connection was lost, This was very annoying. For this reason, if was about time to upgrade to a new OS: LineageOS.

LineageOS

LineageOS is a fork of CyanogenMod and contunes the quite successful project for our benefit. LineageOS 14 is compatible with Android 7.1 and very easy to install. These are the steps which I had to follow.

How to Upgrade

Create a backup with Helios. Use the Chrome Helium app if the app on your mobile phone refuses to start.

Install both zip files by selecting first the LineageOS and then the Google Apps Zip file

Thats it. Reboot and begin with the setup or restore the backup.

Update 28.09.2017

The problem that the phone would not reconnect to 3G/4G again after losing the Wifi signal still persisted with LineageOS. A friend recommended flashing the firmware of the device. After installing the version 2016_1-25_.4.0.1.c7-00011 downloaded from here solved the issue for now. No more connection problems so far

Recently, I bought a camera module for the Raspberry Pi and experimented a little bit with the possibilities a scriptable camera provides. The new Camera Module V2 offers 8.08 MP from a Sony sensor and can be controlled with a well documented Python library. It allows to take HD videos and shoot still images. Assembly is easy, but as the camera is attached with a rather short ribbon cable, which renders the handling is a bit cumbersome. For the moment, a modified extra hand from my soldering kit acts as a makeshift.

Initial Setup

The initial setup is easy and just requires a few steps, which is not surprising because most of the documentation is targeted to kids in order to encourage their inner nerd. Still works for me as well 🙂

Attach the cable to the raspberry pi as described here. You can also buy an adapter for the Pi Zero. Once the camera is wired to the board, activate the module with the tool raspi-config.

Then you are ready to install the Python library with
sudo apt-get install python3-picamera, add your user to the video group with
usermod-a-Gvideo USERNAME and then reboot the Raspberry. After you logged in again, you can start taking still images with the simple command
raspistill-ooutput.jpg. You can find some more documentation and usage examples here.

Timelapse Photography

What I really enjoy is making timelapse videos with the Raspberry Pi, which gives a nice effect for everyday phenomena and allows to observe processes which are usually too slow to follow. The following Gif shows a melting ice cube. I took one picture every five seconds.

A Small Python Script

The following script creates a series of pictures with a defined interval and stores all images with a filename indicating the time of shooting in a folder. It is rather self explanatory. The camera needs a little bit of time to adjust, so we set the adjustTime variable to 5 seconds. Then we take a picture every 300 seconds, each image has a resolution of 1024×768 pixels.

Python

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

importos

importtime

importpicamera

fromdatetimeimportdatetime

# Grab the current datetime which will be used to generate dynamic folder names

This script then can run unattended and it creates a batch of images on the Raspberry Pi.

Image Metadata

The file name preserves the time of the shot, so that we can see later when a picture was taken. But the tool also stores EXIF metadata, which can be used for processing. You can view the data with the exiftool.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

ExifTool Version Number:9.46

File Name:1052.jpg

Directory:.

File Size:483kB

File Modification Date/Time:2016:07:0808:49:52+02:00

File Access Date/Time:2016:07:0809:19:14+02:00

File Inode Change Date/Time:2016:07:0809:17:52+02:00

File Permissions:rw-r--r--

File Type:JPEG

MIME Type:image/jpeg

Exif ByteOrder:Big-endian(Motorola,MM)

Make:RaspberryPi

Camera Model Name:RP_b'imx219'

XResolution:72

YResolution:72

Resolution Unit:inches

Modify Date:2016:07:0508:37:33

YCb Cr Positioning:Centered

Exposure Time:1/772

FNumber:2.0

Exposure Program:Aperture-priority AE

ISO:50

Exif Version:0220

Date/Time Original:2016:07:0508:37:33

Create Date:2016:07:0508:37:33

Components Configuration:Y,Cb,Cr,-

Shutter Speed Value:1/772

Aperture Value:2.0

Brightness Value:2.99

Max Aperture Value:2.0

Metering Mode:Center-weighted average

Flash:No Flash

Focal Length:3.0mm

Maker Note Unknown Text:(Binary data332bytes,use-boption toextract)

Flashpix Version:0100

Color Space:sRGB

Exif Image Width:1024

Exif Image Height:768

Interoperability Index:R98-DCF basic file(sRGB)

Exposure Mode:Auto

White Balance:Auto

Compression:JPEG(old-style)

Thumbnail Offset:1054

Thumbnail Length:24576

Image Width:1024

Image Height:768

Encoding Process:Baseline DCT,Huffman coding

Bits Per Sample:8

Color Components:3

YCb Cr Sub Sampling:YCbCr4:2:0(22)

Aperture:2.0

Image Size:1024x768

Shutter Speed:1/772

Thumbnail Image:(Binary data24576bytes,use-boption toextract)

Focal Length:3.0mm

Light Value:12.6

Processing Images

The Raspberry Pi would need a lot of time to create an animated Gif or a video from these images. This is why I decided to add new images automatically to a Git repository on Github and fetch the results on my Desktop PC. I created a new Git repository and adapted the script shown above to store the images within the folder of the repository. I then use the following script to add and push the images to Github using a cronjob.

1

2

3

4

5

6

7

cd/home/stefan/Github/Timelapses

now=$(date+"%m_%d_%Y %H %M %S")

echo$now

git pull

git add *.jpg

git commit-am"New pictures added $now"

git push

You can add this to you user’s cron table with
crontab-e and the following line, which adds the images every 5 minutes,

1

*/5****/home/stefan/Github/Timelapses/addToGit.sh

On a more potent machine, you can clone the repository and pull the new images like this:

1

2

3

4

cd/home/stefan-srv/Github/Timelapses

now=$(date+"%m_%d_%Y %H %M %S")

echo"$now"

git pull--rebase

The file names are convenient for being able to read the date when it was taken, but most of the Linux tools require the files to be named within a sequence. The following code snippet renames the files into a sequence with four digits and pads them with zeros if possible.

1

2

3

4

5

6

a=1

foriin*.jpg;do

new=$(printf"%04d.jpg""$a")#04 pad to length of 4

mv--"$i""$new"

leta=a+1

done

Animated Gifs

Imagemagick offers a set of great tools for images processing. With its submodule convert, you can create animated Gifs from a series of images like this:

1

convert-delay10-loop0*.jpg Output.gif

This adds a delay after each images and loops the gif images infinitely. ImageMagick requires a lot of RAM for larger Gif images and does not handle memory allocation well, but the results are still nice. Note that the files get very large, so a smaller resolution might be more practical.

Still Images to Videos

The still images can also be converted in videos. Use the following command to create an image with 10 frames per second:

1

avconv-framerate10-fimage2-i%04d.jpg-c:vh264-crf1out.mov

Example: Nordkette at Innsbruck, Tirol

This timelapse video of the Inn Valley Range in the north of the city of Innsbruck has been created by taking a picture with a Raspberry Pi Camera Module V2 every 5 minutes. This video consists of 1066 still images.

Recently there have been a lot of activities in order to get our RDA Recommendations for Data Citation implemented. This included a trip to St. Louis where I have been invited to discuss details about the data infrastructure at the center of biomedical informatics (CBMI) at the Washington University of St. Louis. Besides having a very productive workshop, I also got the opportunity to see a little bit of St. Louis. The city may not be within the top ten cities to visit for Europeans, but it has a lot to offer and see. Please find a few impressions below.

General Tips

The Lambert-Saint Louis International Airport (STL) is pretty easy to reach and not far away from the city. There is a local light railway connecting the airport with the city. The 2 hours ticket for the MetroLink only costs 4$ and this should be sufficient for reaching your hotel. The ticket also includes the bus. As probably in many cities in the US, public transport is not that well. It is enough to do some sight seeing, but as you will see most of the locals have and use cars. Also I was advised that public transport is not that safe after dark (as are some areas in St. Louis in general).

The bus system is quite difficult to use if you so not have a data plan for your cell phone. I would advice to buy a prepaid SIM card for the US, which I failed to do in advance. I couldn’t easily find anything suitable to buy locally, so I had to rely on my Osmand+ offline map. There is not one center in st. Louis, but rather different neighbourhoods. I found Uber to be a great alternative to the public transport in terms of convenience and safety. Not having a data plan, I had to use available Wifis to book the car. You do not need any additional data exchange, as you also receive the details via text message (e.g. number plate) and the driver would shout your name if he can’t see you immediately.

Delmar Loop and Central West End

The Delmar Loop and Central West End are both areas with a lot of restaurants and bars. An interesting place is the Blueberry Hill, where Chuck Berry played and is still playing his famous guitar riffs.

Gateway to the West

The Gateway Arch is the landmark of St. Louis and truly impressive. I used my jetlag to be there early, which I would recommend. You can buy the tickets in advance on the Gateway Arch web site. You can go to the top of the bow with a tram, which is quite an experience. The train trolleys are pretty small but (as everywhere) there is good air condition. The view is breathtaking and you can stay at the platform a long a you want. You can also book a boat cruise on the Mississippi, but this is not really impressive. The paddle steamers are actually fake and there is not much to see besides the (still impressive) Arch and the sky line.

Close to the Arch is the Old Court House which hosts an exhibition on the dark times of slavery, where St. Louis played a central role. The visit is free. Nearby is the ball park which is also worth a visit, if you are into baseball.

Forest Park, Zoo and Museums

The Forest Park is one of the largest city parks in the world and with its area of more than 5.55 km2 even larger than the Central Park in NY (haven’t been there myself yet, but sure sounds great! :-)). The park is beautiful, but also not all areas are designed for pedestrians. The park also provides a Zoo which you can enter free of charge (and there are not even queues). The zoo is really nice and exhibits a lot of (more or less exotic) animals. There is also the Missouri History Museum and the Saint Louis Art Museum, both of which are very nice. I accidentally paid an entrance fee at the Art Museum, which adds the amazing carpets exhibition (if you are into carpets, which I am not).

City Museum and City Park

The city museum is not really a museum but rather a playground for children and adults. It is one of the more crazier sights and great fun, especially if you like to climb around. It could be quite challenge estimate if you fit through the tunnels and climbing obstacles. At some point I was afraid that I could probably make it through the local newspaper as getting stuck was very likely. Wear sport equipment.

Even more impressive is the City Garden, which features a lot of statues and sculptures from famous artists. It is an oasis in the city and a nice place to recover from the City Museum.

Botanical Garden

St. Louis also provides a very nice botanical garden, which is definitely one of the top sights. The entrance fee was just 8$ and totally worth it. Everything is very well maintained, but the blue fountain does not seem to be organic.