optimising grabber settings brightness/contrast/saturation/hue

  • Hi, I am fairly new to this forum and building my first complete setup.

    My complements to the team that made Hyperion/Hyperbian!

    I can't tell you how long I wanted to have 'ambilight', but without having to buy a Philips TV.

    But, back on the topic: I found a way to find the optimal setting of brightness/contrast/saturation/hue for any grabber available by exploiting a python script of a guy naming himself ciko. Great work man!

    You can find it here, but it won't work out of the box since skimage changes and also I had to alter the videframe buffer size.

    First you need to installing below packages:

    sudo apt-get update (optional, but was needed when I tried installing below)

    sudo apt-get install python3-skimage

    sudo apt-get install python3-opencv

    Next to this you need offer the grabber a 1920x1080 test image via its HMDI connection (lots of colors!).

    The same image must be available for the script itself (named 'artificial.png' in above python script).

    The script can now be executed by:

    python <name of the file of the script>

    The script will compare the image grabs for a random set values for brightness, contrast, saturation and hue.

    The top 10 will be build up and updated as you keep running the script (30 minutes / 1 hour, it just keeps narrows the range for the optimal settings).

    I ordered 6 'different' USB grabbers from Ali (which proved to all have been based on the MacroSilicon chip) and ran this script.

    An example top 10 (from best to worst, up to down):

    [brightness, contrast, saturation, hue, similarity score by SK Image library]

    [0, 130, 128, 1, 0.9790735862137337]

    [0, 130, 128, 1, 0.9790735862137337]

    [0, 130, 128, 1, 0.9790735862137337]

    [0, 131, 128, 1, 0.9785554986591819]

    [0, 131, 128, 2, 0.9779354215036543]

    [0, 129, 128, 3, 0.977378649197668]

    [0, 129, 128, 3, 0.977378649197668]

    [0, 129, 131, 3, 0.9773188600386898]

    [0, 129, 131, 3, 0.9773188600386898]

    [0, 131, 130, 2, 0.9772894482817124]

    [0, 129, 130, 2, 0.977280399322154]

    I tested all 6 USB grabbers I have and all ended up with above values for optimal similarity of images grabbed and offered via HDMI.

    brightness 0x00980900 (int) : min=-128 max=127 step=1 default=-11 value=0

    contrast 0x00980901 (int) : min=0 max=255 step=1 default=148 value=130

    saturation 0x00980902 (int) : min=0 max=255 step=1 default=180 value=128

    hue 0x00980903 (int) : min=-128 max=127 step=1 default=0 value=1

    It is remarkable that the defaults found in all 6 grabbers are very different to optimal...

    Maybe optimizing here isn't helping much in for the end result, since you may compensate for the unneeded grabber error by calibrating the leds vs the output of the TV. Still, it was a cool experiment and fun to do and there is less error now to be corrected!

    Next step is calibrating the colors of the LEDs vs. the output of the TV... with a camera... semi-automatic would be nice!

    Hyperbian on Raspberry Pi 4 - 2Gb using Adafruit 2238 (SK9822) via SPI @ 30 leds / meter

    USB grabber / splitter - MacroSilicon (0x2109)

    Mounting to TV - todo

    Edited once, last by Worfje ().

  • I can run the grabber in PIP on the TV, the optimal values for macrosilicon grabbers

    v4l2-ctl -c saturation=148

    v4l2-ctl -c brightness=0

    v4l2-ctl -c contrast=148

    v4l2-ctl -c hue=0

    with the settings, the grabber image is very close to the original.

    Of course, it is always a question of the color settings on the TV.

    regards pclin

    Dreambox ONE / TWO

    dreamOS OE2.6

    Amlogic S922X - 53.000 DMIPS - 2 GB RAM - 16 GB Flash - Twin-DVB-S2X Tuner - HDR10 - HLG
    AudioDSP: miniDSP 2x4HD - Lautsprecher ELAC
    LG OLED65BX9LB (PicCap, hyperion.NG webOS)

    FireTV 4K max

    hyperion (classic) & Plugin HyperionControl | hyperion-ng 2.0.12 (dreamOS)
    Hyperion-ng (Debian Buster)
    6 x Wemos D1 mini - WLED - SK6812 RGBW-NW 60 LEDs/m
    5-Port HDMI Switch - FeinTech VSP01201 - Grabber Macrosilicon


    Ambilight for ever

    Edited once, last by pclin ().

  • Can you go into more step by step detail of how you can change/update the settings of a USB grabber for someone that is not good with moving around on Linux? Thanks a ton for sharing btw!!

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!