📜 ⬆️ ⬇️

How I wanted to do Ambilight for a mobile phone and what came of it

So, I’ll talk about how I tried to do Ambilight for my phone (HTC Hero with Android on board). Just in case, let me remind you that Ambilight is a TV backlight technology based on the displayed picture. According to the Philips company, which promotes it, ambilight improves the perception of a film in the dark and reduces eye strain.

We need a phone and a little bit of programming. First of all we learn to pull a screenshot from the device using ddmlib.jar from $ SDK_PATH / tools:

AndroidDebugBridge bridge = AndroidDebugBridge.createBridge();
IDevice[] devices = bridge.getDevices();
RawImage rawImage = this.device.getScreenshot();

Here are the first rakes - very often it does not work out - the maximum that we have is 2-3 frames per second. Next, we act on a simple algorithm:
')
1) create a quantized color palette of the current frame - for all colors we perform the conversion:
int color = ...
int r = (color >> 16) & 0xff;
int g = (color >> 8) & 0xff;
int b = color & 0xff;
r -= (r%16);
g -= (g%16);
b -= (b%16);
Color quantedColor = new Color(r, g, b) ;

2) Find the most commonly used color
3) Here, in a good way, should be a long description of how I connected all sorts of LEDs and killed the weekend for this, but it will not be) Instead, I used an improvised tool as a backlight - a laptop screen. And that's what happened in the end:


The expediency of such a decision is a matter of some question (:, but the main goal (to make a cool thing) is accomplished. If you so desire, you can further develop the idea - for example, divide the image into 4-6 parts and provide illumination for each segment. You can adjust the Arduino board for control LEDs or design a Lego Mindstorms robot waving them in. In general, the possibilities are a bunch.

At this point, I suddenly realized that I was suffering from some kind of crap. The real ambilight for mobile phones could be implemented by the manufacturers themselves, making a translucent matte case in some experimental model. The same Hero could look something like this:
image

The profit is obvious - a phone with such an unusual feature will surely attract attention and find many new uses in everyday life. Who is the main innovation - dare)

jeck_landin

Source: https://habr.com/ru/post/86726/


All Articles