Registered Member
|
I want to use a matrix to store grayscale values of multiple images. As such, my plan is to have a matrix with the dimension of axb where a = number of values in the vector where I temporarily store the grayscale values per image, b = number of images.
When I use MatrixXf mat(a,b), I get an Assertion failed error upon running the program. Can you anyone give me an insight as to how I may get around to declare it properly? This is the error:
|
Moderator
|
hm,
MatrixXf mat(a,b); gives you a a x b matrix. The error you get means you tried to access mat(i,j) with i and/or j outside the ranges [0:a[, [0:b[. Without more information I cannot help you more. |
Registered Member
|
Here is my code for accessing the matrix:
mSize is a global variable that keeps track of the number of rows. It is initially set at 1. The program still returns an Assert failure. |
Moderator
|
Indices go from (0,0) to (rows-1,columns-1)...
|
Registered Member
|
I realised my mistake. Thank you very much.
One other thing, how do I dynamically-resize the matrix without overwriting the contents of the previous matrix? |
Moderator
|
|
Registered Member
|
Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot], ourcraft