We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi guys, first post so i hope its in the right place. I am working on a project with 30 strips of leds controlled by 4 fadecandy boards. i have everything working and can play "video" very low res across my grid. the question is, can i add a video capture board and send the incoming video directly to my pixel map? in effect processing would just be converting video to pixel map.
any help is greatly appreciated
Regards
Matthew Tiley
Answers
Will the capture board be generating a video stream like a webcam? If so, use
Capture
. That can convert video to pixel map -- there are many demos and example sketches.thats great. sorry to sound daft but where would i insert my pixel grid into this code.
attached copy of grid
// Connect to the local instance of fcserver opc = new OPC(this, "127.0.0.1", 7890);
opc.ledStrip(0, 64, width/2 , height/2 +160, width / 64.0, 0, false); opc.ledStrip(64, 64, width/2 , height/2 +150, width / 64.0, 0, false); opc.ledStrip(128, 64, width/2, height/2 +140, width / 64.0, 0, false); opc.ledStrip(192, 64, width/2, height/2 +130, width / 64.0, 0, false); opc.ledStrip(256, 64, width/2, height/2 +120, width / 64.0, 0, false); opc.ledStrip(320, 64, width/2, height/2 +110, width / 64.0, 0, false); opc.ledStrip(384, 64, width/2, height/2 +100, width / 64.0, 0, false); opc.ledStrip(448, 64, width/2, height/2 +90, width / 64.0, 0, false); opc.ledStrip(512, 64, width/2, height/2 +80, width / 64.0, 0, false); opc.ledStrip(576, 64, width/2, height/2 +70, width / 64.0, 0, false); opc.ledStrip(640, 64, width/2, height/2 +60, width / 64.0, 0, false); opc.ledStrip(704, 64, width/2, height/2 +50, width / 64.0, 0, false); opc.ledStrip(768, 64, width/2, height/2 +40, width / 64.0, 0, false); opc.ledStrip(832, 64, width/2, height/2 +30, width / 64.0, 0, false); opc.ledStrip(896, 64, width/2, height/2 +20, width / 64.0, 0, false); opc.ledStrip(960, 64, width/2, height/2 +10, width / 64.0, 0, false);
opc.ledStrip(1024, 64, width/2, height/2, width / 64.0, 0, false); opc.ledStrip(1088, 64, width/2, height/2 -10, width / 64.0, 0, false); opc.ledStrip(1152, 64, width/2, height/2 -20, width / 64.0, 0, false); opc.ledStrip(1216, 64, width/2, height/2 -30, width / 64.0, 0, false); opc.ledStrip(1280, 64, width/2, height/2 -40, width / 64.0, 0, false); opc.ledStrip(1344, 64, width/2, height/2 -50, width / 64.0, 0, false); opc.ledStrip(1408, 64, width/2, height/2 -60, width / 64.0, 0, false); opc.ledStrip(1472, 64, width/2, height/2 -70, width / 64.0, 0, false); opc.ledStrip(1536, 64, width/2, height/2 -80, width / 64.0, 0, false); opc.ledStrip(1600, 64, width/2, height/2 -90, width / 64.0, 0, false); opc.ledStrip(1664, 64, width/2, height/2 -100, width / 64.0, 0, false); opc.ledStrip(1728, 64, width/2, height/2 -110, width / 64.0, 0, false); opc.ledStrip(1792, 64, width/2, height/2 -120, width / 64.0, 0, false); opc.ledStrip(1856, 64, width/2, height/2 -130, width / 64.0, 0, false); opc.ledStrip(1920, 64, width/2, height/2 -140, width / 64.0, 0, false); opc.ledStrip(1984, 64, width/2, height/2 -150, width / 64.0, 0, false); }
I'm not sure. Where did you get this code? What does it do?
Fadecandy has simple demo sketches of sending an image out for display on their homepage:
https://github.com/scanlime/fadecandy/blob/master/doc/processing_opc_client.md
...and the capture library I already linked has simple demos of getting an image from a video stream. So, can you get an image, then send it? When you try, what happens?
Notice the key quote when reading the documentation:
this is the code that programs the pixel map in the video sketch i have running, its running 30 strips of LEDS. i need to put this in a capture sketch so i have the same output grid but I'm not sure where to put it. is there any way i can send you the sketch i have working so you can see what i mean?
Regards
Mat
@madmat99 -- did you look at the quote and link to examples I posted above you? If you read that page, it will be clear.
Try this first:
is this in processing 3?
Are you asking me if Fadecandy's OPC is Processing 3 compatible? I'm not sure. Have you looked at the documentation and tried it?
sorry, I'm asking if your using processing 3 as I'm using 2 and don't seem to have the functions you mention.
Ah. Well, as it says at the top of the Capture library (the very first link I sent you): Processing 3.
You didn't say which functions, but if you need the reference for the Processing 2 Capture, you could look it up in P2, or check the way back machine:
https://web.archive.org/web/20150919131346/https://www.processing.org/reference/libraries/video/Capture.html
Hmm. Interfaces to Capture for P2 and P3 look the same. So I'm not actually sure what you mean when you say "don't seem to have the functions you mention."
ok, here we go! this is a example sketch that came with the fadecandy software and runs fine, i adjusted the grid to fit what i have this is one running video, i copied my grid over and again runs fine i have copied the capture example in to a sketch and works fine so the question is where do i copy my grid into the capture sketch to get it running
and this is the piano with the lights running on it
(https://www.facebook.com/matthewtileydesigns/media_set?set=vb.100013160683654&type=2)
you can replace this
with this
(i'd also add constants for width / 2, height / 2 and width / 64 fwiw, save calculating them all the time)
that's great. But I'm still unsure where I put this in the capture sketch. Cheers
Mat
the opc stuff looks like it lives in setup(). it defines a mapping from a position in the processing window to the led strip.
so just put it in setup and it should be automatic.
(which is what jeremy said 2 days ago)
the "LED Mapping Example" does exactly this, sets up a mapping using new OPC, opc.ledStrip and then continually draws an image. that appears to be enough, you don't need to add anything opc specific to draw.
https://github.com/scanlime/fadecandy/blob/master/doc/processing_opc_client.md
the capture sketch will keep updating the image with video frames.
hi guys, thanks so much for your help with this, got it working, I'm not sure why but it only works if i put OPC opc; above where it says setup. i know nothing about this program so don't know why that has to be there.... last question, do you know if i can import from a video capture device?
Thanks again.
Mat