• Advice on "Matrix Metering" for Cams ?

    From c186282@21:1/5 to All on Sun May 4 01:24:21 2025
    I've got half a dozen security cams. Some are
    straight IP, others - PI and others - use 'motion'
    to create an MPEG stream.

    Wrote a display app (python) that rolls through
    the cams so I can see what's going on. Also a
    sep app that RECORDS selected cams as MP4s
    mostly using OpenCV stuff.

    HOWEVER ... while I do have a little daemon that
    sets day/night values for v4l2 that's not always
    good enough. Super-bright, or cloudy, days can
    result in kinda crappy images.

    Tried simple histogram expansion - but that kinda
    looked WORSE in most cases - TOO much contrast.

    SO ... wrote a little app that breaks the images
    into a 7x5 matrix and yields 'average brightness'
    figures for each segment ... the basic of 'matrix
    metering'.

    Alas even after extensive searching I can't find
    any advice on HOW to make use of those figures,
    HOW to adjust brightness/contrast based on that
    matrix analysis.

    Camera makers HAVE figured this out, and 'matrix'
    almost always yields great images. Alas the HOW
    is not published.

    OpenCV2 can adjust both brightness and contrast
    quite easily - but what VALUES to feed it .....

    Have you seen anybody addressing this problem,
    this issue, on the net where I might get advice
    on how best to analyze those image segments and
    derive the needed adjustment figures ??? This
    drifts into "statistics" - not my best issue.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From rbowman@21:1/5 to All on Sun May 4 08:16:58 2025
    On Sun, 4 May 2025 01:24:21 -0400, c186282 wrote:

    SO ... wrote a little app that breaks the images into a 7x5 matrix and
    yields 'average brightness'
    figures for each segment ... the basic of 'matrix metering'.

    That's sort of like pooling in a convolutional neural network. The image
    is broken into 2x2 or similar and either the maximum or the average for
    the square is used for the next layer. It's interesting to look at the
    images after each iteration. It really sharpens lines and shapes that
    would be a smoother gradient in the original image and reduces the
    dimensions.

    I don't know if successive iterations would yield something you could use
    to set contrast.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From c186282@21:1/5 to rbowman on Sun May 4 22:12:23 2025
    On 5/4/25 4:16 AM, rbowman wrote:
    On Sun, 4 May 2025 01:24:21 -0400, c186282 wrote:

    SO ... wrote a little app that breaks the images into a 7x5 matrix and
    yields 'average brightness'
    figures for each segment ... the basic of 'matrix metering'.

    That's sort of like pooling in a convolutional neural network. The image
    is broken into 2x2 or similar and either the maximum or the average for
    the square is used for the next layer. It's interesting to look at the
    images after each iteration. It really sharpens lines and shapes that
    would be a smoother gradient in the original image and reduces the dimensions.

    I don't know if successive iterations would yield something you could use
    to set contrast.


    What I need is advice on how to best CALCULATE from
    each segment what the contrast and brightness may
    be and then figure out what to DO about it.

    A real-world image ... sun is bright or dim, there
    are a few really bright PARTS in it and some really
    DARK parts. The "best picture takes such stuff
    into account without getting TOO extreme in any
    direction. Camera-makers seem to have this down
    quite well, but their algos are 'proprietary' and
    even extensive searching has not yielded much
    detail into how they do it (with little micro-
    controllers).

    Gonna have to work on this for awhile ... do lots
    of experiments.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)