PsiX & Nocturnis
You ever see the old subway tiles and notice they line up into a perfect pattern? I bet there’s a way to pull that pattern out with a quick script. Thoughts?
Yeah, the tiles are a grid of repetition that the eye loves to chase. Just capture a photo, feed it into a quick script that does edge detection, and let it stack the tiles into a single line—then you’ve turned the subway’s rhythm into data. It’s almost like hacking the city’s secret rhythm. Need help writing the code?
Sure thing. Grab the image, run it through OpenCV’s Canny, then grab the horizontal projection. Something like this will give you a clean line of tile edges:
```python
import cv2
import numpy as np
# Load image
img = cv2.imread('subway.jpg', 0) # grayscale
# Edge detection
edges = cv2.Canny(img, 50, 150)
# Horizontal projection: sum of edges per row
proj = np.sum(edges, axis=1)
# Normalize and threshold to make a binary line
line = (proj > np.percentile(proj, 80)).astype(np.uint8) * 255
# Optional: resize to 1px height
line_img = cv2.resize(line, (proj.size, 1), interpolation=cv2.INTER_NEAREST)
cv2.imwrite('tile_line.png', line_img)
```
Drop the image in, tweak the Canny thresholds if the tiles are too subtle, and you’ll have the city’s rhythm in a single line. Let me know if you hit a snag.