提交 17fd1c7c 编写于 作者: A Andrey Kamaev

Merged recent changes from trunk - 8833,8848,8850

上级 57fb5f09
......@@ -4406,6 +4406,16 @@ public:
Ptr<Algorithm> (Algorithm::*getter)()=0,
void (Algorithm::*setter)(const Ptr<Algorithm>&)=0,
const string& help=string());
template<typename _Tp, typename _Base> void addParam(Algorithm& algo, const char* name,
Ptr<_Tp>& value, bool readOnly=false,
Ptr<_Tp> (Algorithm::*getter)()=0,
void (Algorithm::*setter)(const Ptr<_Tp>&)=0,
const string& help=string());
template<typename _Tp> void addParam(Algorithm& algo, const char* name,
Ptr<_Tp>& value, bool readOnly=false,
Ptr<_Tp> (Algorithm::*getter)()=0,
void (Algorithm::*setter)(const Ptr<_Tp>&)=0,
const string& help=string());
protected:
AlgorithmInfoData* data;
void set(Algorithm* algo, const char* name, int argType,
......
......@@ -3843,7 +3843,7 @@ template<typename _Tp> inline Ptr<_Tp> Algorithm::create(const string& name)
}
template<typename _Tp>
void Algorithm::set(const char* _name, const Ptr<_Tp>& value)
inline void Algorithm::set(const char* _name, const Ptr<_Tp>& value)
{
Ptr<Algorithm> algo_ptr = value. template ptr<cv::Algorithm>();
if (algo_ptr.empty()) {
......@@ -3851,12 +3851,12 @@ void Algorithm::set(const char* _name, const Ptr<_Tp>& value)
}
info()->set(this, _name, ParamType<Algorithm>::type, &algo_ptr);
}
template<typename _Tp>
void Algorithm::set(const string& _name, const Ptr<_Tp>& value)
inline void Algorithm::set(const string& _name, const Ptr<_Tp>& value)
{
this->set<_Tp>(_name.c_str(), value);
}
template<typename _Tp> inline typename ParamType<_Tp>::member_type Algorithm::get(const string& _name) const
{
......@@ -3872,6 +3872,24 @@ template<typename _Tp> inline typename ParamType<_Tp>::member_type Algorithm::ge
return value;
}
template<typename _Tp, typename _Base> inline void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
Ptr<_Tp>& value, bool readOnly, Ptr<_Tp> (Algorithm::*getter)(), void (Algorithm::*setter)(const Ptr<_Tp>&),
const string& help)
{
//TODO: static assert: _Tp inherits from _Base
addParam_(algo, parameter, ParamType<_Base>::type, &value, readOnly,
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
}
template<typename _Tp> inline void AlgorithmInfo::addParam(Algorithm& algo, const char* parameter,
Ptr<_Tp>& value, bool readOnly, Ptr<_Tp> (Algorithm::*getter)(), void (Algorithm::*setter)(const Ptr<_Tp>&),
const string& help)
{
//TODO: static assert: _Tp inherits from Algorithm
addParam_(algo, parameter, ParamType<Algorithm>::type, &value, readOnly,
(Algorithm::Getter)getter, (Algorithm::Setter)setter, help);
}
}
#endif // __cplusplus
......
......@@ -527,7 +527,7 @@ template<> inline int VBLAS<double>::givensx(double* a, double* b, int n, double
#endif
template<typename _Tp> void
JacobiSVDImpl_(_Tp* At, size_t astep, _Tp* _W, _Tp* Vt, size_t vstep, int m, int n, int n1)
JacobiSVDImpl_(_Tp* At, size_t astep, _Tp* _W, _Tp* Vt, size_t vstep, int m, int n, int n1, double minval)
{
VBLAS<_Tp> vblas;
AutoBuffer<double> Wbuf(n);
......@@ -587,11 +587,11 @@ JacobiSVDImpl_(_Tp* At, size_t astep, _Tp* _W, _Tp* Vt, size_t vstep, int m, int
delta = p*p*0.5/(gamma + beta);
}
if( iter % 2 )
W[i] += delta;
W[j] -= delta;
if( iter % 2 != 0 && W[i] > 0 && W[j] > 0 )
{
W[i] += delta;
W[j] -= delta;
k = vblas.givens(Ai, Aj, m, c, s);
for( ; k < m; k++ )
......@@ -671,12 +671,13 @@ JacobiSVDImpl_(_Tp* At, size_t astep, _Tp* _W, _Tp* Vt, size_t vstep, int m, int
if( !Vt )
return;
RNG rng(0x12345678);
for( i = 0; i < n1; i++ )
{
sd = i < n ? W[i] : 0;
while( sd == 0 )
while( sd <= minval )
{
// if we got a zero singular value, then in order to get the corresponding left singular vector
// we generate a random vector, project it to the previously computed left singular vectors,
......@@ -724,12 +725,12 @@ JacobiSVDImpl_(_Tp* At, size_t astep, _Tp* _W, _Tp* Vt, size_t vstep, int m, int
static void JacobiSVD(float* At, size_t astep, float* W, float* Vt, size_t vstep, int m, int n, int n1=-1)
{
JacobiSVDImpl_(At, astep, W, Vt, vstep, m, n, !Vt ? 0 : n1 < 0 ? n : n1);
JacobiSVDImpl_(At, astep, W, Vt, vstep, m, n, !Vt ? 0 : n1 < 0 ? n : n1, FLT_MIN);
}
static void JacobiSVD(double* At, size_t astep, double* W, double* Vt, size_t vstep, int m, int n, int n1=-1)
{
JacobiSVDImpl_(At, astep, W, Vt, vstep, m, n, !Vt ? 0 : n1 < 0 ? n : n1);
JacobiSVDImpl_(At, astep, W, Vt, vstep, m, n, !Vt ? 0 : n1 < 0 ? n : n1, DBL_MIN);
}
/* y[0:m,0:n] += diag(a[0:1,0:m]) * x[0:m,0:n] */
......
......@@ -940,6 +940,34 @@ bool CV_OperationsTest::TestSVD()
SVD svd(A, SVD::FULL_UV);
if( norm(A*svd.vt.row(3).t(), CV_C) > FLT_EPSILON )
throw test_excep();
Mat Dp(3,3,CV_32FC1);
Mat Dc(3,3,CV_32FC1);
Mat Q(3,3,CV_32FC1);
Mat U,Vt,R,T,W;
Dp.at<float>(0,0)=0.86483884; Dp.at<float>(0,1)= -0.3077251; Dp.at<float>(0,2)=-0.55711365;
Dp.at<float>(1,0)=0.49294353; Dp.at<float>(1,1)=-0.24209651; Dp.at<float>(1,2)=-0.25084701;
Dp.at<float>(2,0)=0; Dp.at<float>(2,1)=0; Dp.at<float>(2,2)=0;
Dc.at<float>(0,0)=0.75632739; Dc.at<float>(0,1)= -0.38859656; Dc.at<float>(0,2)=-0.36773083;
Dc.at<float>(1,0)=0.9699229; Dc.at<float>(1,1)=-0.49858192; Dc.at<float>(1,2)=-0.47134098;
Dc.at<float>(2,0)=0.10566688; Dc.at<float>(2,1)=-0.060333252; Dc.at<float>(2,2)=-0.045333147;
Q=Dp*Dc.t();
SVD decomp;
decomp=SVD(Q);
U=decomp.u;
Vt=decomp.vt;
W=decomp.w;
Mat I = Mat::eye(3, 3, CV_32F);
if( norm(U*U.t(), I, CV_C) > FLT_EPSILON ||
norm(Vt*Vt.t(), I, CV_C) > FLT_EPSILON ||
W.at<float>(2) < 0 || W.at<float>(1) < W.at<float>(2) ||
W.at<float>(0) < W.at<float>(1) ||
norm(U*Mat::diag(W)*Vt, Q, CV_C) > FLT_EPSILON )
throw test_excep();
}
catch(const test_excep&)
{
......
......@@ -144,7 +144,7 @@ CV_INIT_ALGORITHM(DenseFeatureDetector, "Feature2D.Dense",
obj.info()->addParam(obj, "varyImgBoundWithScale", obj.varyImgBoundWithScale));
CV_INIT_ALGORITHM(GridAdaptedFeatureDetector, "Feature2D.Grid",
obj.info()->addParam(obj, "detector", (Ptr<Algorithm>&)obj.detector);
obj.info()->addParam(obj, "detector", obj.detector);
obj.info()->addParam(obj, "maxTotalKeypoints", obj.maxTotalKeypoints);
obj.info()->addParam(obj, "gridRows", obj.gridRows);
obj.info()->addParam(obj, "gridCols", obj.gridCols));
......
......@@ -160,7 +160,7 @@ if(HAVE_FFMPEG)
list(APPEND HIGHGUI_LIBRARIES ${BZIP2_LIBRARIES})
endif()
if(APPLE)
list(APPEND HIGHGUI_LIBRARIES "-framework VideoDecodeAcceleration")
list(APPEND HIGHGUI_LIBRARIES "-framework VideoDecodeAcceleration" bz2)
endif()
endif(HAVE_FFMPEG)
......
......@@ -720,7 +720,7 @@ fromConnection:(AVCaptureConnection *)connection{
image->height = height;
image->nChannels = 4;
image->depth = IPL_DEPTH_8U;
image->widthStep = rowBytes;
image->widthStep = (int)rowBytes;
image->imageData = imagedata;
image->imageSize = currSize;
......@@ -731,7 +731,7 @@ fromConnection:(AVCaptureConnection *)connection{
bgr_image->height = height;
bgr_image->nChannels = 3;
bgr_image->depth = IPL_DEPTH_8U;
bgr_image->widthStep = rowBytes;
bgr_image->widthStep = (int)rowBytes;
bgr_image->imageData = bgr_imagedata;
bgr_image->imageSize = currSize;
......@@ -949,7 +949,7 @@ IplImage* CvCaptureFile::retrieveFramePixelBuffer() {
image->height = height;
image->nChannels = 4;
image->depth = IPL_DEPTH_8U;
image->widthStep = width*4;
image->widthStep = rowBytes;
image->imageData = imagedata;
image->imageSize = currSize;
......@@ -962,7 +962,7 @@ IplImage* CvCaptureFile::retrieveFramePixelBuffer() {
bgr_image->height = height;
bgr_image->nChannels = 3;
bgr_image->depth = IPL_DEPTH_8U;
bgr_image->widthStep = width*4;
bgr_image->widthStep = rowBytes;
bgr_image->imageData = bgr_imagedata;
bgr_image->imageSize = currSize;
......
......@@ -521,7 +521,7 @@ void icvSetOpenGlCleanCallback(const char*, CvOpenGlCleanCallback, void*)
#if defined (HAVE_QT)
CvFont cv::fontQt(const string& nameFont, int pointSize, Scalar color, int weight, int style, int spacing)
CvFont cv::fontQt(const string& nameFont, int pointSize, Scalar color, int weight, int style, int /*spacing*/)
{
return cvFontQt(nameFont.c_str(), pointSize,color,weight, style);
}
......
......@@ -2414,13 +2414,13 @@ void DefaultViewPort::startDisplayInfo(QString text, int delayms)
}
void DefaultViewPort::setOpenGlDrawCallback(CvOpenGlDrawCallback callback, void* userdata)
void DefaultViewPort::setOpenGlDrawCallback(CvOpenGlDrawCallback /*callback*/, void* /*userdata*/)
{
CV_Error(CV_OpenGlNotSupported, "Window doesn't support OpenGL");
}
void DefaultViewPort::setOpenGlCleanCallback(CvOpenGlCleanCallback callback, void* userdata)
void DefaultViewPort::setOpenGlCleanCallback(CvOpenGlCleanCallback /*callback*/, void* /*userdata*/)
{
CV_Error(CV_OpenGlNotSupported, "Window doesn't support OpenGL");
}
......@@ -3058,7 +3058,7 @@ void DefaultViewPort::drawInstructions(QPainter *painter)
}
void DefaultViewPort::setSize(QSize size_)
void DefaultViewPort::setSize(QSize /*size_*/)
{
}
......@@ -3101,11 +3101,11 @@ void OpenGlViewPort::setMouseCallBack(CvMouseCallback callback, void* param)
mouseData = param;
}
void OpenGlViewPort::writeSettings(QSettings& settings)
void OpenGlViewPort::writeSettings(QSettings& /*settings*/)
{
}
void OpenGlViewPort::readSettings(QSettings& settings)
void OpenGlViewPort::readSettings(QSettings& /*settings*/)
{
}
......@@ -3114,15 +3114,15 @@ double OpenGlViewPort::getRatio()
return (double)width() / height();
}
void OpenGlViewPort::setRatio(int flags)
void OpenGlViewPort::setRatio(int /*flags*/)
{
}
void OpenGlViewPort::updateImage(const CvArr* arr)
void OpenGlViewPort::updateImage(const CvArr* /*arr*/)
{
}
void OpenGlViewPort::startDisplayInfo(QString text, int delayms)
void OpenGlViewPort::startDisplayInfo(QString /*text*/, int /*delayms*/)
{
}
......@@ -3350,7 +3350,7 @@ void GlFuncTab_QT::unmapBuffer(unsigned int target) const
__END__;
}
void GlFuncTab_QT::generateBitmapFont(const std::string& family, int height, int weight, bool italic, bool underline, int start, int count, int base) const
void GlFuncTab_QT::generateBitmapFont(const std::string& family, int height, int weight, bool italic, bool /*underline*/, int start, int count, int base) const
{
//CV_FUNCNAME( "GlFuncTab_QT::generateBitmapFont" );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册