This and that, bits and bobs...
...A small web api by 6 letter species code describing how a species is represented in Merlin Sound ID:
Boxes, Boxes, Boxes!
Trans: Latin prefix implying "across" or "Beyond", often used in gender nonconforming situations – Scend: Archaic word describing a strong "surge" or "wave", originating with 15th century english sailors – Survival: 15th century english compound word describing an existence only worth transcending.
This and that, bits and bobs...
Boxes, Boxes, Boxes!
...The usual racket...
...Despite being a chilly & wintery March up here in the White Mountains, there is no shortage of fun birds and exciting projects!
|It's happening, and it is going to be awesome||YMMV, but YOLO:|
A ridiculous Chindōgu utility prompt & CLI for fetching private releases & files from GitHub & BitBucket
FetchEverythingSampleEnv_GitHub; pass as an argument with the
./LeafletSync -e YourEnvFile) or provide one on launch.
curl https://raw.githubusercontent.com/Jesssullivan/LeafletSync/main/LeafletSync --output LeafletSync && chmod +x LeafletSync && ./LeafletSync
Knowing both the Field of View (FoV) of a camera's lens and the dimensions of the object we'd like to measure (Region of Interest, ROI) seems like more than enough to get a distance.
...But without calibration or much forethought, could rough measurements of known objects even be usable? Some notes from a math challenged individual:
# clone: git clone https://github.com/Jesssullivan/misc-roi-distance-notes && cd misc-roi-distance-notes
Most webcams don't really provide a Field of View much greater than ~50 degrees- this is the value of a MacBook Pro's webcam for instance. Here's the plan to get a Focal Length value from Field of View:
So, thinking along the lines of similar triangles:
source a fresh venv to fiddle from:
# venv: python3 -m venv distance_venv source distance_venv/bin/activate # depends are imutils & opencv-contrib-python: pip3 install -r requirements.txt
The opencv people provide a bunch of prebuilt Haar cascade models, so let's just snag one of them to experiment. Here's one to detect human faces, we've all got one of those:
mkdir haar wget https://raw.githubusercontent.com/opencv/opencv/master/data/haarcascades/haarcascade_frontalface_alt2.xml -O ./haar/haarcascade_frontalface_alt2.xml
Of course, an actual thing with fixed dimensions would be better, like a stop sign!
Let's try to calculate the distance as the difference between an actual dimension of the object with a detected dimension- here's the plan:
# `python3 measure.py` import math from cv2 import cv2 DFOV_DEGREES = 50 # such as average laptop webcam horizontal field of view KNOWN_ROI_MM = 240 # say, height of a human head # image source: cap = cv2.VideoCapture(0) # detector: cascade = cv2.CascadeClassifier('./haar/haarcascade_frontalface_alt2.xml') while True: # Capture & resize a single image: _, image = cap.read() image = cv2.resize(image, (0, 0), fx=.7, fy=0.7, interpolation=cv2.INTER_NEAREST) # Convert to greyscale while processing: gray_conv = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) gray = cv2.GaussianBlur(gray_conv, (7, 7), 0) # get image dimensions: gray_width = gray.shape gray_height = gray.shape focal_value = (gray_height / 2) / math.tan(math.radians(DFOV_DEGREES / 2)) # run detector: result = cascade.detectMultiScale(gray) for x, y, h, w in result: dist = KNOWN_ROI_MM * focal_value / h dist_in = dist / 25.4 # update display: cv2.rectangle(image, (x, y), (x + w, y + h), (255, 0, 0), 2) cv2.putText(image, 'Distance:' + str(round(dist_in)) + ' Inches', (5, 100), cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255), 2) cv2.imshow('face detection', image) if cv2.waitKey(1) == ord('q'): break
run demo with:
..also, check out the sporadically maintained Terrific Music list too @ /musics :)***
/* ...happily processing some data in a browser, when suddenly... ....panik! you need to complete a portion of this processing elsewhere on some server...: */
Or, when life gives you apples, use Linux
First, boot into recovery mode by rebooting while holding down the
At this stage, you'll need to connect to the internet briefly to download the recovery OS. This provides a few tools including like disk utility, support, an osx reinstaller- at the top menu, you'll find an option to access a terminal.
Once in there, you'll want to:
While holding down
R to start afresh with cleared NVRAM.
Reboot once again while holding down the
R keys to return to the recovery OS. Reinstall whatever version of OSX it offers- instead of trying to deal with the slippery, network connected DEP plists & binaries contained within the various
LaunchDaemons found in the
/System/Library directories directly, we'll let Apple finish with the
ConfigurationProfiles first, then sneak in and remove them.
wget -nd http://cdimage.ubuntu.com/ubuntu-budgie/releases/20.04.1/release/ubuntu-budgie-20.04.1-desktop-amd64.iso umount /dev/sdc 2>/dev/null || true sudo dd if=ubuntu-budgie-20.04.1-desktop-amd64.iso of=/dev/sdc bs=1048576 && sync
Boot up again, this time holding the
Option key for the bootloader menu. Once in the live usb system, make sure you can read Apples HFS filesystem:
sudo apt-get install hfsprogs
For me at least, I needed to run a quick
fsck to fix up the headers before I could mount the osx filesystem living at
sda1 is the
sudo fsck.hfsplus /dev/sda2
Now, lets go in there and remove those ConfigurationProfiles:
mkdir badapple sudo mount -o force /dev/sda2 badapple cd badapple sudo rm -rf private/var/db/ConfigurationProfiles/*