使用python预处理后,C++(opencv)中的垫子类型数据与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));
相关文章:
- 防止主数据类型C++的隐式转换
- 处理小于cpu数据总线的数据类型.(c++转换为机器代码)
- 在C++中打印指向不同基元数据类型的指针的内存地址
- C++浮点数据类型和字符串数据类型无法子到模板函数中
- 如何计算数据类型的范围,例如int
- C++中数据类型修饰符的顺序
- C++LinkedList问题.数据类型之间存在冲突?没有匹配的构造函数
- 特定数据类型的模板类
- 具有多个模板的模板函数,用于特定数据类型(如字符串)?
- 有没有办法提示用户使用哪种数据类型作为模板 c++
- int数据类型的指针指向的是什么,如果是一个类的私有数据成员,我们创建了该类的两个对象?
- 时间复杂度 当具有复合数据类型(如元组或对)时?
- 如何获取C++字符数据类型的地址
- 将复杂的非基元C++数据类型转换为 Erlang/Elixir 格式,以使用 NIF 导出方法
- 构造智能点数据类型以及普通数据类型的通用方法
- 如何使映射键具有两种不同的数据类型?
- 数据类型"struct seq<0, 1, 2>{}"含义是什么?
- 如何在不破坏现有应用程序的情况下更改 API 中 stl 容器的数据类型?
- Static_cast转换为错误的数据类型,但结果仍然正确?
- 使用 Boost.Spirit 解析具有混合数据类型的 OBJ 文件?