[英]Mat type data in C++ (opencv) as same as the image_to_array after using python preprocessing?
I'm working on convert the python code to C++, I got a data structure problems about Mat
in OpenCV (C++ version) and image preprocessing
in Python. 我正在将python代码转换为C ++,在OpenCV(C ++版本)中遇到了有关
Mat
的数据结构问题,在Python中出现了image preprocessing
问题。
Python code is following: Python代码如下:
img = image.load_img(img_path)
img = img.resize((d_widght, d_height), image.NEAREST).convert('RGB')
img = image.img_to_array(img)
and the result of the img after 'image.img_to_array' is a three dimension array 3*384. 'image.img_to_array'之后的img结果为三维数组3 * 384。
C++ code is following here: 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.
Then, the 'imgdst'
is same as the 'img'
in python, which is a 3*384
array? 然后,
'imgdst'
与python中的'img'
相同,这是一个3*384
数组?
yes imgdst is the same as img, even in c++ you may 是的imgdst与img相同,即使在c ++中,您可能
Mat img = imread('1.jpg');
resize(img, img,Size(384,384));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.