user1359341
user1359341

Reputation: 121

Create Matrix from pixel array in opencv

I have a unsigned short array which I would like to median filter using opencv (it seems to have one of the most efficient filters around)

However I can't seem to create a matrix from the array. I've tried the Mat(int _rows, int _cols, int _type, void* _data, size_t _step=AUTO_STEP) constructor using:

Mat(rows,cols,IPL_DEPTH_16U,myShortArray,2);

But it doesn't seem to work. What am I doing wrong?

Upvotes: 3

Views: 3222

Answers (1)

Andrey Kamaev
Andrey Kamaev

Reputation: 30122

Try

Mat m(rows, cols, CV_16U, myShortArray);

Upvotes: 7

Related Questions