Automatic Mapping Preview

Awesome, thanks. One question though: in the README you say

be sure your Pixelblaze is on, with the Automap pattern running

What mapping should be in place when it does this? I just added two new panels with a couple of hundred more pixels to my piece and configured the new pins they connect to on the output expander, but they’re not mapped anywhere yet (because I want to use CVTest for that of course.) But that means they won’t light up no matter what pattern I run.

You don’t need to have any map at all. The automap pattern just renders the pixels in 1d, in the order they’re connected.

One other thing that I should put in the readme - the default opencv-python is CPU-only. Even on blazing fast computers, it is slow – it will map only 2 or 3 LEDs per second. So be prepared to wait a while if you’ve got a lot of pixels.

If you’ve got an NVIDIA GPU, you can install a CUDA build of OpenCV and things will go a lot faster. This can be some work though since it involves building the OpenCV libraries yourself. See the OpenCV instructions for details. (It will probably take way longer to do this than it will to just wait for the CPU-only version to finish mapping.)

Note: I did the the build-it-yourself thing, but maybe there’s an easier way. See:

So you mean delete the current map? Set it to what?

The automap pattern is 1D – it just uses render(). You don’t have to change anything on the Pixelblaze. It should work fine no matter what map you’re using.

1 Like

I trust zranger1 to make more progress than anyone on this, but here’s my collection.

I got it working! Some tips for future thread-spelunkers:

  1. The current mapping doesn’t matter, but do make sure you’ve added the right number of pixels off each port of the output expander :man_facepalming:t3:
  2. The Automapper pattern doesn’t actually do anything until you start the python script (I initially thought it wasn’t working…)
  3. If you’re perching your laptop somewhere unusual so you can point it at your piece, set your display blanking/power saving to not turn off or lock your screen for half an hour—it does take a second or so per pixel and my piece is ~650 pixels so far so…
3 Likes

For laptops, you might also be plugged in, and have your power profile set to “Maximum Performance” or your system’s equivalent. OpenCV without acceleration is very CPU-intensive. It’s interesting – modern phones, with excellent cameras, dedicated image and vector processing hardware, are actually going to be be better at this than anything short of a big desktop+expensive GPU combo.

1 Like

I think if OpenCV used the appropriate macOS APIs (mps?) instead of CUDA it’d all be fine, but if they’re anything like the PyTorch crowd they don’t care to.

In any case, it’s not something I’m doing every day so it’s not a big deal.