简体   繁体   中英

load an image from an url using opencv and cURL

I am trying to load an image from an url and display it.I am using opencv in c++ and cURL libraries.I am used to working with opencv,but I don't have any experience working with cURL libraries. I just need curl to load an image and save it in a cv::Mat file, so that I could display it. So, I took code from here .It is supposed to be working,but I am getting syntax errors. Also,I tried this code from opencv.org. But,I am getting same errors

Errors are 1>c:\\program files (x86)\\microsoft visual studio 10.0\\vc\\include\\cmath(19): error C2061: syntax error : identifier 'acosf'

1>c:\\program files (x86)\\microsoft visual studio 10.0\\vc\\include\\cmath(19): error C2059: syntax error : ';'

and about 90 syntax errors.When I click on errors it is opening cmath file and I cant find any syntax errors there.

Thank you for the help.

EDIT 1: I compiled the code as c++ and got rid of the above errors.Now I got a new error

OpenCV Error: Assertion failed (buf.data && buf.isContinuous()) in cv::imdecode_, file ........\\opencv\\modules\\highgui\\src\\loadsave.cpp

It looks like you are compiling for c and not c++ . Check two things:

  1. Code file extension is .cpp and not .c .
  2. Check the compilation properties: Tools bar -> Project -> Properties (or Alt + F7)->Configuration Properties -> C/C++ -> Advanced -> Compile As: "Compile as C++ Code".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM