Is there an alternative to hou.IPRViewer.pixel("C", x, y)

   3769   5   3
User Avatar
Member
8 posts
Joined: Aug. 2007
Offline
Hi guys,
I was working in a python tool that grabs the IPR aka RenderView, at regular intervals in a different thread, but it takes quite a long time since I need to build a byte buffer scanning each pixel. Isn't there any python method in the hou module for this, that either returns a rgba buffer or at least can save the current render view to a file?

Cheers,
Daniel
Edited by dgsantana - April 20, 2017 06:20:44
Technical Director / Co-founder
You can do it! VFX
Lisbon / Porto
Portugal
User Avatar
Staff
600 posts
Joined: May 2014
Offline
Hi Daniel,

It looks like there currently isn't a way to access the entire RGBA image with a single hou method. I've created an RFE to add one (RFE #82333), and will see if I can implement it this week.

Taylor
User Avatar
Member
8 posts
Joined: Aug. 2007
Offline
tpetrick
Hi Daniel,

It looks like there currently isn't a way to access the entire RGBA image with a single hou method. I've created an RFE to add one (RFE #82333), and will see if I can implement it this week.

Taylor

Awesome Taylor. Will it work with any of the image planes in RenderView or just the Color? This is related to something we are working on
.

Cheers,
Daniel
Technical Director / Co-founder
You can do it! VFX
Lisbon / Porto
Portugal
User Avatar
Staff
600 posts
Joined: May 2014
Offline
Cool video!

The new Python method “hou.IPRViewer.pixels('image_plane')” is available in last night's 16.0 build - if needed, I can backport to 15.5 as well. The method works more or less the same as the existing “hou.IPRViewer.pixel(..)” call, however it isn't restricted to a particular (x,y) coordinate. It takes an image plane name as a parameter, and returns all of the image data as a tuple of float tuples, in row major order. Result is the pixel value at (0,0), result is the image data for (1,0), etc. Data starts from the bottom left corner of the IPR render result, like the other IPR inspection tools.


For example:

width = viewer.imageResolution()[0]
color_pixels = viewer.pixels("C")
pixel_200x300 = color_pixels[width*200 + 300]
User Avatar
Member
8 posts
Joined: Aug. 2007
Offline
Awesome.I will try this as soon as possible. A backport would be nice. It would allow us to support H15.5 also. We built this tool to help us visualise the end result in the device while still making image tweaks. It will be available soon.

Cheers,
Daniel
Edited by dgsantana - April 26, 2017 14:57:04
Technical Director / Co-founder
You can do it! VFX
Lisbon / Porto
Portugal
User Avatar
Member
12662 posts
Joined: July 2005
Offline
I'm going to look at this myself soon. I would also be interested in the same functionality for Mantra – which I might invoke with a Mantra Tile Callback. Would this be possible?

Regards,
Jason
Edited by jason_iversen - May 25, 2017 12:32:03
Jason Iversen, Technology Supervisor & FX Pipeline/R+D Lead @ Weta FX
also, http://www.odforce.net [www.odforce.net]
  • Quick Links