I’ve got a pretty nifty method for automating getting a photo off my sony a7iii onto my orangepi3 and then the internet.
It’s useful for when I can run the wifi router (GL.iNet Opal) and the OrangePi 3 LTS off a battery in my backpack. I can be walking around and on a click of a button on my camera I can have a jpg on a local webdir for my access. Could be good for live events, photojournalism and prob other things.
I’ll be going over how I’ve set this up, but want to be clear there’s other methods out there. This is just what works for me
Starting on the GL.iNet router just set it up with a simple wifi network broadcast, and maybe have it relay your phones hotspot.
On a Pi (OrangePi, RaspberryPi, PotatoPi, EtcPi) have it be connected to the travel router and set up FTP
I’m using vsftp for this very silly foto transferring project.
On the camera (mines the Sony A7iii) Setup the Wifi and FTP settings.
This can be a pain, but it is possible to get it working consistently. Also for the a7iii you can remap buttons, and one is wifi/ftp upload while viewing a photo.
Back on the Pi, to convert the raw (.arw for sony) photo into a jpg, install darktable (yes, even if headless) it includes darktable-cli which is awesome.
I have a script to watch a dir for a .arw, then convert to jpg. note: use script at your own risk. “It works for me”
MONDIR="/var/lib/docker.rage/ftp_home/usera7/ftp/raw"
JPGDIR="/var/lib/docker.rage/ftp_home/usera7/ftp/jpg/"
inotifywait -m -e close_write --format '%w%f' "${MONDIR}" | while read NEWFILE
do
echo "hi ${NEWFILE}"
outname=$(basename $NEWFILE | sed 's/ARW/jpg/')
darktable-cli ${NEWFILE} $JPGDIR$outname
done
Here’s the script to detect what’s in the image. I’ll go over how to set it up in another post maybe. Again, use at your own risk.
import inotify.adapters
import os
import sys
from ultralytics import YOLO
import time
if __name__ == '__main__':
model=YOLO('yolov8m.pt')
i = inotify.adapters.Inotify()
watchPath='/var/lib/docker.rage/ftp_home/usera7/ftp/jpg/'
print("1")
watchMask = inotify.constants.IN_CLOSE_WRITE
i.add_watch(watchPath, watchMask)
created_files=set()
for event in i.event_gen(yield_nones=False):
(_, type_names, path, filename) = event
if "IN_CLOSE_WRITE" in type_names:
if filename not in created_files:
print("PATH=[{}] FILENAME=[{}] EVENT_TYPES={}".format(path, filename, type_names))
name, extension = os.path.splitext(filename)
created_files.add(filename)
fp=path+filename
time.sleep(5)
res = model.predict(fp)[0]
res.show()
res.save(filename="predict/predict_"+filename)
from here set up some simple systemd scripts to auto run. an httpserver and you got yourself whatever this is.
[Unit]
Description = Converts a raw into a jay peg
[Service]
ExecStart=/var/lib/docker.rage/ftp_home/usera7/ftp/awrjpeg.sh
[Install]
WantedBy=multi-user.target