The open imaging DSP library
Loading...
Searching...
No Matches
Functions
mpix/stats.h

Compute statistics on images. More...

Functions

void mpix_stats_from_buf (struct mpix_stats *stats, const uint8_t *buf, struct mpix_format *fmt)
 Collect red, green, blue channel averages of all pixels in an RGB24 frame.
 
uint8_t mpix_stats_get_y_mean (struct mpix_stats *stats)
 Get the mean value from a histogram.
 

Detailed Description

Compute statistics on images.

SPDX-License-Identifier: Apache-2.0

Function Documentation

◆ mpix_stats_from_buf()

void mpix_stats_from_buf ( struct mpix_stats stats,
const uint8_t *  buf,
struct mpix_format fmt 
)

Collect red, green, blue channel averages of all pixels in an RGB24 frame.

If the nvals field of stats is non-zero, then this value will be used to select the number of pixels sampled from the image. Otherwise a default will be provided.

Parameters
statsStruct collecting the image statistics.
bufBuffer of pixels in RGB24 format (3 bytes per pixel) to collect the statistics from.
widthWidth of the buffer in pixels.
heightHeight of the buffer in pixels.
fourccPixel format of the buffer.

◆ mpix_stats_get_y_mean()

uint8_t mpix_stats_get_y_mean ( struct mpix_stats stats)

Get the mean value from a histogram.

The result is the mean expressed as grayscale pixel value: range 0 to 255.

Parameters
statsStatistics collected from the image
Returns
The mean pixel value.