简体   繁体   中英

C++ web project using OpenCV with Wt

What is a good platform for a web based project that does image processing using OpenCV library? I found Wt ( http://www.webtoolkit.eu/wt ).

Can I use OpenCV with Wt ? Is there any better alternatives to Wt?

Requirements:

A login page GUI to upload documents, select areas on image, handwriting word/line detection using OpenCV

I've used Wt in the past, it is very useful, albeit bulky. It's bloat has to do with having to support a wide variety of web browsers, so in some cases it is a feature.

If you're more of a close-to-metal programmer, I'd recommend PION, and implementing your GUI using some of your web authoring skills:

http://www.pion.org/projects/pion-network-library

You can use OpenCV with pretty much any network library out there. A good review of your choices is available here on StackOverflow:

https://stackoverflow.com/questions/175507/cc-web-server-library

I think what you ask is possible with Wt. I cannot foresee problems with linking OpenCV in Wt, and the system is definitely interactive enough to provide the functionality you describe. Implement it with server-side actions first, and if required, you can still optimize parts with small bits of client-side JS.

FWIW, this is a simple code to display OpenCV image (possibly changing the image while the app is running):

Wt::WMemoryResource* cvMat2res(const cv::Mat& img){
    std::vector<uchar> buf;
    cv::imencode(".png",img,buf); // by default, the fastest compression
    auto ret=new Wt::WMemoryResource(this);
    ret->setMimeType("mime/png");
    ret->setData(buf); // data is copied here
    return ret;
}

/* ... */
auto img=new Wt::Image();
root()->addWidget(img);
Wt::WMemoryResource* imgRes=nullptr;

/* set image data; this can be done also in event handler and the image updates itself automatically from the new resource */
if(imgRes) delete imgRes;
imgRes=cvMat2res(cvImage);
img->setImageLink(imgRes);

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