waiting for optimisation at Retina::_convertCvMat2ValarrayBuffer
This commit is contained in:
parent
bd198d2b7b
commit
4408423c9f
@ -373,17 +373,22 @@ void Retina::_convertValarrayBuffer2cvMat(const std::valarray<float> &grayMatrix
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool Retina::_convertCvMat2ValarrayBuffer(const cv::Mat inputMatToConvert, std::valarray<float> &outputValarrayMatrix)
|
const bool Retina::_convertCvMat2ValarrayBuffer(const cv::Mat inputFrame, std::valarray<float> &outputValarrayMatrix)
|
||||||
{
|
{
|
||||||
// first check input consistency
|
// first check input consistency
|
||||||
if (inputMatToConvert.empty())
|
if (inputFrame.empty())
|
||||||
throw cv::Exception(-1, "Retina cannot be applied, input buffer is empty", "Retina::run", "Retina.h", 0);
|
throw cv::Exception(-1, "Retina cannot be applied, input buffer is empty", "Retina::run", "Retina.h", 0);
|
||||||
|
|
||||||
// retreive color mode from image input
|
// retreive color mode from image input
|
||||||
bool colorMode = inputMatToConvert.channels() >=3;
|
bool colorMode = inputFrame.channels() >=3;
|
||||||
|
|
||||||
// convert to float AND fill the valarray buffer
|
// convert to float AND fill the valarray buffer
|
||||||
const int dsttype = CV_32F; // output buffer is float format
|
const int dsttype = CV_32F; // output buffer is float format
|
||||||
|
|
||||||
|
// buffer format conversion... will be removed soon but WAITING for code error correction
|
||||||
|
cv::Mat inputMatToConvert;
|
||||||
|
inputFrame.convertTo(inputMatToConvert, dsttype);
|
||||||
|
|
||||||
if (colorMode)
|
if (colorMode)
|
||||||
{
|
{
|
||||||
// create a cv::Mat table (for RGB planes)
|
// create a cv::Mat table (for RGB planes)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user