Creating a live mask using color thresholding

Hi,

I’m trying to create a mask that works in real time from camera input using color thresholding. And It has been very, very challenging so far.

Here’s the thing - I try to illuminate subjects as much as possible to isolate the background.
The background color of my studio is black. And you might not know it, but the hair color of East Asians like me, exactly Koreans, is very very dark, almost black.
You can change their clothes to brighter one, but it is quite difficult to dye all of them.

As you increase the power of lights or adjust the minimum point to fill the mask, then noise in the background increases as well.

So I made two layers and one adjusted the minimum point only to not exceed the outline visible from the camera input.
The other is to inflate the white part of the mask with blur(Morphology), then subtract it to the point that it does not exceed the outline set in the first layer and then combine the two.
Thankfully, It was kind of successful when I tried it with still images but with videos, the noise looks unnatural sometimes it messes the edge.

Does anybody have any ideas to walk around it? Any good tools for shaping a mask? Or should I simply switch the background to green and key it out(I really want to keep the dark background though)?

Any suggestions would be greatly appreciated.
Thank you.

1 Like

Hello from Melbourne, Australia - that’s a lovely looking image by itself - very painterly…

Aside from adjusting controls in VDMX -
there’s probably a lot to be gained in adjusting your camera and lighting set-up…
What camera and lenses are you using? If you can use a lense that is f2, f1.8 or lower, that’ll help avoid noise issues… Placing a light behind you - as well as in front, can also help with separation…

2 Likes

Thanks for the reply!

I’m using Panasonic GH4 with a 25mm/f1.7 lens attached. And there’s a backlight installed right behind the subject. Otherwise, I couldn’t get the clear shape of it.

Actually, I think noise being controlled at the minimum as possible. I forgot to mention but the another thing is, the room is not big enough to isolate the background with lighting. The distance between subjects and wall is only about 1m.

So lights start to bleed on the wall as I increase the power to fill contours. I’m trying to find if there are any image processing tricks or techniques to walk around it since there’s a bunch of physical limitations.

Maybe I’m in the completely wrong direction, I really, really don’t know.:sweat:

Anyway thanks for your help. Much appreciated!

Have you tried or considered using chroma keying instead? I’ve done this (same as your setup) both in studio and on stage, I had much better and easier results with chroma keying; making the full background green, and lighting the subject from front + sides and the background from below, then the keying worked quite okay. The subject was like you, very close to the wall/greenscreen.

I’m aware that will completely change the aesthetic of the room/stage/environment, it is a technical solution that not always working artistically. It was also for me a nightmare on festival or shared stages where I couldn’t control lighting 100%. I’m currently researching depth tracking and infrared solutions that would work regardless of lighting/stage.

(Can share more knowledge/experience, but you might have already rejected this route and specifically want to do it the way you describe, let me know!)

1 Like

I might be misunderstanding the goal.
Sounds like you could use a rim light - as @jeanpoole mentioned. So your subject(s) have a clear separation from the background.

I was not understanding how you were processing your image.
Are you trying to key out the foreground and fill it with a color?

1 Like

Yes, I’m interested! It’s glad to see someone who has done something similar work.

I actually bought a chroma backdrop for the second plan. But for some reason, when I tried it, I couldn’t get the result I want. I think I haven’t tried hard enough. Maybe I just didn’t like the way it is. It just made me ill just to see it. Watching green fabric hanging on the wall was painful.

But since there was a lack of effort I’d like to learn from your experience and I’m curious about your work, how it looks, how you’ve done it, I’d also like to share mine with you.

What I’m concerned about chroma keying is - If I do it right, will I still get the same vibe, keep it dark, cinematic looks? could reflections from green background interrupt the overall image?

Right. What I’m trying to achieve is to create a live mask from an RGB video input(HDMI output from a camera) to seperate background and subjects. keep the subjects and key out the background, yes.

So for the purpose like this, it could be done easily if I switch the backdrop to green but I’m not sure if I’m able to get the same cinematic feeling with that. I know chroma keying is common in film making but I want to do it on live situation so it must have limitations of resources,

I’ve already installed a backlight right behind the subject to get the outline, something like a halo thing around the subject. But what you linked is much more advanced than my setting. Thank you for this!

