1
0
mirror of https://github.com/2martens/uni.git synced 2026-05-06 11:26:25 +02:00
Files
uni/ccv/sheet4/lab_pyramid.cpp
Jim Martens 2e157035c6 [CCV] Created skeleton for exercise 4
Signed-off-by: Jim Martens <github@2martens>
2017-05-02 14:53:07 +02:00

30 lines
918 B
C++

#include "lab_pyramid.h"
lab_pyramid::lab_pyramid(cv::String image_filename) {
cv::Mat image_rgb = cv::imread(image_filename, cv::IMREAD_COLOR);
cv::cvtColor(image_rgb, _inputImage_lab, cv::COLOR_RGB2Lab);
cv::split(_inputImage_lab ,_imageChannels);
};
void lab_pyramid::create_pyramids(int number_of_layers)
{
_pyramids[COLOR_L] = gauss_pyramid(_imageChannels[COLOR_L], number_of_layers);
_pyramids[COLOR_A] = gauss_pyramid(_imageChannels[COLOR_A], number_of_layers);
_pyramids[COLOR_B] = gauss_pyramid(_imageChannels[COLOR_B], number_of_layers);
}
gauss_pyramid lab_pyramid::get_pyramid(int channel)
{
switch (channel)
{
case COLOR_L:
return _pyramids[COLOR_L];
case COLOR_A:
return _pyramids[COLOR_A];
case COLOR_B:
return _pyramids[COLOR_B];
default:
throw std::invalid_argument( "received invalid channel value, use COLOR_L, COLOR_A or COLOR_B" );
}
}