fix cv::kmeans function

reshape input matrix, since the function works with data
as with [N x dims] matrix
use more accurate reshape
add additional tests for different input cases
Merge pull request #2744 from jet47:kmeans-fix