creatiung 3d shape from picture

Hello , if i have this picture:

I need to create a code that can analize my picture and can create a 3d shape with the same shape of the image.

Is there any specific way of doing this? which would be the best way for creating a 3d shape from that picture?



iterate through all the pixels and set the Z-value to the value of the brightness of each pixel.
this means, brighter pixel move to the foreground, darker pixel are more in the background.
this is a common and easy solution for making this.