![](/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.