O'Reilly logo

Emgu CV Essentials by Shin Shi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Working with matrices

After introducing the definition of matrices, we'd like to create the first matrix in our project.

Creating a matrix

Now, if we want to create a Double matrix of a specific size in Emgu CV, it can be done by using the following line of code:

Matrix<Double> matrix = new Matrix<Double>(height, width);

The Double here is the type of the elements. width and height decide the size of this matrix.

Tip

We can also create this matrix by calling CvInvoke.cvCreateMat. This process is similar to that of creating an image, which was covered in the previous chapter. But it is also used to construct a Matrix<TDepth> object instead. The reason behind this can be found in Chapter 5, Working with Images.

Now we are going to create a 5x7 matrix, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required