home

Kinect && Pixels

25 Oct 2013

Notes

From Mimi

Once you've figured out the closest X, Y point from your depthArray, you're going to
want to set up another double-for-loop to iterate through the pixels of your image.

For every one of your image pixels, you're going to want to calculate it's distance
from the closest X,Y point and then draw a rectangle using the same color as that
pixel but adust the width and height of rectangle according to the calculated
distance.

Here's the flashlight example which shows adjusting the brightness of a pixel
according to the distance from the mouseX, mouseY point.

Flashlight

Basically substitute closestX, closestY for mouseX, mouseY.

// Calculate the distance of this point in your image to the closestX and closestY points float distance = dist(x,y,closestX,closestY);

// Calculate the size of the rectangle based on the distance from the closestX, closestY point // As the distance gets larger, the pixel gets smaller // You will probably have to fiddle with these numbers to get the effect you want float rectSize = map(dist, 0, 100, 10, 1);

// Use the color of the pixel to color the rectangle fill(pixels[loc]);

// Draw the rectangle rect(x, y, rectSize, rectSize);

Direct links to posts related to project are below

icm

comments powered by Disqus Categories