Masking point cloud data with ofxCvGrayscaleImage?

#1

Hi, how can i use an ofxCvGrayscaleImage to mask a point cloud data from ofxKinect?

Im trying to do frame differencing with ofxKinect in order to get an array not with the whole data cloud point but instead with only the points that have moved from the previous frame.

Now , im doing the frame differencing with ofxOpenCv using ofxCvGrayscaleImage and i need to mask a point cloud data from ofxKinect with this , in order to get the data cloud points of only the points that have moved from the last frame.

any idea how can i mask my data cloud point? or is there any other way of achieving this?

#2

It doesn’t sound like you need much of a different process than what the openCvExample does before the blob detection. The main difference is that you would be using the previous frame as the background source

https://github.com/openframeworks/openFrameworks/blob/master/examples/addons/opencvExample/src/ofApp.cpp#L51

#3

Yes, i have that part working but the thing is how can i use “grayDiff” ( an ofxGrayscaleImage) to mask a point cloud from ofxkinect in order to get not the whole cloud but only the points that have moved from the previous frame.

any idea?

#4

Do you mean the 3d points or just a composited 2D image?

#5

I mean the 3d points.

So i need to use the ofxCvgrayscaleImage (2d data ) to mask the 3d data from the 3d point cloud.

#6

I think once you have the mask you could loop through the pixels to get the x, y of the changed values (white pixels) and then use ofxKinect:: getDistanceAt(x, y) to get the z

#7

Good idea, im gonna try this, i thought that maybe there was an automatic way of doing this .

cheers.

#8

Hello,

I was curious to know how you managed in the end? I am working on a similar principle of masking pointclouds of interest using contour detection and render them as meshes…

xx