How to change OpenCV Mat dimensions with retaining previous data

397
January 21, 2017, at 1:32 PM

I am writing a code utilizing OpenCV in Android. Now I want to change dimensions of a Mat object without rescale it (this is, retaining previous data). For example, a 4x4 mat:

0 0 0 0
0 1 1 0
0 1 1 0
0 0 0 0

change its size to 6x6

0 0 0 0 0 0
0 1 1 0 0 0
0 1 1 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0

I think that using copy operation would deteriorate performance, so what is the most efficient way to do this?

Rent Charter Buses Company