Ask Your Question
0

Convert and show double Array

asked 2014-01-31 03:50:35 -0600

Hey there,

I try to getting started with openCV but can't get aournd with a few things. I have an array of doubles and want to show it as an imgage with imshow. But this only accepts an InputArray mat type. How can I convert the double array to an InputArray?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2014-01-31 04:11:50 -0600

Haris gravatar image

updated 2014-01-31 04:18:08 -0600

For small matrices you may use comma separated initializers like

 Mat A = (Mat_<double>(3,3) << 0, -1, 0, -1, 5, -1, 0, -1, 0);

Or you could use Mat constructors to initialize Mat with a data pointer like

Mat::Mat(int rows, int cols, int type, void* data, size_t step=AUTO_STEP)

or

Mat::Mat(Size size, int type, void* data, size_t step=AUTO_STEP)

See OpenCV Doc for more details.

Also see the answer here might be helpful.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-01-31 03:50:35 -0600

Seen: 864 times

Last updated: Jan 31 '14