Lens AI Profiler Cpp
imageprofile.h
1 
8 #ifndef IMAGE_PROFILE_H
9 #define IMAGE_PROFILE_H
10 
11 #include "iniparser.h" // Assuming declarations for IniReader, Saver, distributionBox
12 #include "imghelpers.h"
13 #include "saver.h"
14 #include "generic.h"
15 #include <kll_sketch.hpp>
16 #include <vector>
17 #include <string>
18 #include <unordered_map>
19 #include <functional>
20 
21 
22 // Typedef for distribution box data structure (assuming datasketches::kll_sketch<float>)
24 
32 class ImageProfile {
33 public:
37  ~ImageProfile();
38 
53  ImageProfile(const std::string& conf_path, int save_interval, int channels = 1);
54 
73  int profile(cv::Mat& img, bool save_sample = false);
74 
75 #ifndef TEST
76 private:
77 #endif
78  Saver* saver;
79  std::string statSavepath;
80  std::string dataSavepath;
81  std::map<std::string, std::vector<std::string>> imageConfig;
82  int channels;
86  distributionBox contrastBox;
87 
91  distributionBox brightnessBox;
92  distributionBox sharpnessBox;
93 
94  std::vector<distributionBox *> pixelBox;
98  std::vector<distributionBox *> meanBox;
99 
103  distributionBox noiseBox;
104 
105 
110  void registerStatistics(const std::string& name);
111 
118  float computeStatistic(const std::string& name, cv::Mat& img);
119 
127  bool isThresholdExceeded(const std::string& name, float stat_score, const std::vector<std::string>& config);
128 
134  void iterateImage(const cv::Mat& img, const std::function<void(const std::vector<int>&)>& callback);
135 
140  void updatePixelValues(const std::vector<int>& pixelValues);
141 };
142 
143 #endif // IMAGEPROFILE_H
A class for analyzing and storing image statistics.
Definition: imageprofile.h:32
int profile(cv::Mat &img, bool save_sample=false)
Logs image statistics for the provided image data.
Definition: imageprofile.cpp:60
ImageProfile(const std::string &conf_path, int save_interval, int channels=1)
Constructs an ImageProfile object with the specified image characteristics.
Definition: imageprofile.cpp:31
~ImageProfile()
Destructor to clean up resources.
Definition: imageprofile.cpp:11
Definition: saver.h:38