mirror of
https://github.com/2martens/uni.git
synced 2026-05-06 19:36:26 +02:00
[CVV] Added gaussian pyramid class from prev sheet
Signed-off-by: Jim Martens <github@2martens.de>
This commit is contained in:
25
ccv/sheet5/gauss_pyramid.cpp
Normal file
25
ccv/sheet5/gauss_pyramid.cpp
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#include "gauss_pyramid.h"
|
||||||
|
|
||||||
|
gauss_pyramid::gauss_pyramid() {}
|
||||||
|
|
||||||
|
gauss_pyramid::gauss_pyramid(cv::Mat img, float sigma, int number_of_layers)
|
||||||
|
{
|
||||||
|
cv::Mat blurredImage;
|
||||||
|
cv::Mat resizedImage = img.clone();
|
||||||
|
for (int i = 0; i < number_of_layers; i++)
|
||||||
|
{
|
||||||
|
cv::GaussianBlur(resizedImage, blurredImage, cv::Size(0, 0), sigma, sigma, cv::BORDER_REPLICATE);
|
||||||
|
_layers.push_back(blurredImage.clone());
|
||||||
|
cv::resize(blurredImage, resizedImage, cv::Size(), 0.5, 0.5, cv::INTER_NEAREST);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cv::Mat gauss_pyramid::get(int layer)
|
||||||
|
{
|
||||||
|
return _layers.at((unsigned long) layer);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned long gauss_pyramid::get_number_of_layers()
|
||||||
|
{
|
||||||
|
return _layers.size();
|
||||||
|
}
|
||||||
18
ccv/sheet5/gauss_pyramid.h
Normal file
18
ccv/sheet5/gauss_pyramid.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#ifndef SHEET3_GAUSS_PYRAMID_H
|
||||||
|
#define SHEET3_GAUSS_PYRAMID_H
|
||||||
|
|
||||||
|
#include <opencv2/opencv.hpp>
|
||||||
|
|
||||||
|
class gauss_pyramid
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
std::vector<cv::Mat> _layers;
|
||||||
|
public:
|
||||||
|
gauss_pyramid();
|
||||||
|
gauss_pyramid(cv::Mat img, float sigma, int number_of_layers);
|
||||||
|
cv::Mat get(int layer);
|
||||||
|
unsigned long get_number_of_layers();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif //SHEET3_GAUSS_PYRAMID_H
|
||||||
Reference in New Issue
Block a user