Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

probably the error is here:

 ImgCon.reshape(1,1);

reshape() does not work "in-place", it returns a new Mat header, i think, you wanted:

 ImgCon = ImgCon.reshape(1,1); //(one line with 100 pixels)

due to this, you had 10 times more rows in your trainData Mat as expected, leading to an out-of-bounds condition, when setting up the "one-hot" labels