Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
tlc345
tlc345's Profile
1
Posts
3
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Expanded view
List view
Private Message
[how to] save image of kinect point cloud
[6 Replies]
29-Jun-2012 02:11 PM
Forum:
Contributed Library Questions
Hi,
Question about saving image.
this sketch is using a kinect and org.openkinect.*; and org.openkinect.processing.* library from:
http://www.shiffman.net/p5/kinect/
running on Processing 2.0a6 version
size(800,600,P3D)
I'm trying to save an image(bitmap,jpg,etc) generated from the kinect point cloud.
It's running fine on screen.
(screen shot)
I've tried save("mylocation"); and .set(); but it's not working...
It's saving a solid grey.
Below is the draw() part of the code.
void draw() {
background(255);
//fill(0);
// Get the raw depth as array of integers
int[] depth = kinect.getRawDepth();
// Translate and rotate
translate(width/2, height/2, -25);
float tempR = map(mouseX, 0, 640, 0,4);
///////* pointCloud *///////
for (int x=0; x<w; x+=spaceDot) {
for (int y=0; y<h; y+=spaceDot) {
int offset = x+y*w;
int mirror = int(map(x, 0, w, w, 0));
// Convert kinect data to world xyz coordinate
int rawDepth = depth[offset];
PVector v = depthToWorld(mirror, y, rawDepth);
float factor = 1000;
float targetVX = v.x*factor;
float targetVY = v.y*factor;
float targetVZ = factor-v.z*factor;
//stroke(0);
if (v.z <= 2) {
//noFill();
smooth();
//strokeWeight(1);
pushMatrix();
translate(targetVX, targetVY, targetVZ);
fill(0);
point(0,0);
popMatrix();
}
}
}
}
void keyReleased() {
if (key == 's') {
//save("/Users/screenCapture/"+counter+".bmp");
savearea.set(0,0,get(0,0,w/2,h/2));
savearea.save("/Users/screenCapture/"+counter+".bmp");
counter = counter+1;
}
}
thanks forum!
«Prev
Next »
Moderate user : tlc345
Forum