Edit data in a float buffer

Late on the Kinect train, fresh in coding.
I am using Thomas Sanchez Lengelings KinectPV2 library which can put the complete pointcloud of each frame in a float buffer. It is called with FloatBuffer = kinect.getPointCloudDepthPos().

Now i would like to thin out the dataset before writing it to a .obj file but i know nothing about the data structure in the buffer and how to start here.

I am able to do what i want to achieve (show only every nth point) with a pgl.vertexAttribPointer just for the display output - can i maybe use this as new source data for a buffer?
But i would need to know a little more about the data structure in a .obj file, or does the saveOBJFrame() function in the library do that for me? There is not much in depth documentation so i’m pulling straws here, maybe you can help me see the light …

@sash – this question is listed in p5.js – can you just confirm that you are only using Processing (Java) for this project?

Have you looked at the RecordPointCloud example?

…and at the available methods on a FloatBuffer for inspection?


It sounds like you just want to replace those values (which I believe are in ordered triples?) with a subsampled list of values, so that

0,1,2, 3,4,5, 6,7,8, 9,10,11


0,1,2, 6,7,8

Is that right?

I think (?) that the Kinect library grabs raw data and puts it in the float buffer here:

…which it originally dumps from JNI here:

Hi! We r trying to convert the values of the FloatBuffer into ints, we’ve been trying with “int newdepthPositions = int(depthPositions);” but does not work. I’ved also read something abot Buffer.getInt but still amateur on this enviroment :S

We wonder if someone knows how to do it! Thanks in advanced :slight_smile:

It’s not clear what you are trying to do or how it relates to the original post (which itself seems to have to wrong tags applied). Instead of necro-posting (that is, replying to a very old post), I suggest you create a new post, using appropriate tags, that explains what you are trying to do and includes example code of what you have tried.

1 Like