Funny how seeing a guy in a photo from 2002 brings back the memory of having seen him before.

While importing scanned photos in my photo library, I noticed a guy in a dark photo from 2002. Coline took this while we visiting Scotland with our pipeband.

This is Edinburgh Castle

I knew that face!
While visiting Scotland we were interviewed by a Dutch TV program, called “Kassa op reis”

https://schatkamer.beeldengeluid.nl/serie/2101608030021619131/kassa-op-reis/aflevering/2101608040030419531

So, 24 years later. Two images captured nearly 100 km apart.

Placeholder

Have to do posts about last month stuff, don’t have the time right now.
AND i’m sick

Microcontrollers

  • Two steppers to select components from a wall with component organizers (partly running, schematic and software)
  • New strong motor controller for animatronics
  • Stepper in an automated turntable for 3D scanning
    (in software test)
  • New software to push images to a TDisplay
  • My outside xmas leds can be controlled by people on the street using their phones, now more effects as last year
    And has a mini version in my living in sync with outside

Software from others

  • Testing SynKinectScan (with Microsoft Kinect) to scan 3D objects
  • Testing Mesa (An AI scanner for data on your drive to find files using context base searching
  • Writing some code for a client to use DMX controllers during december

Software

  • Red eye removal from photos using OpenCV (needs work)
  • A terminal which reacts like Mother on the spaceship in alien (partly done)
  • JPS (3D dual camera) to wiggle vision script (done)

Generic stuff

  • Compiled a Concertina music book for practicing
  • Re-implemented namazu, but over network drives
  • Given my dad a chromecast device with connection to my library of 8MM film, old VHS movies and scanned negatives/photots
  • An acdsee/digiKam tags to Immich injector (buggy)
  • Working on an immich thumbnail replacer
  • Compiling a worksheet to try all kinds of Cigar infusions (Rum, tequilla and more)
  • Made a test pythonscript to make our whole folkband like this
    https://www.henriaanstoot.nl/2025/03/03/moving-photo-test/
  • Getting digital media sorted out from before 2000 .. no exif dates, photo scans and non standard media extensions
  • Writing seconds in MuseScore
  • Taking apart Kortlinje, to replace firmware

Other stuff

Hugin / generic panorama injector for immich

I have a bunch of panorama’s, made with phones or my Nikon DLSR stitched with Hugin.
These are not being detected as panorama by Immich, due to missing panorama tags …
Here is my fix

./makepanorama2.sh '750_5488_resize - 750_5532_resize.jpg' --flip
Input:       750_5488_resize - 750_5532_resize.jpg
Orientation: Horizontal (normal)
Applying EXIF orientation...
Flipping image vertically...
Image size:  8712 x 846
Full panorama: 8712 x 4356
Crop:          8712 x 846
Crop top:      1755
    1 image files updated

Created: ./injected-750_5488_resize - 750_5532_resize.jpg

GPano:
[File]          ImageWidth                      : 8712
[File]          ImageHeight                     : 846
[IFD0]          Orientation                     : Rotate 180
[XMP-GPano]     ProjectionType                  : equirectangular
[XMP-GPano]     FullPanoWidthPixels             : 8712
[XMP-GPano]     FullPanoHeightPixels            : 4356
[XMP-GPano]     CroppedAreaImageWidthPixels     : 8712
[XMP-GPano]     CroppedAreaImageHeightPixels    : 846
[XMP-GPano]     CroppedAreaLeftPixels           : 0
[XMP-GPano]     CroppedAreaTopPixels            : 1755

From:

To:

Immich media fixer

I’ve got a bunch of media in my library with the following issues:

  • Images : too dark (rotation can be done within Immich)
  • Videos : too dark, interlaced or rotated

I used to fix these by removing from Immich, change original media, and upload again.
Then I had to fix the date of media with missing exif dates, using touch command.

Now I have a script which is doing the following:

  • Copy the URL containing the media
  • It downloads the media using API calls
  • It downloads the metadata for dates and tags
  • I calls a second python script in which you can do the following:
    Change contrast/brightness, rotate CW or CCW, and select deinterlace when needed.
  • Write the new image or movie to a temp file
  • When exiting the editor the first called python script uploads the altered media and fixes tags and dates
  • After that some jobs are being started: Thumbnail recreation, Encoded videos, metadata and face recognition.

Takes only a few seconds to fix an asset

No code, because of some Vibe coding.
PM me if interested ..

Immich hints and tips part 2

FIX rotation of movie

usage rotatefix movie001.mpg 90 (or -90)

If your data is in a external library, you can do this on the file in the library. After that you have to select it and do the following:

  • Refresh encoded videos
  • Refresh metadata
  • Refresh thumbnails
#!/bin/bash
#set -x
if [ "$#" -lt 2 ]; then
  echo >&2 'fix filename 90||-90||0'
  exit 1
fi

fix=0
exiftool $1  | grep "^Create Date" | grep 0000 && fix=1 

dater=$(realpath $1| grep -oE '[0-9]{8}' | head -1 )
if [ $2 == "90" ] ; then
	ffmpeg -i $1  -vf 'transpose=1' -c:a copy  tmp_${1} 
mv tmp_${1} $1
fi
if [ $2 == "-90" ] ; then
	ffmpeg -i $1  -vf 'transpose=2' -c:a copy  tmp_${1} 
mv tmp_${1} $1
fi
if [ $fix == "1" ] ; then
	echo "Fixing date"
	touch -t ${dater}1200.00 $1
fi

Get location of file by pressing the (i)

Deinterlace video and touch date, when no exif date is embedded

#!/bin/bash

mkdir -p deinterlace

for video in DV*; do
    [ -f "$video" ] || continue

    : >2.log
    echo "testing $video"

    ffmpeg -i "$video" -filter:v idet -frames:v 500 -an -f rawvideo -y /dev/null 2>2.log

    inter=$(
        grep Parsed 2.log |
        tail -2 |
        cut -d: -f2- |
        awk '
        {
            inter += $2 + $4
            prog += $6
        }
        END {
            print (inter > prog ? 1 : 0)
        }'
    )

    if [ "$inter" -eq 1 ]; then
        echo "convert $video"
         ffmpeg -i "$video" -vf bwdif -c:v libx264 -crf 18 -preset medium \
             -c:a aac -b:a 192k "deinterlace/${video%.*}-deinterlaced.mp4"
    fi

    dt=$(echo "$video" | grep -oE '[0-9]{2}-[0-9]{2}-[0-9]{2}_[0-9]{2}-[0-9]{2}' | tr '_' ' ' | tr '-' ' ')

if [ -n "$dt" ]; then
    # convert DD-MM-YY HH-MM to YYYY-MM-DD HH:MM
    read year month day hour minute <<< "$dt"

    # assume 20xx for year
    year=$((2000 + year))

    touch -d "$year-$month-$day $hour:$minute:00" "deinterlace/${video%.*}-deinterlaced.mp4"
    touch -d "$year-$month-$day $hour:$minute:00" "$video"
fi
done

FIX DATES FILES in /2006/20060701/ structure

This touches files which have no exif info, to the date of the directory to that date with time 12:00

find . -type f -iname "*.mpg" | while read -r file; do     ymd=$(echo "$file" | grep -oE '[0-9]{8}' | head -1);     touch -t "${ymd}1200.00" "$file"; done

Touch date of current directory to date in path

for f in *; do
    [[ $f =~ ([0-9]{8}) ]] || continue
    touch -t "${BASH_REMATCH[1]}1200.00" "$f"
done

Broken thumb nail fix

# goto movie file in your library
# Add flags using below command
ffmpeg -i 73a1a221be4c.mp4 -c copy -video_track_timescale 90000 -movflags +faststart output.mp4
# replace movie file
cat output.mp4 > 73a1a221be4c.mp4 
rm output.mp4
# then fresh encoded videos in immich, then refresh metadata and thumbnails.

FIX Date unknown or incorrect dates

#!/bin/bash
if [ "$#" -ne 2 ]; then
    echo "Usage: $0 <movie-file> <YYYYMMDD>"
    exit 1
fi

FILE="$1"
DATE="$2"

# Validate date format
if [[ ! "$DATE" =~ ^[0-9]{8}$ ]]; then
    echo "Error: date must be YYYYMMDD"
    exit 1
fi

# Convert YYYYMMDD -> YYYY:MM:DD 12:00:00 for EXIF metadata
YEAR="${DATE:0:4}"
MONTH="${DATE:4:2}"
DAY="${DATE:6:2}"
EXIFDATE="${YEAR}:${MONTH}:${DAY} 12:00:00"

# touch format: YYYYMMDD1200.00
TOUCHDATE="${DATE}1200.00"

echo "File:       $FILE"
echo "Date:       $DATE"
echo "Metadata:   $EXIFDATE"
echo "Filesystem: $TOUCHDATE"

# Change movie metadata dates
exiftool -overwrite_original \
    "-CreateDate=$EXIFDATE" \
    "-ModifyDate=$EXIFDATE" \
    "-TrackCreateDate=$EXIFDATE" \
    "-TrackModifyDate=$EXIFDATE" \
    "-MediaCreateDate=$EXIFDATE" \
    "-MediaModifyDate=$EXIFDATE" \
    "$FILE"

if [ $? -ne 0 ]; then
    echo "Error: exiftool failed"
    exit 1
fi

# Change filesystem timestamps
touch -t "$TOUCHDATE" "$FILE"

if [ $? -ne 0 ]; then
    echo "Error: touch failed"
    exit 1
fi

MKV remove dates

mkvpropedit input.mkv --edit info --delete date

Mazewar (1973) websocket V2


UPDATE: 20280826 – Made a Microcontroller joystick controller for the maze game.

Above test was abandoned, it was working okay.
But I made a V2 using some vibe coding … yeah, I know …
Time to shelf …

Works:

  • Mqtt websocket
  • Multiuser
  • Keyboard control
  • Fire/kill detection
  • Admin view

No working / needs work / nice to have:

  • Restart after kill, resets score
  • Set own username
  • Sound effects?
  • Degrees are > 360 .. lol

UPDATE: 20280828

import time
import board
import digitalio
import usb_hid

from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keycode import Keycode


# GPIO -> tactile switch -> GND
BUTTONS = {
    board.GP2: Keycode.UP_ARROW,
    board.GP4: Keycode.DOWN_ARROW,
    board.GP3: Keycode.LEFT_ARROW,
    board.GP1: Keycode.RIGHT_ARROW,
    board.GP0: Keycode.SPACE,
    board.GP5: Keycode.Q,
    board.GP7: Keycode.E,
}


keyboard = Keyboard(usb_hid.devices)

inputs = {}

for pin, key in BUTTONS.items():
    button = digitalio.DigitalInOut(pin)
    button.direction = digitalio.Direction.INPUT
    button.pull = digitalio.Pull.UP
    inputs[pin] = (button, key)


# Remember previous state
last_state = {}

for pin, (button, key) in inputs.items():
    last_state[pin] = button.value

while True:

    for pin, (button, key) in inputs.items():

        state = button.value

        # Button changed
        if state != last_state[pin]:

            if not state:
                # Press
                keyboard.press(key)

            else:
                # Release
                keyboard.release(key)

            last_state[pin] = state

    time.sleep(0.005)

Plotting v2 using my old 3D printer

My previous plotter test was using my old Laser-cutter, I sold this one, because I wanted a better one.

So, I was thinking about repurposing my old 3D printer as Plotter/CNC machine.

Pen holder in above post was GCODE controlled, but I lost it somewhere. Now not needed because i’ve got a bedslinger 3D printer with Z axis instead of using a X/Y lasercutter frame.

Using Inkscape and OpenScad (to design a pen holder see below)

In Inkscape you need the Gcodetool extention

UPDATE:

Some text writing using Hershey fonts.

Below a python script to move X/Y in the GCODE

#!/usr/bin/env python3
import re
import sys

OFFSET_X = 40.0
OFFSET_Y = 80.0


def shift_gcode(input_file, output_file):
    coord_re = re.compile(r'([XY])([-+]?\d*\.?\d+)')

    with open(input_file, "r", encoding="utf-8", errors="ignore") as f:
        lines = f.readlines()

    with open(output_file, "w", encoding="utf-8") as f:
        for line in lines:

            def replace_coord(match):
                axis = match.group(1)
                value = float(match.group(2))

                if axis == "X":
                    value += OFFSET_X
                elif axis == "Y":
                    value += OFFSET_Y

                if value.is_integer():
                    value = int(value)

                return f"{axis}{value}"

            line = coord_re.sub(replace_coord, line)
            f.write(line)


if __name__ == "__main__":
    if len(sys.argv) != 3:
        print(f"Usage: {sys.argv[0]} input.gcode output.gcode")
        sys.exit(1)

    shift_gcode(sys.argv[1], sys.argv[2])
    print(f"Shifted X/Y by {OFFSET_X} x {OFFSET_Y} mm: {sys.argv[1]} -> {sys.argv[2]}")

Pen height adjusted using sed

sed -i "s/Z0.0/Z1.5/g" example.gcode

Old radio part 2

So this week I made a Magic Eye replacement using an ESP32, Microphone and a round display.

Maybe I have to fix the black dot (bigger) the lines on the 3D printed part will be invisible when placed in the radio frame.
We’ll see.

Today I made some code to switch to different playlists, using triggers.

  • Multiple playlists containing mp3’s which will be played in order
  • I can trigger at any time a moment that static will be mixed in
  • After the static I can play a new playlist

So this will emulate turning into a radio channel and searching for the next channel

Little demo below

For tuning I will use potentiometer or a rotary encoder to select playlists, using the original knobs below.

Home Assistant day

1 – Added remote control for our media devices.

2 – Added automation for our green wall with plants in the garden
(These can be watered using a zigbee automatic valve.)

If during the day the temperature is above 25 degrees, a water drip value is turned on for 5 minutes

alias: Groene muur
description: ""
triggers:
  - trigger: time
    at: "01:00:00"
    id: reset
  - trigger: time
    at: "20:00:00"
    id: run
  - trigger: temperature.changed
    target:
      entity_id: sensor.buienradar_temperature
    options:
      threshold:
        type: above
        value:
          active_choice: number
          number: 25
          unit_of_measurement: °C
    id: temptrig
  - trigger: time
    at: "20:05:00"
    id: stoprun
conditions: []
actions:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - reset
        sequence:
          - action: input_number.set_value
            metadata: {}
            target:
              entity_id: input_number.heattrigger
            data:
              value: 0
      - conditions:
          - condition: trigger
            id:
              - temptrig
        sequence:
          - action: input_number.set_value
            metadata: {}
            target:
              entity_id: input_number.heattrigger
            data:
              value: 25
      - conditions:
          - condition: trigger
            id:
              - run
          - condition: numeric_state
            entity_id: input_number.heattrigger
            above: 24
        sequence:
          - action: switch.turn_on
            metadata: {}
            target:
              entity_id: switch.0x4c97a1fffeef9146_valve_1
            data: {}
      - conditions:
          - condition: trigger
            id:
              - stoprun
        sequence:
          - action: switch.turn_off
            metadata: {}
            target:
              entity_id: switch.0x4c97a1fffeef9146_valve_1
            data: {}
mode: single

3 – A little automation to display “Put the bins out!” on my TV, when a led it still on and the lid not pushed on my afvalwijzer thingy

No code : this is too customized, interested? Mail me

Next to do .. make my cover art display using esphome.