簡體   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