From 81779d82875a229a75f3a2c9f161f5a8f21c0596 Mon Sep 17 00:00:00 2001
From: Bo Li <prclibo@gmail.com>
Date: Thu, 9 May 2013 15:20:00 +0800
Subject: [PATCH] fixed pca bug for fixed mean input

---
 modules/core/src/matmul.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/modules/core/src/matmul.cpp b/modules/core/src/matmul.cpp
index 9b3868505..5988363d3 100644
--- a/modules/core/src/matmul.cpp
+++ b/modules/core/src/matmul.cpp
@@ -2855,8 +2855,9 @@ PCA& PCA::operator()(InputArray _data, InputArray __mean, int flags, int maxComp
 
     if( _mean.data )
     {
-        CV_Assert( _mean.size() == mean_sz );
+        CV_Assert( _mean.size() == mean_sz );        
         _mean.convertTo(mean, ctype);
+        covar_flags |= CV_COVAR_USE_AVG; 
     }
 
     calcCovarMatrix( data, covar, mean, covar_flags, ctype );