Ask Your Question

Revision history [back]

How to create 4D mat, like dnn::blobFromImage do?

Hi everyone,
I want to create a Mat with 4 dimensions, just like [1 x 3 x 416 x 416] in NCHW order.

cv::Mat mat_image = imread("dog.jpg", IMREAD_UNCHANGED);

print some attributes as following:
dims: 2
size: 576 x 768
rows: 576
cols: 768
channels: 3
Q: How can I convert it to [1 x 3 x 416 x 416] tensor or Mat?
Thanks!

How to create 4D mat, like dnn::blobFromImage do?

Hi everyone,
I want to create a Mat with 4 dimensions, just like [1 x 3 x 416 x 416] in NCHW order.

cv::Mat mat_image = imread("dog.jpg", IMREAD_UNCHANGED);

print some attributes as following:
dims: 2
size: 576 x 768
rows: 576
cols: 768
channels: 3
Q: How Without using dnn::blobFromImage, how can I convert it to [1 x 3 x 416 x 416] tensor or Mat?
Thanks!

How to create 4D mat, like dnn::blobFromImage do?

Hi everyone,
I want to create a Mat with 4 dimensions, just like [1 x 3 x 416 x 416] in NCHW order.

cv::Mat mat_image = imread("dog.jpg", IMREAD_UNCHANGED);

print some attributes as following:
dims: 2
size: 576 x 768
rows: 576
cols: 768
channels: 3
Q: Q: Without using dnn::blobFromImage, how can I convert it to [1 x 3 x 416 x 416] tensor or Mat?
Thanks!