What's the proper way to use createImage() dynamically ??
in
Contributed Library Questions
•
1 year ago
Hi Forum,
Related to my last
post, I'm attempting to create a PImage on the fly from some detected Kinect information in order to pass the image off to a blob detection routine, but I'm not sure exactly how to do that properly...
I am pulling the depthImage from the Kinect, and asking for the xyz points of a Vector if the z point is between two thresholds...
I can draw the vector fine, and even average the points, however imperfectly (which makes me wonder why I'm trying to pass this to a blobDetection routine
), but how would I pass those into a pixel array?
), but how would I pass those into a pixel array?
I kind of have it working, but it's just drawing all the pixels at 0,0 (I think)... so I guess I need to know how to assign the x and y positions ??
What I've attempted so far starts on Line 17...
- if(realWorldPoint.z < table && realWorldPoint.z > hover ) {
- // Average XYZ
- sumX += x;
- sumY += y;
- count++;
- if(count != 0 ) {
- handX = sumX / count;
- handY = sumY / count;
- }
- else {
- handX = 0;
- handY = 0;
- }
- stroke(255, 0, 0);
- point(realWorldPoint.x,realWorldPoint.y,realWorldPoint.z);
- // Create PImage To Pass To Blob Detection
- kImg = createImage(width/2, height/2, RGB);
- kImg.loadPixels();
- for(int i = 0; i < count; i++) {
- kImg.pixels[i] = color(0, 255, 255);
- }
- kImg.updatePixels();
- }
Thanks for any feedback / advice.
~ J
1

but as far as I remember those vector depth values correspond to greyscale colors. Far away is black and close is white etc. Currently you turn all into vectors and then filter out the range of your interest into points. This makes total sense because you're only displaying the points within your range of interest.
)