![](/img/trans.png)
[英]save data (matrix or ndarray) with python then it load in c++ (as OpenCV Mat)
[英]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.