I am trying to make an Histogram that is represented by a Cube of size 256*256*256, every position in the Cube represents a color. Thus from an Image I want to fill the frequency of each color in a position but I have trouble converting the BGR vector of each pixel into an int so I can access the Cube positions
typedef std::vector<std::vector<std::vector<int>>> CubeType;
typedef cv::Mat MatType;
typedef cv::Vec3b ColorType;
Histogram::Histogram(MatType const& image, int binSize){
aHist = CubeType(binSize, std::vector<std::vector<int>>(binSize, std::vector<int>(binSize, 0)));
aBinSize = binSize; // int
for(int i = 0; i < image.cols; ++i){
for(int j = 0; j < image.rows; ++j){
ColorType color = image.at<ColorType>(j, i);
}
}
}
I need a way to convert the cv::Vec3b into three integers
int b, g, r;
or a way to get a different cv:: vector that represents integers.