Ml cpp wrappers fix

There is the bug in MLL described in PR https://github.com/Itseez/opencv/pull/1325. But solution suggested in that PR has a drawback: doubling training data memory is unacceptably because real training data might be very large. This PR fixes the original problem without increasing memory.