# \[JAVA\] Remove background and record screen through chroma key

**URL:** <https://discourse.processing.org/t/java-remove-background-and-record-screen-through-chroma-key/35912>\
**Category:** Coding Questions\
**Created:** [March 23, 2022, 4:41pm UTC](https://discourse.processing.org/t/java-remove-background-and-record-screen-through-chroma-key/35912 "2022-03-23T16:41:02Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![GWAK](https://avatars.discourse-cdn.com/v4/letter/g/13edae/32.png) [@GWAK](https://discourse.processing.org/u/GWAK)\
**Post date:** [March 27, 2022, 3:27am UTC](https://discourse.processing.org/t/java-remove-background-and-record-screen-through-chroma-key/35912/3 "2022-03-27T03:27:22Z")

</div>

@th75

Thanks for the quick reply and kind explanation.

I have one question.  
Link: [Key out color from video](https://discourse.processing.org/t/key-out-color-from-video/324)

You can see the code on the site above.

```auto
PShader chroma;
PImage guy;
PImage beach;
void setup(){
 size(1080,720,P2D);
 chroma = loadShader("chroma.glsl");
 chroma.set("u_res",(float)width,(float)height);
 beach=loadImage("beach.jpg");
 guy=loadImage("fig.jpg"); // guy.jpg
 chroma.set("u_tex",guy);
}

void draw(){
  resetShader();
  image(beach,0,0);
  shader(chroma);
  
  float HUE, SAT, BRI,
        HUE_range,SAT_range,BRI_range,
        yikes;
  // hsb values
  // HUE=0.39; SAT=0.80; BRI=0.90;
  HUE=0.427; SAT=0.098; BRI=0.256;
  
  //hsb tolerances
  HUE_range=0.10; SAT_range=0.60; BRI_range=1.80;
  //experiment
  yikes=0.47;
  
  chroma.set("u_low",HUE-HUE_range,SAT-SAT_range,BRI-BRI_range);
  chroma.set("u_high",HUE+HUE_range,SAT+SAT_range,BRI+BRI_range);
  chroma.set("u_foo",yikes);
  rect(0,0,width,height);
}

```

`HUE=0.39; SAT=0.80; BRI=0.90;`

How do I get the above values? It looks like a green background color, but I can’t figure out how it came out like that.

---

_[View the full topic](https://discourse.processing.org/t/java-remove-background-and-record-screen-through-chroma-key/35912)._
