mirror of
https://github.com/2martens/uni.git
synced 2026-05-06 11:26:25 +02:00
[CCV] Created skeleton for exercise 4
Signed-off-by: Jim Martens <github@2martens>
This commit is contained in:
29
ccv/sheet4/lab_pyramid.cpp
Normal file
29
ccv/sheet4/lab_pyramid.cpp
Normal file
@ -0,0 +1,29 @@
|
||||
#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" );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user