Ask Your Question
1

is there a method to get a picture from web ?

asked 2013-12-23 21:26:33 -0500

风飞向何处 gravatar image

updated 2015-11-03 14:40:03 -0500

is there have a OpenCV API to get picture from web?the URL is http://192.168.1.200:8080/action=snapshot

edit retag flag offensive close merge delete

Comments

Why do you want to load image with OpenCV? You can try this: http://stackoverflow.com/questions/2471935/how-to-load-an-imageview-by-url-in-android and then you can convert the bitmap to matrix by doing this: Utils.bitmapToMat(bitmap, matrix);

itay gravatar imageitay ( 2013-12-24 06:03:04 -0500 )edit

1 answer

Sort by » oldest newest most voted
1

answered 2013-12-26 07:25:34 -0500

Haris gravatar image

updated 2013-12-26 07:26:16 -0500

Using VideoCapture class you can open web image as we open video file. See the example below.

    VideoCapture cap;
    if(!cap.open("http://docs.opencv.org/trunk/_downloads/opencv-logo.png")){
     cout<<"Cannot open image"<<endl;
     return -1;
     }

    Mat src;
    cap>>src;
    imshow("src",src);
    imwrite("image.jpg",src);
    waitKey();
edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-12-23 21:26:33 -0500

Seen: 200 times

Last updated: Dec 26 '13