Trapezoid Player Русский

How Ambilight meets the screen cloth

Trapezoid Player splits one video frame into two layers. Inside the four corners of the cloth, the picture is sharp. Outside those corners, Ambilight uses the colors of the frame edge. The two layers meet on the same color, so the cloth does not cut a black frame into the Ambilight on the wall.

The cloth is a trapezoid, not a crop

You place four points on the projector image: top left, top right, bottom right, bottom left of the cloth. Those points are the only geometry the player needs. A homography, the same kind of mapping used to straighten a photo of a document, sends the video rectangle onto that quad. Pixels of the projector image that fall outside the quad become Ambilight on the wall.

Why a blur against black paints a rim

Ambilight made by blurring a frame that is black outside the trapezoid mixes that black into the last pixels of the picture. The result is a dark rim exactly on the edge of the cloth. Ambilight has to be built from real pixels of the current frame, and those pixels have to meet the sharp picture with no empty black in between.

Windows paints only the light that exists

On Windows the frame is warped into the trapezoid with OpenCV. The warp repeats the outer video pixels at the border, so the resampled edge is not a black stroke. Edge colors are then written only outside the quad. A normal blur would still treat the unpainted interior as black. The blur is divided by a mask of where paint exists, so empty pixels do not pull the color toward black. The sharp video is copied on top, inside the trapezoid only. The homography is built once, because the corners do not move during the film.

Android never samples black outside the quad

A phone or a TV box cannot warp every frame on the CPU and stay smooth. On Android, ExoPlayer draws into a video surface and OpenGL ES 2 does the rest. For each screen pixel the shader finds the matching point in the video. Outside the trapezoid that point would fall out of the picture, so the glow pass clamps it to the nearest edge pixel. The blur then runs on a smaller copy of that full-color field. The sharp picture is drawn afterward, full size, with a soft edge about one pixel wide. The cloth and the Ambilight meet on a shared color.

Controls use the same mapping, so they stay on the cloth. Platform steps are on the Windows and Android pages.