Hi everyone,
I've put together a few Python scripts to help me model a tree that I wrapped with about 700 pixels this year. The mapping process turns on one pixel at a time, captures an image with the camera, and attempts to find the pixel in the image. In this regard it's similar to the custom model generation tool in xLights. However, the process is repeated from three different camera locations around the tree (at least two camera locations are needed to map in 3D, but not all pixels will be visible from a given camera location due to the tree blocking them, hence 3 camera locations). The final output is an xLights file format 3D model of the pixels.
More details, along with more pictures and videos of the process can be found on the github README page.
Just passing this along in case it's useful for anyone else.
Andy
This looks really impressive! What version of Python are you using with this? I'm trying to get it to work, but it's throwing errors with the Lumos library. Thanks!
tonydoeslights wrote:This looks really impressive! What version of Python are you using with this? I'm trying to get it to work, but it's throwing errors with the Lumos library. Thanks!
When I first started working on it I was using Python 2.7, and Lumos installed and worked just fine with that. I had issues getting Lumos to install correctly using it's setup.py script when I moved to Python 3.X. I think to get it working I just copied source.py and packet.py from the Lumos library into the same directory that the mapping .py files, then renamed source.py to lumos.py (so that the import statement would work) and handled it that way.
Andy
Thanks, Andy, I got it working! I ended up going through the Lumos library and making the modifications necessary to have it install on Python 3. It's at https://github.com/tonyazzolino/Lumos if it's of any use to you.
tonydoeslights wrote:Thanks, Andy, I got it working! I ended up going through the Lumos library and making the modifications necessary to have it install on Python 3. It's at https://github.com/tonyazzolino/Lumos if it's of any use to you.
Awesome, thanks!
This is awesome! Are you running this on a Linux box with a webcam? Hope you can point me in the right direction.
EMC75 wrote:This is awesome! Are you running this on a Linux box with a webcam? Hope you can point me in the right direction.
I ran it on Windows with a WiFi camera, but I'd recommend using a laptop with a USB camera if possible. The WiFi camera has a lot of latency in the video stream, so I had to add some pretty significant delays (seconds) from the time that I turned a pixel on to when I grabbed the video frame, which really slows the process down. Using a USB camera should allow you to significantly shorten some of those delays in the code and speed things up quite a bit.
Andy
Can you post a video? I’d love to see a sequence run on the mapped tree. This opens up the possibility of wrapping trees and doing more than just single strand effects.
Sent from my iPhone using Tapatalk
aaknitt wrote:I ran it on Windows with a WiFi camera, but I'd recommend using a laptop with a USB camera if possible. The WiFi camera has a lot of latency in the video stream, so I had to add some pretty significant delays (seconds) from the time that I turned a pixel on to when I grabbed the video frame, which really slows the process down. Using a USB camera should allow you to significantly shorten some of those delays in the code and speed things up quite a bit.Andy
Appreciate all the work you have done on this!
I set it up on a Windows host, with all the prerequisites installed but when I run the scripts it throws an error. Hope you can give me some feedback.
----
python camera_align.py
[tcp @ 000002c0bd3d3200] Failed to resolve hostname cam.ip.add.ress: The name does not resolve for the supplied parameters
[ERROR:0] global C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-qjdp5db9\opencv\modules\videoio\src\cap.cpp (142) cv::VideoCapture::open VIDEOIO(CV_IMAGES): raised OpenCV exception:
OpenCV(4.4.0) C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-qjdp5db9\opencv\modules\videoio\src\cap_images.cpp:253: error: (-5:Bad argument) CAP_IMAGES: can't find starting number (in the name of file): rtsp://username:password@cam.ip.add.ress:88/videoMain in function 'cv::icvExtractPattern'
Traceback (most recent call last):
File "C:\Users\EMC\Desktop\Lightshow\pixel_mapper-main\camera_align.py", line 46, in
cv2.imshow("Alignment",image)
cv2.error: OpenCV(4.4.0) C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-qjdp5db9\opencv\modules\highgui\src\window.cpp:376: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow'
Never mind, I got that part figured out by changing the rtsp stream to: cap = cv2.VideoCapture(0)
Will be testing the next steps tonight.

