threshold chromakey?

kovalski's icon

Dear All,
I am working on a project. However, I converted the webcam to threshold (cv.jit.threshold) and I want to replace whites on the cam (threshold) with a video (jit.chromakey) but the chromakey did not recognize the whites. When I connect webcam to chromakey directly, it recognizes the colors and everything works fine, but in threshold not...
Note: I used Jitter Chromakey tutorial, but it did not work.
Thanks in Advance
Best

LSka's icon

Can you show your patch, please?

kovalski's icon

At the attachment...
Thank u

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

The problem is in the plane count. When you convert the input matrix with rgb2luma you get a single plane matrix, while jit.qt.movie outputs a four-plane matrix. You may convert the input matrix and get the jit.chromakey to work, like this:

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

or you could use a simpler approach (since you just want to replace whites) and use jit.op instead of jit.chromakey:

the purpose of thresholding a grayscale image is to generate a binary matrix (values can be only 0 or 1), then you get your mask by multiplying the matrices.

kovalski's icon

Dear LSka,
Thank you so much for your precious help. Now, I understand my problem. These 2 options have solved my problem. However, I will use the second one, jit.op is better, simple and easier solution.
Thank you so much again
Best