In the last post, we saw the basic methods to load and display matrices. Let us see some more aspects of an OpenCV matrix. Matrix Assignment and Cloning In opencv, the assignment (“=”) operator does not copy a matrix. It only attaches a new label or alias to a matrix. In c/c++ when we write A = B, we expect A and B to be two different variables with same value. However, in OpenCV, such an assignment operation will actually say that A and B are invariably the same matrix. This will be illustrated in the following opencv snippet.
Tag: Novice
Linear Algebra in OpenCV: OpenCV Matrices
I know many people will look at me in frowning eyes after reading the title. Yes, OpenCV is an image processing and computer vision library. But believe me, the most rudimentary works you need to do in these fields are essentially “Linear Algebra”. Think about an image — it is a matrix; and most of the time you’ll work on matrices. Even other data structures like vectors and points — all are some kind of matrices. Necessity of doing linear algebra is one of the main reasons for burgeoning MATLAB (which is an acronym for MATrix LABoratory) libraries for image processing. In fact, …