That One PARTicle That Just Can’t Keep Up

for (int x = 0; x < video.width; x++) {
int pixelColor = video.pixels[index];

int r = (pixelColor >> 16) & 0xff;
int g = (pixelColor >> 8) & 0xff;
int b = pixelColor & 0xff;

Here I have made a slight changes to the colour, I have changed the attributes from “r,g,b,” to “h,s,b,”. The reason for this is to add a clearer image to what is been projected, allowing people to see what is going better. At the moment I feel the way the particles are looking doesn’t look clear enough and show the blank spot where the person is well enough, changing these attributes will hopefully improve this.

for (int x = 0; x < video.width; x++) {
int pixelColor = video.pixels[index];

int h = (pixelColor >> 16) & 0xff;
int s = (pixelColor >> 8) & 0xff;
int b = pixelColor & 0xff;

Also changing the font size again, this time too 2.5.

colourchangep

As you can see I have encountered a little problem

theproblemThe problem I have encountered here is the camera cannot keep up with my movements, this is a big deal because of the pace people walk through Weymouth House, they will not notice that there bodies are being blanked out. Trying to fix this problem I added in a fps command;

frameRate(60);

This had no response to the work; nothing changed so I fluctuated between higher and lower frame rates and this still had no difference….So I tried cutting the amount of letters (particles) in half to reduce the collisions between them, again this had no difference. This problem is a tricky one to figure out, so I’m going to move from w119 and head down to the walking space and see if this makes any difference.

openspaceWhat you’re seeing here is the first view of the production in the Weymouth House walk through; me stepping away from to webcam to see if it is clear that I am standing there. The lag on the image isn’t as bad as it was up in W119, that could be due to the wider every of space, I did also reduce the size of the particles to allow more space for movement, hence dark spots.

I’ve Made A Decision

I’ve decided to use more than one of the code manipulations in this space, considered as further experimentation I am going to explain it as; “which code reacts better to the bigger environment.”

Advertisements

S*** already hit the FAN, or the Mac

As mentioned before I was aware that I MAY need a Kinetic Camera to work some of the code I wanted to experiment with, but it does turn out you ACTUALLY do need a Kinetic Camera to work this code. Below is not the entire of the imported Library, but just a bit of it so you get an idea of what I am looking at;


import SimpleOpenNI.*;

SimpleOpenNI context;
float zoomF =0.3f;
float rotX = radians(180); // by default rotate the hole scene 180deg around the x-axis,
// the data from openni comes upside down
float rotY = radians(0);
PShape pointCloud;
int steps = 2;

void setup()
{
size(1024,768,P3D);

//context = new SimpleOpenNI(this,SimpleOpenNI.RUN_MODE_MULTI_THREADED);
context = new SimpleOpenNI(this);
if(context.isInit() == false)
{
println("Can't init SimpleOpenNI, maybe the camera is not connected!");
exit();
return;
}

// disable mirror
context.setMirror(false);

// enable depthMap generation
context.enableDepth();

context.enableRGB();

// align depth data to image data
context.alternativeViewPointDepthToImage();
context.setDepthColorSyncEnabled(true);

stroke(255,255,255);
smooth();
perspective(radians(45),
float(width)/float(height),
10,150000);
}

endShape();

This is the response I receive when I activate the the file;

Screen Shot 2015-01-22 at 17.24.53

“You know what that is…**** *******!”

That is a whole lot of red and not pretty at all, with me I never expected it to be easy, but when the code is already created and you just want to see what it looks like you would think that it would work pretty simply.

In the true Lorimer style I am going ignore all the red and look at the white, the key statement here being;

“Can’t init SimpleOpenNI, maybe the camera is not connected!”

The camera is clearly connected!! A Mac Book Air worth almost a thousand pounds comes with an inboard webcam, it might as well come with a kettle and Twinnings breakfast tea for that price and it’s telling me the camera isn’t connected…I need to find out the problem. Be right back.

Later on….

So it’s as I thought, I 100% need a Kinetic Camera.

comics-extralife-kinect-xbox-one-716039The Kinetic camera already has the preferences installed to work the files, hence it being created for Microsoft it’s code is already created to notice people in the room so they can interact with games. Even this being so I tried to channel the source to the webcam I rented from the University and also the Mac cam. Speaking to a couple of people on my course I thought this would be quite simple;

Adding the my void Draw sections;

cam = newCapture(this,320,240,"FaceTime HD Camera", 30);

I thought this would work, but another error appeared explaining that there is no such thing as “cam”. Reading this now you may be thinking to yourself that it’s incredibly obvious that I cannot fix this problem, which I do know now, but I kept on trying to find another way around it.

Looking at the “GettingStartedCapture” CV offer as a basic to learn how a Webcam works on Processing, code below

import processing.video.*;

Capture cam;

void setup() {
size(640, 480);

String[] cameras = Capture.list();

if (cameras == null) {
println("Failed to retrieve the list of available cameras, will try the default...");
cam = new Capture(this, 640, 480);
} if (cameras.length == 0) {
println("There are no cameras available for capture.");
exit();
} else {
println("Available cameras:");
for (int i = 0; i < cameras.length; i++) {
println(cameras[i]);
}

// The camera can be initialized directly using an element
// from the array returned by list():
cam = new Capture(this, cameras[0]);
// Or, the settings can be defined based on the text in the list
//cam = new Capture(this, 640, 480, "Built-in iSight", 30);

// Start capturing the images from the camera
cam.start();
}
}

void draw() {
if (cam.available() == true) {
cam.read();
}
image(cam, 0, 0);
// The following does the same as the above image() line, but
// is faster when just drawing the image without any additional
// resizing, transformations, or tint.
//set(0, 0, cam);
}

I thought by copying a pasting this code into my first file and deleting the repetitive factors it would solve the problem and again I was wrong, but the camera would activate for a split second and then deactivate. This was starting to get annoying….So I went for a chat with a couple of my course mates, it was mentioned that I could try and do this without the Kinetic Camera, but it would involve telling the code to ignore density and go straight for motion, I could imagine how I would do this.

Just for experimenting I was wasting too much time on this particular code, so time to get on to other things.

Individual Analysis. Inpiration

What Inspires Me

AmnonOwed-KinectPhysics-03-640x360 AmnonOwed-KinectPhysics-04-640x360These images above are the result of using a Kinect Camera, exactly like the ones used on the Xbox. I see using these as more of a cheat because the camera is already programmed to detect bodies with the use of depth, having half my work already sort out for me, but with further experimentation and me not actually owning a Kinect I am finding it very difficult to manipulate the code so it will use my Mac webcam instead. Using “SimpleOpenNI” which is a library you can install on “Processing” I was going to have a look what some already created code would look like and try and use that as a bases to create my almost “Particle System”.

Why an almost Particle System?

To be perfectly honest I have run out of time to write a Particle System from scratch, my hand in is next week on Monday and the time it would take to go through this process would probably hit a fortnight. No worries though, this is where the “Almost Particle System” comes in.

In the pictures above you can see the shape of a human body which has been developed in to little lines/dots (quite like particles), to me this is stunning. This is how I would draw a picture, the code and developed again what I would describe as a piece of art and I love that. This also reminds of other works I have seen;

Particleswhiteback‘Punktiert’ another library I could develop from; this particles are beautiful, incredibly simple black on white little balls of different sizes working in correlation with each to have a constant movement around the canvas. This reminding me of something else I saw;

https://www.youtube.com/watch?v=UfbPlfgzhDI

 Looking into these three pieces I hoping you’re getting an idea of where I want to go with this digital environment I want to complete. I have always found beauty in these little motion, there is so much character and life in the little creatures and it’s all created through the development of letters and numbers. Of course I’m going to create something based of these, they inspire me.

Where I could take this idea?

Adapting these ideas to a digital environment where people can interact through a webcam this idea may work very well with the motion of particles around a body. Like the top two images I could reverse what has been done and put the motion dots on the outside of the body rather than the inside, relating that the second image the black particles would react to a persons body or hand or whatever as a negative space.

Lets get experimenting.

Going with the Flow

Back to my days of college it was 100% coursework produced in a sketch book and I always used to start each brief with a flow chart, so here we go, a blast from the past.

My main objective here is to think of every angle which needs to be covered in the Analyse stage of this project.

Particle Systems; where did they come from?

Focusing more on why the idea of Particle Systems came to me rather than where the actually thing originated from, you can search that on Google

Why Particle Systems?

When the sun is shining through a window through a specific beam you can see the dust particles in the air, this is something I have been bought up with at my parents place and I never really noticed the beauty of it. Until my friend Lawrence was explained his thoughts on it, him showing me that the slightest movement from any part of the room caused a reaction in the dust particles. This related back to the echo I believe is cause by every motion of man and women in the world. Leading me to want to investigate into Particle systems.

Where could this go?

More to ‘Where do I want this to go?’, there are of course many options here and the possibilities are endless. To get me started I’m going to draw up some concept ideas and go from there.

 

These next steps require individual Analysis 

What inspires me?

Particle Systems of course, but this is where it has all come from –v–

Identify some problems I could encounter?

Something other than Particle Systems?

notes

Flow Chart of Thought Track  ^

A Particle System Considered an Original Idea

Here we have a particle System, this not being the simplest one I could find, the basic physics behind it are circles following the mouse around and dropping to the floor.

Just had a meeting with Liam (my course lecturer), to be honest he caught me out helping my self the the kettle on the third floor and asked the dreaded question “how is the project going?”…My response being one of “I could not be any further from the answer you want right now”. To my luck Liam has heard this excuse many a time and pushed me for a meeting to discuss what I was going to do.

Starting focus ‘Particle Systems’, I knew where this was going because my friend Sam Jones had the same thought track leading to the idea getting botched a few weeks ago, but I can be quite stubborn with my ideas and wanted to stick with it.

THE IDEA

To create a Particle System which using a webcam picks up the space of movement people walk in acting as a negative space pushing away particles (small dots) into the space which has no movement. 

THE SYMBOL

This idea is supposed to symbolise that beings are not the only things moving through this world; everything action we take leads to and echo or a response which we may not see, even the movement of an arm causes some sort of motion or power we may not realise.

THE ORIGIN

The idea came from personal experience; having the usual life stories of everything, a realisation has to be made that everything you do has a reaction. 

Here below is a simple example of a particle system and part of the code, I have added part of the code so you can understand what I’m in the motion of doing, I will explain technicals later on.

particles


// Particles, by Daniel Shiffman.

ParticleSystem ps;
PImage sprite; 

void setup() {
 size(1024, 768, P2D);
 orientation(LANDSCAPE);
 sprite = loadImage("sprite.png");
 ps = new ParticleSystem(10000);

 // Writing to the depth buffer is disabled to avoid rendering
 // artifacts due to the fact that the particles are semi-transparent
 // but not z-sorted.
 hint(DISABLE_DEPTH_MASK);
} 

void draw () {
 background(0);
 ps.update();
 ps.display();
 
 ps.setEmitter(mouseX,mouseY);
 
 fill(255);
 textSize(16);
 text("Frame rate: " + int(frameRate), 10, 20);
 }