Quantcast
Channel: OpenCV Q&A Forum - Latest question feed
Viewing all articles
Browse latest Browse all 19555

Getting nan from multiplying cv::Mat 's

$
0
0
Hi. I have several images and I transformed them into a `cv::Mat` matrix and I named it `trainingMat` (each row represents an image). I have also a diagonal matrix named `R`. When I multiply trainingMat by R (`cv::Mat first = (trainingMat.t() * R);`), Everything is fine and I get a dense matrix. But When i try this: cv::Mat first = (trainingMat.t() * R * trainingMat); I get a matrix full of `nan`'s. I have also tried these multiplications: cv::Mat first = (R * trainingMat); cv::Mat first = (trainingMat.t() * R); cv::Mat first = (trainingMat.t() * trainingMat); and in each of these cases I get a dense matrix that looks fine. I also tried to code like this: cv::Mat first = (trainingMat.t() * R); cv::Mat sec = first * trainingMat; and again I get a matrix full of `nan`'s. What causes this problem? There is no division by 0 (is there !?) so why should multiplication of two dense matrices be a nan matrix?

Viewing all articles
Browse latest Browse all 19555

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>