Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lighting correction #53

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,71 @@ <h2>Exposing MediaStreamTrack source background blur support</h2>
};</pre>
</div>
</section>
<section>
<h2>Exposing MediaStreamTrack source lighting correction support</h2>
<p>Some platforms or User Agents may provide built-in support for human
face lighting correction, in particular for camera video streams.
Web applications may either want to control or at least be aware that
human face lighting correction is applied at the source level.
This may for instance allow the web application to update its UI or to
not apply human face lighting correction on its own.
For that reason, we extend {{MediaStreamTrack}} with the following
properties.
</p>
<p>The WebIDL changes are the following:</p>
<pre class="idl"
>partial dictionary MediaTrackSupportedConstraints {
boolean lightingCorrection = true;
};

partial dictionary MediaTrackCapabilities {
sequence&lt;boolean&gt; lightingCorrection;
};

partial dictionary MediaTrackConstraintSet {
ConstrainBoolean lightingCorrection;
};

partial dictionary MediaTrackSettings {
boolean lightingCorrection;
};</pre>
<section>
<h3>Processing considerations</h3>
<p>When the "lightingCorrection" setting is set to <code>true</code> by
the <a>ApplyConstraints algorithm</a>, the UA will attempt to correct
human face and background lighting balance so that human faces are
not underexposed.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or overexposed?

</p>
<p>When the "lightingCorrection" setting is set to <code>false</code> by
the <a>ApplyConstraints algorithm</a>, the UA will not correct human
face and background lighting balance.
</p>
</section>
<section>
<h3>Examples</h3>
<pre class="example">
&lt;video&gt;&lt;/video&gt;
&lt;script&gt;
// Open camera.
const stream = await navigator.mediaDevices.getUserMedia({video: true});
const [videoTrack] = stream.getVideoTracks();

// Try to correct lighting.
const videoCapabilities = videoTrack.getCapabilities();
if ((videoCapabilities.lightingCorrection || []).includes(true)) {
await videoTrack.applyConstraints({lightingCorrection: {exact: true}});
} else {
// Lighting correction is not supported by the platform or by the camera.
// Consider falling back to some other method.
}

// Show to user.
const videoElement = document.querySelector("video");
videoElement.srcObject = stream;
&lt;/script&gt;
</pre>
</section>
</section>
<section>
<h2>VoiceIsolation constraint</h2>
<div>
Expand Down