Merge pull request #3928 from ilya-lavrenov:android_4.6
This commit is contained in:
commit
81c5d58035
@ -43,9 +43,9 @@
|
|||||||
|
|
||||||
#include "precomp.hpp"
|
#include "precomp.hpp"
|
||||||
|
|
||||||
namespace
|
namespace cv
|
||||||
{
|
{
|
||||||
class FormattedImpl : public cv::Formatted
|
class FormattedImpl : public Formatted
|
||||||
{
|
{
|
||||||
enum { STATE_PROLOGUE, STATE_EPILOGUE, STATE_INTERLUDE,
|
enum { STATE_PROLOGUE, STATE_EPILOGUE, STATE_INTERLUDE,
|
||||||
STATE_ROW_OPEN, STATE_ROW_CLOSE, STATE_CN_OPEN, STATE_CN_CLOSE, STATE_VALUE, STATE_FINISHED,
|
STATE_ROW_OPEN, STATE_ROW_CLOSE, STATE_CN_OPEN, STATE_CN_CLOSE, STATE_VALUE, STATE_FINISHED,
|
||||||
@ -55,7 +55,7 @@ namespace
|
|||||||
char floatFormat[8];
|
char floatFormat[8];
|
||||||
char buf[32]; // enough for double with precision up to 20
|
char buf[32]; // enough for double with precision up to 20
|
||||||
|
|
||||||
cv::Mat mtx;
|
Mat mtx;
|
||||||
int mcn; // == mtx.channels()
|
int mcn; // == mtx.channels()
|
||||||
bool singleLine;
|
bool singleLine;
|
||||||
bool alignOrder; // true when cn first order
|
bool alignOrder; // true when cn first order
|
||||||
@ -65,8 +65,8 @@ namespace
|
|||||||
int col;
|
int col;
|
||||||
int cn;
|
int cn;
|
||||||
|
|
||||||
cv::String prologue;
|
String prologue;
|
||||||
cv::String epilogue;
|
String epilogue;
|
||||||
char braces[5];
|
char braces[5];
|
||||||
|
|
||||||
void (FormattedImpl::*valueToStr)();
|
void (FormattedImpl::*valueToStr)();
|
||||||
@ -81,7 +81,7 @@ namespace
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
FormattedImpl(cv::String pl, cv::String el, cv::Mat m, char br[5], bool sLine, bool aOrder, int precision)
|
FormattedImpl(String pl, String el, Mat m, char br[5], bool sLine, bool aOrder, int precision)
|
||||||
{
|
{
|
||||||
CV_Assert(m.dims <= 2);
|
CV_Assert(m.dims <= 2);
|
||||||
|
|
||||||
@ -253,7 +253,7 @@ namespace
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class FormatterBase : public cv::Formatter
|
class FormatterBase : public Formatter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FormatterBase() : prec32f(8), prec64f(16), multiline(true) {}
|
FormatterBase() : prec32f(8), prec64f(16), multiline(true) {}
|
||||||
@ -278,14 +278,15 @@ namespace
|
|||||||
int prec64f;
|
int prec64f;
|
||||||
int multiline;
|
int multiline;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DefaultFormatter : public FormatterBase
|
class DefaultFormatter : public FormatterBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
cv::Ptr<cv::Formatted> format(const cv::Mat& mtx) const
|
Ptr<Formatted> format(const Mat& mtx) const
|
||||||
{
|
{
|
||||||
char braces[5] = {'\0', '\0', ';', '\0', '\0'};
|
char braces[5] = {'\0', '\0', ';', '\0', '\0'};
|
||||||
return cv::makePtr<FormattedImpl>("[", "]", mtx, &*braces,
|
return makePtr<FormattedImpl>("[", "]", mtx, &*braces,
|
||||||
mtx.rows == 1 || !multiline, false, mtx.depth() == CV_64F ? prec64f : prec32f );
|
mtx.rows == 1 || !multiline, false, mtx.depth() == CV_64F ? prec64f : prec32f );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -294,10 +295,10 @@ namespace
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
cv::Ptr<cv::Formatted> format(const cv::Mat& mtx) const
|
Ptr<Formatted> format(const Mat& mtx) const
|
||||||
{
|
{
|
||||||
char braces[5] = {'\0', '\0', ';', '\0', '\0'};
|
char braces[5] = {'\0', '\0', ';', '\0', '\0'};
|
||||||
return cv::makePtr<FormattedImpl>("", "", mtx, &*braces,
|
return makePtr<FormattedImpl>("", "", mtx, &*braces,
|
||||||
mtx.rows == 1 || !multiline, true, mtx.depth() == CV_64F ? prec64f : prec32f );
|
mtx.rows == 1 || !multiline, true, mtx.depth() == CV_64F ? prec64f : prec32f );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -306,12 +307,12 @@ namespace
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
cv::Ptr<cv::Formatted> format(const cv::Mat& mtx) const
|
Ptr<Formatted> format(const Mat& mtx) const
|
||||||
{
|
{
|
||||||
char braces[5] = {'[', ']', '\0', '[', ']'};
|
char braces[5] = {'[', ']', '\0', '[', ']'};
|
||||||
if (mtx.cols == 1)
|
if (mtx.cols == 1)
|
||||||
braces[0] = braces[1] = '\0';
|
braces[0] = braces[1] = '\0';
|
||||||
return cv::makePtr<FormattedImpl>("[", "]", mtx, &*braces,
|
return makePtr<FormattedImpl>("[", "]", mtx, &*braces,
|
||||||
mtx.rows == 1 || !multiline, false, mtx.depth() == CV_64F ? prec64f : prec32f );
|
mtx.rows == 1 || !multiline, false, mtx.depth() == CV_64F ? prec64f : prec32f );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -320,7 +321,7 @@ namespace
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
cv::Ptr<cv::Formatted> format(const cv::Mat& mtx) const
|
Ptr<Formatted> format(const Mat& mtx) const
|
||||||
{
|
{
|
||||||
static const char* numpyTypes[] =
|
static const char* numpyTypes[] =
|
||||||
{
|
{
|
||||||
@ -329,7 +330,7 @@ namespace
|
|||||||
char braces[5] = {'[', ']', '\0', '[', ']'};
|
char braces[5] = {'[', ']', '\0', '[', ']'};
|
||||||
if (mtx.cols == 1)
|
if (mtx.cols == 1)
|
||||||
braces[0] = braces[1] = '\0';
|
braces[0] = braces[1] = '\0';
|
||||||
return cv::makePtr<FormattedImpl>("array([",
|
return makePtr<FormattedImpl>("array([",
|
||||||
cv::format("], type='%s')", numpyTypes[mtx.depth()]), mtx, &*braces,
|
cv::format("], type='%s')", numpyTypes[mtx.depth()]), mtx, &*braces,
|
||||||
mtx.rows == 1 || !multiline, false, mtx.depth() == CV_64F ? prec64f : prec32f );
|
mtx.rows == 1 || !multiline, false, mtx.depth() == CV_64F ? prec64f : prec32f );
|
||||||
}
|
}
|
||||||
@ -339,11 +340,11 @@ namespace
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
cv::Ptr<cv::Formatted> format(const cv::Mat& mtx) const
|
Ptr<Formatted> format(const Mat& mtx) const
|
||||||
{
|
{
|
||||||
char braces[5] = {'\0', '\0', '\0', '\0', '\0'};
|
char braces[5] = {'\0', '\0', '\0', '\0', '\0'};
|
||||||
return cv::makePtr<FormattedImpl>(cv::String(),
|
return makePtr<FormattedImpl>(String(),
|
||||||
mtx.rows > 1 ? cv::String("\n") : cv::String(), mtx, &*braces,
|
mtx.rows > 1 ? String("\n") : String(), mtx, &*braces,
|
||||||
mtx.rows == 1 || !multiline, false, mtx.depth() == CV_64F ? prec64f : prec32f );
|
mtx.rows == 1 || !multiline, false, mtx.depth() == CV_64F ? prec64f : prec32f );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -352,19 +353,14 @@ namespace
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
cv::Ptr<cv::Formatted> format(const cv::Mat& mtx) const
|
Ptr<Formatted> format(const Mat& mtx) const
|
||||||
{
|
{
|
||||||
char braces[5] = {'\0', '\0', ',', '\0', '\0'};
|
char braces[5] = {'\0', '\0', ',', '\0', '\0'};
|
||||||
return cv::makePtr<FormattedImpl>("{", "}", mtx, &*braces,
|
return makePtr<FormattedImpl>("{", "}", mtx, &*braces,
|
||||||
mtx.rows == 1 || !multiline, false, mtx.depth() == CV_64F ? prec64f : prec32f );
|
mtx.rows == 1 || !multiline, false, mtx.depth() == CV_64F ? prec64f : prec32f );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
|
|
||||||
namespace cv
|
|
||||||
{
|
|
||||||
Formatted::~Formatted() {}
|
Formatted::~Formatted() {}
|
||||||
Formatter::~Formatter() {}
|
Formatter::~Formatter() {}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user