Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

asked 2015-07-09 09:58:50 -0500

Nbb gravatar image

Help on matrix multiplication

Hi forum, Im trying to perform a matrix multiplication + addition but I am getting an error. Below are the 3 variables

Mat MatrixB = (Mat_<float>(5, 5) << 1, 0, 1, 0, 0,
                                    0, 1, 0, 1, 0,
                                    0, 0, 1, 0, 0,
                                    0, 0, 0, 1, 0,
                                    0, 0, 0, 0, 1);

Mat noise(5, 1, CV_32F, 0);

for (int i = 0; i < 200; i++) MatrixA.push_back(Mat::zeros(5, 1, CV_32F));

Noise and MatrixA gets initialized to some value. However when I do the following operation MatrixA = MatrixB * MatrixA + noise I get an error.

Help on matrix multiplication

Hi forum, Im trying to perform a matrix multiplication + addition but I am getting an error. Below are the 3 variables

Mat MatrixB = (Mat_<float>(5, 5) << 1, 0, 1, 0, 0,
                                    0, 1, 0, 1, 0,
                                    0, 0, 1, 0, 0,
                                    0, 0, 0, 1, 0,
                                    0, 0, 0, 0, 1);

Mat noise(5, 1, CV_32F, 0);

for (int i = 0; i < 200; i++) MatrixA.push_back(Mat::zeros(5, 1, CV_32F));

Noise and MatrixA gets initialized to some value. However when I do the following operation MatrixA = MatrixB * MatrixA + noise I get an error.