8

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

Jav_Rock
  • 22,059
  • 20
  • 123
  • 164
heykell
  • 171
  • 6

3 Answers3

4

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/c-c-web-server-library

Community
  • 1
  • 1
qdot
  • 6,195
  • 5
  • 44
  • 95
1

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.

user52875
  • 3,020
  • 22
  • 21
0

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);
eudoxos
  • 18,545
  • 10
  • 61
  • 110
  • Hi, I am trying to show a video input using opencv using your code. It works for a single image but when I try it in a loop, the web page shows "Loading" and nothing happens. – Ali Nov 22 '19 at 06:50
  • One possibility is that you refresh the image before it gets transmitted-- did you try with very slow frame rate? Another possibility is you need to call the re-loading not from loop but using periodic timer (otherwise you block the event loop) so that other events might be processed. I am no expert in Wt but this would be the case with Qt. – eudoxos Nov 24 '19 at 17:01