Okay, my experience using a greenscreen - with the same intention as I think you desire - was that I could technically make it work, in the studio it was no problem (~infinite setup time, and once it is set, it stays, and lights always under control) but on stages it was sometimes a challenge. I’ll attach some photos, they explain themselves i think, if this is something you’d like to try I can share more experience on the exact details and challenges, here is general stuff I think i’d wish I knew at the start:

(This is for a indie/small class electronica/art project, performed as solo/duo/trio, in small venues, with small budgets, some minor government funding to help with gear investments and crew fees, but the only really expensive thing is the powerful laptops for VDMX)

I travelled with a simple telescope screen and green fabric to cover 2x3 meter behind me and 1 meter floor, gaffed down. It used three white lighting spots, two on each side to make the green balanced, and one in front to light the subject (me). I also added some more USB lights at the instruments station, to help other cameras pointed to my hands/details that was also filmed, these lights also coincidentally helped with face/subject lighting. I then had a “instrument zone” and “full body” zone, so I could either perform playing, or perform “acting” for full keyed out insertion. I used USB webcams and NDI network cams, and got pretty good latencies. The worst delay usually came from the venue’s HDMI repeater or processing between my output and the projection.

Often in venues we could get assisted light from the rig/truss, and reduce the amount of spots needed, but that meant the lighting person would need to remember the cues for when to add that, they sometimes forgot so was more of a problem than a help, I prefered controlling lights myself. If you always travel with your full crew this could possibly work very well. I can’t afford that yet.

If me (or my crew) had the full stage/venue + enough time we could balance lighting and keying okay. Eventually over time I got good at rigging and knowing what settings I had to adjust and could make the greenscreen quickly set up and work in challenging environments, but NOT always. Over time I then learned to kind of incorporate “bad keying” into my aesthetic. I think this knowledge only comes through experience, so you need to set it up many times and then you know what works where, and also adjust the visuals and your performance to fit within the parameters available, it will never be perfect (but sometimes it will!). It was also a challenge to run regular concert lighting and the keying, see one of the example photos the keying glitches out (which was okay for MY aesthetic), but also here over time my light designer and me got good at knowing how to balance for each other, we ended up with doing some parts of the shows optimized for keying, and some parts optimized for lighting (I turned off the greenscreen lights for those parts).

I totally get your concert about how ugly it is. It IS ugly! And so loud, visually extremely arresting, especially for the audience. The projected visuals (the result) needs to be both much larger, and also very alluring and entertaining, to draw the audience away from the green visual siren. For me, I incorporated this aesthetic deliberately in my work, and never tried to hide it. The concert/performance deals with media manipulation and digital/screen-based life and the issues we face when communicating in multiple realities, so artistically and conceptually it made sense to show the “real” part next to the “fake” part, and using this to max effect. Audience testing and my documentation shows that people generally watch the projected image, but they “reference” the performer zone now and then to verify that it is happening live. So I do know that people quickly forget about the greenscreen as a “thing”.

Eventually I got a bit tired of both the complex rigging/keying/tuning process, and also tired of the aesthetic, and I think I cannot use this trick for every tour, its kind of a once-in-a-while-trick effect. (Or I would have to embrace it and keep it forever, and i’m not that kind of artist). For the current tour, I just dropped the chroma keying completely, placed myself/musicians into the projection itself and then masked us out with dumb soft masks, so it looks like we already are inside, hard to explain, but this actually works just as well (for my aesthetic and intentions right now). And it is a LOT less rigging :)

But I’d still really like to nail this, and preferably without a green screen in the long term future. I’m currently looking into depth tracking and/or IR solutions, but no have not gone in any specific direction yet. My biggest concert with this route is latency, I have yet to find acceptable latencies with depth tracking, particularly as it builds up with all the steps needed. But I’m hopeful, I think in a few years particularly the gaming industry will push us towards a platform we artists can benefit from so keeping an eye on that :) So I keep working and when the tech is ready, my content will also be ;) I’d be happy to keep sharing experiences and findings and if you have any questions how to do the greenscreen at least, if you choose that route, I can answer as far as I can.

Good luck!

2 Likes

I would explore IR cam solution.
-m

1 Like