Currently the Magic Poi site relies on some Processing (Java) code which is called from python – as well as other bash scripts to do certain things. I wanted to make it faster and cleaner by using Python for everything, so I did some test scripts. (Github). Also, the Processing code required a virtual screen buffer to run on the server constantly!
The main functionality involves compressing images into the .bin files which are saved to the poi memory for display. Since there is limited memory, and to save bandwidth, I am using the R3G3B2 algorithm to compress images. The poi only accepts images which are rotated 90 degrees clockwise, so that needs to happen too, as well as dynamically re-sizing any images which are wider than the 72px available.
I am still conflicted about whether to keep the Android app as the control for the poi, or to do something else, but making everything available as an api on the server keeps it flexible for now. The RotateImageVisualPoiStyle api can be accessed right now. Upload your image, and see what it will look like on the poi!
# change the /path/to/image.jpg to your own image file name
curl --location --request POST 'http://magicpoi.circusscientist.com/api/rotate_visual_poi_style' --form 'file=@"/path/to/image.jpg"' --form 'fixed_width="72"' --output 'rotated_image.jpg'
The factory where MagicPoi were being developed had a fire last month! All of the prototype poi melted, so all I have left is my breadboard version. This is going to cause some delays..
- The Magic Poi website now saves .bin files for every image uploaded. This is accessible via an api which I am working on accessing from the ESP32 and ESP8266. The .bin files are byte compressed images for display on the poi.
Example – list all shared .bin files on the server:
One thing to note is that for testing purposes, all new .bin files are shared now. Please be aware that your images could be accessed (temporarily). This is because authentication is an extra step, so I’m working on the basic functionality first, with a public folder. The authentication works using jwt and I am having to access it from Java and C++. I already have a working Arduino test code which implements jwt correctly – security is important, so I want to do it right. One problem I already had to overcome is the fact that LittleFS file system has a limit of 31 characters for filenames (including path). The randomly generated filenames on the server are longer than this.
- Not sure if I mentioned this before, the SmartPoi “Upload for offline use” option in the Android app doesn’t upload the whole image at the moment. I am not sure why, perhaps it’s something to do with the timing loop moving to the next image too fast.
This option is going to be replaced by the web api anyway, so it’s not a priority, but I have compiled a desktop app which I use for converting and uploading (Linux only). You can get that for 36px here or 72px here – it can upload 20 images, just drag and drop your pics (need to be 90 degrees rotated, unlike the website) onto the window, connect to Poi AP and press “Upload”. You need to extract it and run from the command line but it should work on any Linux distro (tested on Ubuntu and Arch).
At some point I will probably get annoyed at having to use my Laptop to upload images and fix the app though. Do email me if you need this for Windows, I might be persuaded to compile it for you using a VM if you ask nicely.
- With the new APA102 2020 version being more available now, when Magic Poi is eventually launched it will have at least 100px, I’m thinking 128 is a good number but don’t quote me.
- You may have noticed all of the hype around AI lately. A few years ago I used GAN with PyTorch to generate images for the poi (after training with around 100 poi pics, probably not enough). It was a big fail, but maybe it’s time to take another look. Would it be cool if you could just tell your poi what type of image you want to display, and it did it instantly?
I do already have loads of Processing sketches I made to try and computer generate nice pics (some are on the Android App).
Feedback is always welcome.