Commit 0bd287a8 authored by Philipp Wagner's avatar Philipp Wagner

Fixed reconstruction, so that the mean is correctly added to the reconstructed image.

parent 2ee917c6
...@@ -185,21 +185,16 @@ Mat subspaceReconstruct(InputArray _W, InputArray _mean, InputArray _src) ...@@ -185,21 +185,16 @@ Mat subspaceReconstruct(InputArray _W, InputArray _mean, InputArray _src)
Mat W = _W.getMat(); Mat W = _W.getMat();
Mat mean = _mean.getMat(); Mat mean = _mean.getMat();
Mat src = _src.getMat(); Mat src = _src.getMat();
// get number of samples and dimension // get number of samples
int n = src.rows; int n = src.rows;
int d = src.cols;
// initalize temporary matrices // initalize temporary matrices
Mat X, Y; Mat X, Y;
// copy data & make sure we are using the correct type // copy data & make sure we are using the correct type
src.convertTo(Y, W.type()); src.convertTo(Y, W.type());
// calculate the reconstruction // calculate the reconstruction
gemm(Y, gemm(Y, W, 1.0, Mat(), 0.0, X, GEMM_2_T);
W, if(mean.total() == (size_t) X.cols)
1.0, add(X, repeat(mean.reshape(1,1), n, 1), X);
((size_t)d == mean.total()) ? repeat(mean.reshape(1,1), n, 1) : Mat(),
((size_t)d == mean.total()) ? 1.0 : 0.0,
X,
GEMM_2_T);
return X; return X;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment