jit.pix: 1 plane input 4 plane output

LSka's icon

Hello everybody,

I was trying to make some simple "flipping" on images with jit.pix, when I found this little issue that goes beyond my ability to understand it.
Have a look at this patch:

Max Patch
Copy patch and select New From Clipboard in Max.

There's a webcam input, I convert it to a single plane matrix with uyvy2luma and then a jit.pix object flips the x coords.
What happens is that, while the input is a single plane, the output of jit.pix is a 4-plane matrix.
I need a single plane matrix for further use with cv.jit objects and I thought that processing only one plane would be less CPU-expensive, hence the position of jit.pix. So, what am I doing wrong with the jit.pix object? Is there a way to output the correct plane number?
Second question: does this make sense? or elaborating the 4-plane matrix does not make difference in terms of CPU load?

Thank you

LSka's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Update: works correctly with jit.gen

So, I'd like to understand: is this a jit.pix bug or a feature? I am a bit confused about that.

Wesley Smith's icon

jit.pix always outputs a 4 plane matrix since internally it converts input matrices into an RGBA format. For non-4-plane matrix processing, you'll want to use jit.gen, which seems like what you'll want in this case.

LSka's icon

Thanks for the explanation. Now I am a happy and aware jit.gen user!