Min/Max values of a COP

   3118   2   0
User Avatar
Member
155 posts
Joined: Sept. 2015
Offline
Is there a way to get the min/max values for a channel in a COP? (Min/Max of the ENTIRE image - basically, I want to know if a image is constant/uniform or not).
Edited by Brian Walters - Aug. 29, 2016 12:16:14
User Avatar
Member
155 posts
Joined: Sept. 2015
Offline
I'm really hoping to avoid scattering X number of particles on a grid, sampling the map, and then attribute promoting to a detail the min/max of the map…
User Avatar
Member
1390 posts
Joined: July 2005
Offline
You could use Image Chop [sidefx.com] and MathChop to get min/max values from an image or use Python and numpy:

node =  hou.node("/img/comp1/file1")
pixels = numpy.frombuffer(node).allPixelsAsString("C"), dtype=numpy.float32).reshape(node.xRes(), node.yRes(), 3).copy()
pixels.min()
pixels.max()

but if the only objective is to check whether a channel is constant or not, you could use GradientCOP (normalize on), and ScaleCOP set to 2x2 pixels and point filter (or box would be saver?). You have 4 pixels in total. Any non constant image will have at least one pixel non-black. All black == image was constant.
Edited by symek - Aug. 30, 2016 05:58:11
  • Quick Links