speedcontroller/imageprocess/ImageApplyConcatenation.h

61 lines
1.5 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* ====================================================
* 功能:拼接,又名对折
* 作者:刘丁维
* 生成时间2020/4/21
* 最近修改时间2020/4/29
* 版本号v1.0 2020/4/21
* 版本号v1.1 2020/4/29 : 1、添加m_BG_color接口可设置图片背景2、优化内存消耗
* ====================================================
*/
#ifndef IMAGE_APPLY_CONCATENATION_H
#define IMAGE_APPLY_CONCATENATION_H
#include "ImageApply.h"
class CImageApplyConcatenation : public CImageApply
{
public:
//对折方向
enum ConcatMode
{
horizontal = 0, //左右拼接 吅
vertical, //上下拼接 吕
autoDirection
};
public:
CImageApplyConcatenation(); //默认m_direction = autoDirection;
/*
* dir [in]:拼接方向
* backgroud [in]:背景颜色,默认为黑色
* */
CImageApplyConcatenation(ConcatMode dir, const cv::Scalar& backgroud = cv::Scalar(0, 0, 0));
virtual ~CImageApplyConcatenation(void);
virtual void apply(std::vector<cv::Mat>& mats, bool isTwoSide);
inline ConcatMode getConcatDirection() { return m_direction; }
inline void setFildDirection(ConcatMode dir) { m_direction = dir; }
inline cv::Scalar getBackGroundColor() const { return m_BG_color; }
inline void setBackGroundColor(const cv::Scalar& color) { m_BG_color = color; }
private:
virtual void apply(cv::Mat& pDib, int side);
cv::Mat concat(cv::Mat& front, cv::Mat& back, ConcatMode direction = autoDirection);
private:
ConcatMode m_direction;
cv::Scalar m_BG_color;
};
#endif // !IMAGE_APPLY_CONCATENATION_H