25 lines
1.2 KiB
C++
25 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include <opencv2/core/core.hpp>
|
|
#include <vector>
|
|
|
|
class SeamCarving
|
|
{
|
|
private:
|
|
static cv::Mat GetEnergyImg(const cv::Mat &img);
|
|
static cv::Mat computeGradientMagnitude(const cv::Mat &frame);
|
|
static float intensity(float currIndex, int start, int end);
|
|
static cv::Mat computePathIntensityMat(const cv::Mat &rawEnergyMap);
|
|
static std::vector<int> getLeastImportantPath(const cv::Mat &importanceMap);
|
|
static cv::Mat removeLeastImportantPath(const cv::Mat &original, const std::vector<int> &seam);
|
|
static void removePixel(const cv::Mat &original, cv::Mat &outputMap, int row, int minCol);
|
|
static cv::Mat addLeastImportantPath(const cv::Mat &original, const std::vector<int> &seam);
|
|
static void addPixel(const cv::Mat &original, cv::Mat &outputMat, int row, int minCol);
|
|
static cv::Mat drawSeam(const cv::Mat &frame, const std::vector<int> &seam);
|
|
|
|
public:
|
|
static bool strechImage(cv::Mat& image, int seams, bool grow, std::vector<std::vector<int>>* seamsVect = nullptr);
|
|
static bool strechImageVert(cv::Mat& image, int seams, bool grow, std::vector<std::vector<int>>* seamsVect = nullptr);
|
|
static bool strechImageWithSeamsImage(cv::Mat& image, cv::Mat& seamsImage, int seams, bool grow);
|
|
};
|