How to Declare Matrix array in Emgu CV?

一笑奈何 提交于 2019-12-11 13:53:49

问题


I am new in Emgu CV . I need a matrix array to store pixel values of gray images. Is it possible to declare a matrix array .

I code like this for matrix array But is gives "Error"

public Matrix<Double>[] Myimgmatrix = new Matrix<Double>[5](100,80);    

Error:"Method name expected" Any one Please Help.


回答1:


Do it like that:

private Matrix<Double>[] Myimgmatrix = new Matrix<Double>[5];  

And then, on your class constructor, initialize every matrix on the array individually:

for(int i = 0; i < Myimgmatrix.Length; i++)
    Myimgmatrix[i] = new Matrix<Double>(100,80);

As far as I know, you can't instantiate the array and its elements at the same time.

You can also create a matrix list, if you don't want to be flexible with the size of your array:

private List<Matrix<Double>> matrixList = new List<Matrix<Double>>();

and then, when you need a new matrix, just add it to your list, on the code:

matrixList.Add(new Matrix<Double>(100,80));



回答2:


Actually you can directly access gray pixel values from the image data in emgucv. You can check the implementation in emgu cv from this link work with matrix



来源:https://stackoverflow.com/questions/13611008/how-to-declare-matrix-array-in-emgu-cv

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!