## minimum/maximum of all planes

Nov 30, 2013 at 7:09pm

# minimum/maximum of all planes

Forgive the baseness of my inquiry.. but how do I output a matrix of max or min plane values? I’m new to jit.expr and there is no equivalent of a max/min operator in expr/vexpr so I don’t really have much to go on. I assumed it was like passing a list to [maximum] or [minimum] in Max. But it seems that I need two args – no more, no less. So in order to output a 4 plane matrix with maximum cell values I need to do something like:

@expr max(max(in[0].p[0],in[0].p[1]),max(in[0].p[2],in[0].p[3]))

Really?

It’s gotta be easier that that. What if I have a lot more planes? Or matrices with dynamically changing planecounts? Is there something like a .p[-1] to make this simpleâ€¦?

#274261
Dec 1, 2013 at 5:52am

don’t wanna use jit.3m?

<code>

– Pasted Max Patch, click to expand. –

</code>

#274292
Dec 1, 2013 at 2:30pm

Hey thanks Tobias.. but I don’t think I was very clear in my initial post.

I want to grab the min or max for each plane of each cellâ€¦ the channels of each pixel.

Here is an example using video but I’m primarily interested in how to take an input matrix with a plane count of n and output a matrix of the same dimension with the min or max values for each cell of the input matrix. The way it is now, I am using an expression that limits the input planecount to 4.

What I am looking for doesn’t appear to exist.. which is a kinda surprising. Is there is a generic way to apply a function to each cell that operates on the planes and outputs a matrix of the same dimension? I’m new to all of this so my question may be very basic. Thanks..

– Pasted Max Patch, click to expand. –
#274322
Dec 2, 2013 at 1:35am

jit.planeop:

<code>

– Pasted Max Patch, click to expand. –

</code>

#274357
Dec 2, 2013 at 2:00am

Yes! Thank you…

#274360

You must be logged in to reply to this topic.