Posted tagged ‘processing’

OpenCV with external camera – check

June 9, 2010

I’ve managed to get the external camera working with Processing and OpenCV on my mac. I thought it would be more difficult as I tried it about a month or so ago and it didn’t work. Oh well, it works now so I don’t care. I hope it just carries on working right up to the end of the show.

This image shows that the ‘index’ needs to be changed to indicate which camera input to work with when there is more than one available:

Screenshot from Processing interface indicating parameters

Screenshot from Processing interface indicating parameters

So this is one thing ticked off my To Do list.

I’ve also now been booked onto a slot for using the laser machine next week. If all goes to plan I’ll have a nice panel to use for my plinth which should then match with my sculpture as the same pattern will be cut into it. That way there is some correlation between the two and will be easier to identify that they are part of the same installation.

I’m also slightly concerned about how heavy the sculpture will be. It is meant to be wall mounted but the brackets I am thinking of using may not hold it up. Not to mention screwing the front (pattern cut) panel to the back (blank) panel.

I’ve just been reading that if drilling, a fixed or lathe drill is best for metal. For aluminium a fast speed rate but slow feed rate is best. Which means that the drill bit should be spinning really fast but should be pushing down through the material relatively slowly (I think). Handy info on drilling can be found here:

Ideally it would be good to do this at the 3D resource center but then I’d have to leave the parts there through the week and won’t be able to do anything in between the Wednesdays. Not really an option.

There’s a DIY type shop at the corner of my road. I think I’ll pop in there to ask them what kind of stuff they can do. They might even be able to cut all my plinth parts for me and then I can assemble those at home and hopefully (if my car is fixed in time) drive it to uni when needed.  When it comes to this stuff I haven’t really got much experience. I’ve only ever really put some flat-packed wardrobes up. They came out well and are still standing so it’s a good sign I say. Oh and theres the random wood works I did when in school – that was fun. But back then it didn’t matter so much if things didn’t line up all that straight.

I’m also going to have a rifle through some of last year’s show plinths at uni. There might be something that can be recycled.

I think I should sleep now, I have a feeling tomorrow is going to be another looong day.

Scary vampires

April 7, 2010

After looking at some rubbish web cams which claim to have night vision capability (and actually only have LEDs to light up when it gets dark) I decided to go with a really cheap one from China (through eBay), just in case it turned out to be one of those.

It’s a very small camera which even has a mic,  and works surprisingly well for just £3! It works using Infra-red LEDs allowing it to work in the dark. I was quite sceptical of the quality of the image so naturally I tested it with different variables.

I turned the lights off and only had the light coming from my laptop screen at first and it worked great. I then placed the camera facing away from the laptop (completely behind it) and it still worked well. I stood in front with my little sister and it made us look like really pale vampires with scary shiny grey eyes! We both have dark brown eyes so not sure why that was happening. Anyway, the point is it works and when I use it for my work it will actually be mounted overhead so the problem of looking like scary vampires won’t be an issue.

I then tried to get it working with the OpenCV and processing examples on my PC but to no avail. I keep getting error messages. This is a major annoying factor, but one must persevere! I just have to keep trying to figure it out.

