繁体   English   中英

使用python预处理后,C ++(opencv)中的mat类型数据与image_to_array相同吗?

[英]Mat type data in C++ (opencv) as same as the image_to_array after using python preprocessing?

我正在将python代码转换为C ++,在OpenCV(C ++版本)中遇到了有关Mat的数据结构问题,在Python中出现了image preprocessing问题。

Python代码如下:

img = image.load_img(img_path)
img = img.resize((d_widght, d_height), image.NEAREST).convert('RGB')
img = image.img_to_array(img)

'image.img_to_array'之后的img结果为三维数组3 * 384。

C ++代码如下:

Mat img = imread('1.jpg');
Mat imgdst;
resize(img, imgdst,Size(384,384)); 
//because the image size after resize in python is (384*384), so here I just convert the image size using this line.

然后, 'imgdst'与python中的'img'相同,这是一个3*384数组?

是的imgdst与img相同,即使在c ++中,您可能

Mat img = imread('1.jpg');
resize(img, img,Size(384,384));

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM