Fix copyTo of 1xN matrices to std::vector, and similar use cases

In 4f9c081dc3 a new assertion was introduced to getContinuousSize
that verifies that it was used correctly. The assertion makes sense,
but it breaks the use case where an 1xN matrix is copiedTo a vector.

Since vectors can't store separate width and height values, OpenCV
considers them to always be Nx1. So even though copyTo creates it with
.create(1, N), the Mat passed to getContinousSize has dimensions Nx1,
and the size comparison fails.

Similar failures occur in various other functions that use
getContinuousSize.

This is a use case we probably don't want to break, at the very least
for backwards compatibility. So this commit fixes it by manually
reshaping the destination matrix if it doesn't have the right size.

This is a provisional commit, just to fix the merge. I'll send this
as a PR to 2.4 so it can be properly reviewed.