OpenCV - Errors :(

OpenCV - Errors 😦

I have also ordered a large roll of mirror card. It took me some time to track down someone who could sell it to me uncut (as the largest sizes you can get in the shops is A2). This gives me loads to experiment and work with and was a good saving on the usual retail price too.

I have also been looking into metal-cutting companies who not only supply but provide services for cutting metal sheets (aluminium, steel etc) but seem to be doing this mostly on mass scales. Its been another difficult aspect of getting the practical work together but I’m still hoping it can be done as a one-off and at a reasonable price. I’m now waiting for those companies to get back to me with quotes.

So all in all there are many small things going on but all are necessary in order to produce the whole which is probably why I haven’t been blogging as much.

My next task is to choose and complete a final pattern. I want to up the game a bit with this and choose a more complicated one that combines possibly 10 and 5 fold arrangements or 12 and 6. Plus I want to add my own touch to the standard pattern formations. It’s not a huge requirement but would be a nice bonus.

I am also aware that I had set myself the goal of having a proto-type ready by the end of March. Unfortunately there have been a huge amount of things to do which has slowed my progress down. And more things keep coming up! I do sometimes wish I could work on this project full-time but then again the other things going on are not bad things or are things that are about progress in life in general and so I wouldn’t sacrifice those either.

Detection with Processing

March 14, 2010

Right I’ve been going around in circles but I am now hoping this is the last time. I’ve decided to go back to Processing as it allows me to use the feed from the web cam and manipulate it using little code which I am told is more reliable in this context compared to Flash. Soo even though I found this really cool example (try the demo if you have a web cam): which uses Flash, I am going to actually use Processing which is actually easier to understand (now that I look at it properly) and that will probably take less learning to adjust.

The official info on Processing can be found on their web site:
And here are a couple lines from their home page:

“Processing is an open source programming language and environment for people who want to program images, animation, and interactions.”

I will be using OpenCV (a library which is imported into Processing) to get a basic black and white image of the floor area to project onto my work which will be mounted on the wall. This way the viewer can literally move around on this floor  in order to alter the areas that are illuminated and try and play around with manipulating the shadows and reflections that are projected from that. Obviously it may not work as well with just heads and shoulders in view (remember it will be an aerial view) but that’s something I need to test in the next couple of weeks.

Here are a couple of test images from the camera view as processed using OpenCV and the blobs() method which by the looks of it calculates where whole ‘blobs’ are in the image, and constantly checks for where lines merge or disconnect in objects, so if one object comes in front of another then it would change where the edges are detected (I think).

I changed the contrast and colour from the default which is grey and white and used a book cover and a cd for the following to give a better idea of how it cuts out things that don’t have whole areas defined and focuses on those that do:

Image of book cover with Blob() function using OpenCV in Processing

Image of an intricate book cover as seen using the blobs() method with OpenCV in Processing

Image of CD processed with OpenCV using the blobs() method

The results aren’t as predictable as they appear in the above images though. They constantly change and it’s hard to pinpoint exactly how movements and changes in the view affect what is then displayed. I will need to play around with this quite a bit to make it less sporadic and more intuitive so that it works better in the show.

The code is really short and simple and there are quite a few examples on the OpenCV resource page:

You don’t need to even be able to understand this stuff to try it out. You can simply download the necessary software and additional libraries from the two links I’ve provided. After installing you can either try out the examples already in the Processing library (really cool ways of producing generative art with this) or by pasting in code found on the two sites to view and play around with the results. There’s also loads of examples where you can interact with a cursor or movement through a web cam to change the visuals. There is much fun to be had!

BeatBearing and more electronics!

February 20, 2010

The title should probably be the other way around as I’m going to mention the electronics bit first.  I am really trying to figure out exactly what I’m going to need for my proto-typing for my next personal deadline. It’s dawning on me that this is way out of my comfort-zone. I don’t know where to start. However, I have come across some friendly and mostly helpful people so far and I’m hoping that will continue to be the case.

Leon Barker (PhD Student at SCIRIA) will be in uni again doing workshops in a couple of weeks on Arduino circuits and the like (I hope!). I have looked up bits of info randomly here and there about equipment and materials that I may need for AC lighting manipulation (which is really dangerous and so I’m slightly scared) and I’m also trying to find some pressure sensitive mats. The ones at Maplin seem to be very basic and have a switch for an open or closed circuit. This means there can only be two states and therefore two conditions for me to work with. I guess this could potentially do the trick depending on how I set up the lighting. An alternative is to project light on to my work instead of illuminating it from behind. I think both could work. Maybe I’ll need to use both anyway. But that’s another thing I won’t know till I’ve tried it.

I can’t believe how much there is to think about! I’ve had to stall on the sculptural aspects of the work for now as I fear the electronics will take much longer and is a higher hurdle. I did find some interesting acrylic materials but none of these would be suitable for what I need. I also found many steel.aluminum suppliers and cutters but they are very industrial based and so charge huge amounts for bulk amounts (can’t afford it and don’t need that much anyway).

So anyway while looking up these things I came across Peter Bennett’s work on YouTube. He is a PhD student at the Sonic Arts Research Centre (SARC) at Queens University Belfast. His current work can be read about and viewed on this site: But I really want you to see is this video which shows his BeatBearing project. You can figure out how it works just from watching:

The cool thing is Peter has used Arduino and Processing for BeatBearing and has made his code and methods available for others to re-construct and experiment with. More about this project can be read here:

And before I finish off this post here is another link to a video in which you can see Peter Bennett and Sean Toru’s Transparency in Digital Art installation. They’ve used processing as well as pressure sensitive mats to allow users to create and edit shapes projected onto the wall through their movement on the floor:

Hmmm – lots to think about!