# Ignore the first point in a Line (Kinect Depth)

Hey Guys,
i’d like to draw lines similar to the infamous “Unknown Pleasure” Album cover but with a Kinect v2 as source for the line positioning and the depth measured by the Kinect for the elevation of the lines.
Like a “Kinect unknown pleasure selfie” if you’d like.
My Problem is that it offsets the first point per row by the mapped depthValue which causes a long straight line at the beginning of the row. Please find the picture below.

I’ve been trying to tackle this problem for 2 days now, doesn’t seem to compicated but i just don’t seem to get it.

``````void draw() {
background(0);
stroke(255);

//Get DepthValues from Kinect (0-4500) length = width*height
int [] depth = kinect2.getRawDepth();

int xPosPrev = 0;
int yPosPrev = 0;

//initialize change boolean to check if the row changed
boolean changed = false;

//Set spacing from point to point
int spacing = 5;

// Loop through all points
for (int y = 0; y < kinect2.depthHeight; y+=spacing ) {
for (int x = 0; x < kinect2.depthWidth; x+=spacing ) {

//get index for corrosponding Pixel
int depthIndex = x + y * kinect2.depthWidth;

//get depthValue for this parcticular Pixel
int d = depth[depthIndex];

//map values to properly show them
int dmap = int(map(d, 0, 4500, 0, 500));

//set X&Y, translate y by mapped depth value
int xPos = x;
int yPos = y + dmap;

//check if row changed so they won't connect
if (changed == true) {
changed = false;
} else {

//draw if depth is between theese two values (to get rid of Kinect-BG)
if (d > 0 && d < 1750) {
beginShape(LINES);
vertex(xPos, yPos);
vertex(xPosPrev, yPosPrev);
endShape();
}
xPosPrev = xPos;
yPosPrev = yPos;
}
}
}
//row changed
changed = true;
}

``````

Any suggestions on how to solve this?
Even though i’ve been writing Javascript quite a lot, i’m new to Processing so i thought i’d post in the beginners forum.