Read image from Amazon S3 directly to MAT with AWS SDK for C++? [closed]

asked 2016-02-12 19:50:43 -0500

cuongvt101 gravatar image

Does anyone have experience with this AWS SDK for C++?

So for example, I have this image: https://s3-us-west-2.amazonaws.com/vs...

How can I read this image directly to MAT without saving it to disk using AWS SDK for C++?

Any help would be greatly appreciated!

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by sturkmen
close date 2020-10-07 12:51:44.483037

Comments

if there's an aws sdk, why not use it ?

if not, you want one of those

berak gravatar imageberak ( 2016-02-13 00:05:02 -0500 )edit

Hi Berak, I am trying to use aws sdk actually. My question is how? Thanks

cuongvt101 gravatar imagecuongvt101 ( 2016-02-13 00:13:49 -0500 )edit

sorry, can't help with that ;(

but once you have the bytes in memory, you can construct a cv::Mat easily like

Mat m = cv::imdecode(buffer, IMREAD_COLOR);
berak gravatar imageberak ( 2016-02-13 00:21:07 -0500 )edit

Thanks Berak anyway. I'm reading the documentation of AWS SDK to read to buffer but has now luck so far.

cuongvt101 gravatar imagecuongvt101 ( 2016-02-13 00:24:20 -0500 )edit

Hi, Cuongvt101. I wrote an article for using OpenCV and AWS SDK for C++. http://qiita.com/[email protected]/items...

This is the snippet.


    std::stringstream ss;
    ss << getObjectOutcome.GetResult().GetBody().rdbuf();
    std::string str = ss.str();
    std::vector<char> vec(str.begin(), str.end());
    cv::Mat img = cv::imdecode(cv::Mat(vec), CV_LOAD_IMAGE_COLOR);
d9magai gravatar imaged9magai ( 2016-08-09 06:07:04 -0500 )edit

Didn't check back this question for a while. Thanks a lot d9magai for your help

cuongvt101 gravatar imagecuongvt101 ( 2016-09-16 14:44:47 -0500 )edit