Category Archives: Hobby

Automatic photo sorting with Gps location lookup

We take a lot of pictures, with our Nikon camera and our mobile phones.

(Apparently in 2019 5544 pictures)

Some stats

757 20190803 - on a single day (Holiday)

Average pictures per month
locate "/2019/" | egrep -i "photoalbum|gsm" | egrep -i "mp4$|jpg$" | grep -Eo '2[[:digit:]]{3}[[:digit:]]{2}[[:digit:]]{2}' | cut -c-6 |sort | uniq -c | sort -n | awk '{ sum += $1; n++ } END { if (n > 0) print sum / n; }'
461

Besides android pictures being automatically uploaded to our nextcloud, I’m using some apps and scripts to get pictures and movies stored on my fileserver. (bash scripts/andftp)

For sorting those media files, i made a sorting script.
(Today I added a location sorting addition using GPS information stored in the exif information.

  • jpg and jpeg (add your own extentions)
  • mp4 and mov (for mobile and nikon)
  • Sorts by camera model/year/date/location
  • tries to extract date from filename when not found in exifinfo
  • Sorts whatsapp media
  • Sorts Raw

INSTALLING

pip3 install reverse_geocoder
You need python3, exiftool, exiftime and mediainfo

copy below python script in ~/bin/reverse2.py

( need more info? change last print entry admin1/admin2)
[{‘lat’: ‘-39.45556’, ‘lon’: ‘173.85833’, ‘name’: ‘Opunake’, ‘admin1’: ‘Taranaki’, ‘admin2’: ‘South Taranaki District’, ‘cc’: ‘NZ’}]

import reverse_geocoder as rg
import sys

lat=sys.argv[1]
lon=sys.argv[2]

coordinates = (lat,lon)

results = rg.search(coordinates) # default mode = 2


#print (results)

for entry in results:
    print(entry['name'] + "(" +  entry['cc'] + ")")

And a bash script /usr/local/bin/exifsort.sh

#!/bin/bash
#set -x

reversepath=/home/henri/projects/reversegeo/reverse2.py

#RAW
rawcnt=`ls | grep -i  nef$ | wc -l`
if [ "$rawcnt" = "0" ] ; then
echo "no raw"
else
mkdir raw 2>/dev/null
ls | grep -i nef$ | while read ; do mv $REPLY raw ; done
fi


ls | egrep -i "jpg$|jpeg" | while read ; do 
 	location=""	
	getmodel=$(exiftool "$REPLY" |grep "Make " | awk '{ print $3 }')
	if [ "$getmodel" != "" ] ; then 
		getmodel=$getmodel/
	fi
	echo "$REPLY" | grep WA0 >/dev/null && getmodel=whatsapp/

	gpsinfo=$(exiftool -c "%+.6f" "$REPLY" |grep "GPS Position" | cut -d":" -f2 | tr -d ' ' | sed s/,/\ /g)
	if [ "$gpsinfo" != "" ] ; then 
		location=$(python3 $reversepath $gpsinfo | grep -vi load | sed s/\(NL\)//g)
	fi
	dater=$(exiftime "$REPLY" 2>/dev/null | egrep "Created|Digitized" | sed s/Digitized/Created/g | tail -1  | cut -c 16-19,21,22,24,25)
	if [ "$dater" = "" ] ; then 
#		echo "Trying from filename"
		dater=$(echo $REPLY | grep -Eo '2[[:digit:]]{3}-[[:digit:]]{2}-[[:digit:]]{2}')

		if [ "$dater" = "" ] ; then 
#			echo "Trying from filename - maybe without dashes"
			dater=$(echo $REPLY | grep -Eo '2[[:digit:]]{3}[[:digit:]]{2}[[:digit:]]{2}')

		fi
	fi
	if [ "$dater" != "" ] ; then 
		year=$(echo $dater | cut -c-4)
		mkdir -p "${getmodel}$year/${dater}/$location"
		mv "$REPLY" "${getmodel}${year}/${dater}/$location"
	else
		mkdir -p "${getmodel}unknowndate/$location"
		mv "$REPLY" "${getmodel}unknowndate/$location"
      	fi
done

ls | egrep -i "mov$|mp4$" | while read ; do 
	
 	location=""	
	getmodel=$(exiftool "$REPLY" |grep "Make " | awk '{ print $3 }')
	if [ "$getmodel" != "" ] ; then 
		getmodel=$getmodel/
	fi

	echo "$REPLY" | grep WA0 >/dev/null && getmodel=whatsapp/
	gpsinfo=$(exiftool -c "%+.6f" "$REPLY" |grep "GPS Position" | cut -d":" -f2 | tr -d ' ' | sed s/,/\ /g)
	if [ "$gpsinfo" != "" ] ; then 
		location=$(python3 $reversepath $gpsinfo | grep -vi load | sed s/\(NL\)//g)
	fi
	dater=$(mediainfo "$REPLY" | grep Encode | tail -1 | cut -f2- -d:  | cut -f3 -d" " | sed s/-//g)
	if [ "$dater" = "" ] ; then 
#		echo "Trying from filename"
		dater=$(echo $REPLY | grep -Eo '2[[:digit:]]{3}-[[:digit:]]{2}-[[:digit:]]{2}')

		if [ "$dater" = "" ] ; then 
#			echo "Trying from filename - maybe without dashes"
			dater=$(echo $REPLY | grep -Eo '2[[:digit:]]{3}[[:digit:]]{2}[[:digit:]]{2}')

		fi
	fi
	if [ "$dater" != "" ] ; then 
		year=$(echo $dater | cut -c-4)
		mkdir -p "${getmodel}$year/${dater}/$location"
		mv "$REPLY" "${getmodel}${year}/${dater}/$location"
	else
		mkdir -p "${getmodel}unknowndate/$location"
		mv "$REPLY" "${getmodel}unknowndate/$location"
      	fi
done

Example running in a directory with mixed media

# Raw images get moved into a RAW directory
no raw

# Samsung phone detected with date and GPS location
mkdir -p samsung/20220717/Hilversum
mv 20220717_133453.jpg samsung/20220717/Hilversum

# OnePlus phone
mkdir -p OnePlus/20021208/Voorburg
mv IMG_20190109_091825.jpg OnePlus/20021208/Voorburg

# Realme (Added country when not NL)
mkdir -p realme/20220607/Isle of Islay(GB)
mv IMG20220607213630.jpg realme/20220607/Isle of Islay(GB)

# Whatsapp has no date embedded so it gets it from filename
Trying from filename
Trying from filename - maybe without dashes
mkdir -p whatsapp/20221021/
mv IMG-20221021-WA0000.jpg whatsapp/20221021/

# Nikon without GPS
mkdir -p NIKON/20220613/
mv DSC_1423.MOV NIKON/20220613/

# Whatsapp video without exif
mkdir -p whatsapp/20170528/
mv VID-20170528-WA0006.mp4 whatsapp/20170528/

# No camera name detected in exif from mobile movie
mkdir -p 20190114/Maarssen
mv VID_20190114_142455.mp4 20190114/Maarssen

# Location in mp4
mkdir -p 20220607/Lamlash(GB)
mv VID20220607155044.mp4 20220607/Lamlash(GB)

Result

./NIKON/2022/20220613/DSC_1423.MOV
./NIKON/2022/20220610/750_1101.JPG
./realme/2022/20220818/Hilversum/IMG20220818203825.jpg
./realme/2022/20220607/Isle of Islay(GB)/IMG20220607213630.jpg
./2019/20190114/Maarssen/VID_20190114_142455.mp4
./whatsapp/2017/20170528/VID-20170528-WA0006.mp4
./whatsapp/2022/20221021/IMG-20221021-WA0000.jpg
./2022/20220607/Lamlash(GB)/VID20220607155044.mp4
./2022/20220516/Hilversum/VID20220516125913.mp4
./OnePlus/2002/20021208/Voorburg/IMG_20190109_091825.jpg
./samsung/2022/20220717/Hilversum/20220717_133453.jpg

You could automate this using incrond
apt-get install incron
add your user to /etc/incron.allow
incrontab -e
add

/fileserver/mediain/ IN_CREATE /usr/local/bin/sortmymedia.sh
Coping a file in the directory, auto sort and move to correct location

sortmymedia.sh

#!/bin/bash
cd /home/user/media
/usr/local/bin/exifsort.sh

Workshop Cyanotype

The cyanotype (from Ancient Greek kuáneos, “dark blue” and túpos, “mark, impression, type”) is a slow-reacting, photographic printing technique. It produces a cyan-blue print used for art as monochrome imagery applicable on a range of supports, and for reprography in the form of blueprints. For any purpose, the process usually uses two chemicals: ferric ammonium citrate or ferric ammonium oxalate, and potassium ferricyanide, and only water to develop and fix. Announced in 1842, it is still in use.

This technique was also used as a method of copying drawings.
For example buildings and schematics. While making copies of drawings with the exact dimensions of the original, making the result untemperable was another big plus. ( You could not move/redraw walls for example on the copy)

I’ve printed a photo on transparant sheets to experiment with.
(Next time, i’ll take a larger size, and fix the contrast.

The most interesting ones i’ve made today:

Hidden remotes

While having a lot automated, and controllable via apps, we sometimes need the remotes (TV/Chromecast/Mediacenter/etc)

They are always … gone, lost.

So i made a little wooden thingamajig, which is hidden behind our couch.
Maybe an idea also useful for you?

The gap between, the couch and the wall is there because of airflow and the skirting boards.

When looking from a normal perspective, you can’t see them.
(I still have to paint them in the same color as our wall)

In the wooden compartments is some bubble wrap plastic.
It has long “feet” so i can position it anywhere.

On the sides are power outlets for laptops, and usb charging cables.

Not much new

Last days .. welllll doing al kinds of stuff.

Composite video print designed and ordered from china.

Changed some vlans in my network.
I need to think of a way to extract/migrate domoticz 433 info into a new instance.
For example .. i’ve got some instances in my device list which are only being controlled by domoticz, there is no remote i can reuse.

Tried welding again, because i could not do it for a long time, i noticed i have to practice again after 2 years.
(I’ve got a dedicated power outlet outside now .. 🙂

Last 8mm films work done. (Converted all of my dad’s old 8mm reels)

Designed a hidden remote cabinet, holding remotes out of sight for the occasions when automation doesn’t work.

Designed also a wooden wall with hidden cabinets in our bedroom.

Repaired a Gardena Leafblower .. again!

Hedgehog home webcam

A while ago i made a little hedgehog home, so i bought a little ipcam from china .. It should be able to run for a while on a little lipo battery.

And yes we’ve got one in our garden, sometimes he hides under our patio.

So lets see if this cam is useful.

Diorama’s progress

I like to work on mini models and diorama’s.
The fine miniature work helps me relax, it’s a zen moment for me.

Restricted Content
To view this protected content, enter the password below:

Workbench outside

One of the first designs of the workbench i made in blender.

I wanted to have a big workbench outside, which must at least have:

  • Wheels to move it around
  • Storage space
  • Place to put my tablesaw and miter saw
  • Electrical outlets
  • Adjustable in height, using a car-jack!
  • Large working space
    • Without holes, because it would be nice to use the table for boardgames!

So in 2021 i came up with this:

Got some wood deliverd and start working on it in may 2022

Today

Wooden structure below i can put stuff on i don’t use. It can be used as separate low working space.

Oak island

I was about 16 when i first read about Oak Island, it was the first book posted below (it’s from 1979 and i still got it, it already was a few years old before i got it.). It was mysterious and about a place that still existed and i never forgot about it in all those years.

I even wanted to build a model to understand how it could have worked, with the drain system and the ‘boobystraps’.

In 2014 a series started on History Canada about trying to solve this mystery.
I still watch it whenever a new episode is posted.

A few years back i’ve been playing with Unity and Unreal. I’m really a beginner, but it would be nice if some community effort was made to get a Oak Island in a game engine where you can explore some of the things they found.

Another book i got some years later.

Garden mapping using triangulation

Inkscape and some measurements.
Use some control points to check for deviation.
Choosing bigger distances gives greater accuracy!
Add radius of trees to your measurements

Inkscape gives you length and angle degrees.
Check your measurements : https://www.calculator.net/triangle-calculator.html