user6133034
user6133034

Reputation:

OpenCV: Link given to imread() fails

I'm new to OpenCV. I've given a link to the function imread as follows:

Mat logo = imread("http://files.kurento.org/img/mario-wings.png");

I've checked and the image exists on the given path. imread() still fails to read it.

Any mistake that I've made?

-Thanks

Upvotes: 0

Views: 289

Answers (1)

s1hofmann
s1hofmann

Reputation: 1551

In fact imread is not able to read image data via http.

But it's possible using VideoCapture.

See this little snippet:

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>

int main() {
    cv::VideoCapture vc;
    vc.open("http://files.kurento.org/img/mario-wings.png");
    if(vc.isOpened() && vc.grab()) {
        cv::Mat logo;
        vc.retrieve(logo);
        cv::namedWindow("t");
        cv::imshow("t", logo);
        cv::waitKey(0);
        vc.release();
    }

    return 0;
}

Upvotes: 2

Related Questions