使用openCV从AmazonS3读取图像
Using openCV to read an image from Amazon S3
我知道有多个C++库可以使用cURL访问AmazonS3中的数据。使用它们,我可以将图像下载到本地机器上,将其读取到OpenCV中,并删除原始文件。
但是,我想知道是否可以直接将S3中的图像读取到OpenCV中,比如Mat对象。
有人能帮我完成这件事吗?
使用cv::imdecode,它将把内存中的一些图像数据(png、jpeg等)加载到一个矩阵中。
// Suppose that a std::vector<char> contains the data loaded by Curl.
std::vector<char> data;
// The template<typename T> explicit cv::Mat::Mat(const std::vector<T>& vec)
// constructor gives this vector a cv::Mat header.
cv::Mat data_mat(data);
// Now use cv::imdecode to decode the image to a BGR matrix.
cv::Mat image(cv::imdecode(data_mat));
所以,就Poco方面而言,这就是我必须做的。
std::auto_ptr<std::istream> pStr(URIStreamOpener::defaultOpener().open(uri));
StreamCopier::copyToString(*pStr.get(), str);
这将在没有任何中间存储的情况下将图像从所提供的URI获取到字符串str
中。其余的正如克里斯托夫所解释的。
相关文章:
- 增加 gil 读取图像错误
- 这是我的程序,C++使用 OpenCv 库从数据集中读取图像序列,但它没有运行
- 如何在Visual Studio中使用ITK配置的C 读取图像
- 如何在Android NDK中的硬盘驱动器中读取图像
- 如何在VTK DICOM阅读器中读取图像类型(0008,0008)
- 从C 中的文件中读取图像,然后传递到Libharu的绘制方法
- 从J2ME到C 读取图像
- imread无法读取图像
- 正在从文件-C++中读取图像
- 无法读取图像
- 使用openCV从AmazonS3读取图像
- OpenCV读取图像像素值
- 从内存中读取图像,知道指向内存的指针.VC++
- 读取图像打开CV时遇到问题
- 如何在C++中读取图像并将其绘制为加速图像
- 如何导航文件夹以读取图像
- 如何在c++中读取图像文件并将其存储在内存中(std::string)
- CImg读取图像异常
- 如何使用Poco C++从HTTP服务器响应中读取图像内容
- 为什么ifstream阅读器只读取图像文件的前10个字节