I have a java program that needs to create an OpenCV 2D Mat of type 16UC1 from a 1D byte array (width and height are known). The size of the byte array is W*H*2 and each pixel should be constructed from two consecutive bytes from the array.
In C++ OpenCV this is somewhat trivial because Mat constructor can take a (void*) pointer to data, but can I do it in java OpenCV without nested loops and constructing every uint16 from two bytes?