33 lines
654 B
C++
33 lines
654 B
C++
#include "ImageMultiOutputRed.h"
|
|
#include <vector>
|
|
|
|
using namespace std;
|
|
|
|
ImageMultiOutputRed::ImageMultiOutputRed(short channelIndex)
|
|
{
|
|
m_channelIndex = channelIndex;
|
|
}
|
|
|
|
ImageMultiOutputRed::~ImageMultiOutputRed(void)
|
|
{
|
|
}
|
|
|
|
std::vector<cv::Mat> ImageMultiOutputRed::apply(cv::Mat& pDib)
|
|
{
|
|
std::vector<cv::Mat> retMats;
|
|
if (pDib.empty())
|
|
return retMats;
|
|
retMats.push_back(pDib);
|
|
filterColor(pDib, m_channelIndex);
|
|
retMats.push_back(pDib);
|
|
return retMats;
|
|
}
|
|
|
|
void ImageMultiOutputRed::filterColor(cv::Mat& image, short channel)
|
|
{
|
|
if (image.channels() == 1)
|
|
return;
|
|
|
|
cv::extractChannel(image, image, channel);
|
|
}
|