2
$\begingroup$

I need a way to find the underlying 3D coordinates for each pixel of the camera in Python.

I to create a function like:

GetCoordinatesForPixel(xPixel, yPixel)

which returns a (X, Y, Z) vector.

I found the following threads:

How to get world coordinates of pixels? which is supposed to be a duplicate of this one: How to render world position pass

The latter solution works in that it procudes a render. However, I do not see a way to access those values in Python.

$\endgroup$
  • $\begingroup$ Did you look at this post blender.stackexchange.com/questions/7106/…? You will have to play around with it a little, but this might be headed in the right direction. $\endgroup$ – BlendingJake Nov 5 '14 at 14:29
  • $\begingroup$ Why would you need to render multiple times? $\endgroup$ – gandalf3 Nov 5 '14 at 20:48
  • $\begingroup$ Once for the actual image I want to estimate on and once to get the ground truth values. @BlendingJake I tried to work with bpy_extras.view3d_utils but so far I am not really sure how to handle the arguments. But I may be able to figure it out:) $\endgroup$ – user1033657 Nov 6 '14 at 14:09
  • $\begingroup$ @user1033657 I wasn't able to find much info on it, but just keep playing and you'll probably get it. $\endgroup$ – BlendingJake Nov 6 '14 at 14:12
  • $\begingroup$ re-opening, @user1033657 would like to edit the question (to make it not a duplicate) $\endgroup$ – ideasman42 Dec 15 '14 at 17:53
1
$\begingroup$

Blender's Python API currently doesn't expose access to the pixel value of render passes.

(You can access image pixels but renders's are a more complex structure).

However since you mention you need to store the values in a file, just save the OpenEXR file, this will store the values in a file.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.