-
Notifications
You must be signed in to change notification settings - Fork 106
Expand file tree
/
Copy pathImageStats.h
More file actions
40 lines (30 loc) · 1.13 KB
/
ImageStats.h
File metadata and controls
40 lines (30 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/* Image Stats
*
* From: https://github.com/PokemonAutomation/
*
*/
#ifndef PokemonAutomation_CommonFramework_ImageStats_H
#define PokemonAutomation_CommonFramework_ImageStats_H
#include "FloatPixel.h"
namespace PokemonAutomation{
class ImageViewRGB32;
// Store basic stats of a group of pixels
struct ImageStats{
// Average color among the pixels. Range 0.0 to 255.0.
FloatPixel average;
// Stddev of the color for each color channel. Range 0.0 to 255.0.
// The smaller the stddev on one channel, the closer the pixel values are on this channel.
FloatPixel stddev;
// How many pixels in the group.
uint64_t count;
ImageStats() : count(0) {}
ImageStats(FloatPixel a, FloatPixel s, uint64_t c) : average(a), stddev(s), count(c) {}
};
// Pixels with alpha < 128 are ignored.
FloatPixel image_average(const ImageViewRGB32& image);
FloatPixel image_stddev(const ImageViewRGB32& image);
ImageStats image_stats(const ImageViewRGB32& image);
// Get stats on the one-pixel-wide border of the image
ImageStats image_border_stats(const ImageViewRGB32& image);
}
#endif