61 lines
1.6 KiB
C++
61 lines
1.6 KiB
C++
/*
|
||
* ====================================================
|
||
|
||
* 功能:拼接,又名对折
|
||
* 作者:刘丁维
|
||
* 生成时间: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 GIMGPROC_LIBRARY_API 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
|