pointCloudExample, specific png?


I am new and looking through the examples, in 3d/pointCloudExample there is a transparent png linzer.png that generates a 3d visual based on alpha values.

When I substitute the example png with my own png (i tried saving it out at different alphas) the image grid of pixel translations is still flat.

Why does it only work with linzer.png?

It works because the linzer.png file has the depth saved in the alpha channel. That depth it is used in the pointCloudExample to displace the points on the z axis.

How did you save the alpha values in your image? did you inspected those values with ofLog?

Thanks, how do I see alpha in the png? I thought pngs couldnt export with alpha data, only transparency. I saved my samples at various alpha (transparency) but it did not reproduce the same way.


When you read the color of the pixel at x an y coordinates,

ofColor myColor = img.getColor(x, y);

The 4th value is the alpha channel. You can retrieve it simply using:

auto alpha = myColor.a;

Could you precisely explain how did you get the values that you have saved in your image?

The linzer.png image was taken with a depth sensor camera, and the the depth value read from that image was saved into the alpha chanell.
If you want to obtain the same effect, but with a picture of another person, you need to use a depth sensor camera, and read the depth later when displacing the pixel.

Thank you for the explanation, the depth sensor camera seems to be the key ingredient here.

I’ll look into picking one up