Ask Your Question

how to multithread imdecode with base64 input data

asked 2017-09-20 03:44:56 -0500

carton99 gravatar image

updated 2017-10-06 17:23:25 -0500

Hi, i work with base64 format input image.

Here my C++ code:

//In normal condition img_base64 is a unknown size and format image ( in this time processing test I use an image with 1258 × 834 420Ko .png format )

string img_str =   base64_decode(img_base64); // 13ms 
vector<uchar>      img_data(img_str.begin(), img_str.end()); //2ms
Mat img =          imdecode(img_data, IMREAD_UNCHANGED);   // 33ms

(time processing is procced with getTickCount)

You can see that imdecode is very long to execute. In my application time processing is very important. I would like to know how if is possible to parallelize imdecode without including third library, for example by divide "img_data" into 4 part of image and using pthread in each part?

I listen all others solutions.


edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2017-09-20 05:21:39 -0500

berak gravatar image

unfortunately, this is not possible with opencv means.

maybe you can skip cv::imdecode, and use the libpng code directly.

edit flag offensive delete link more


I see, ok thx

carton99 gravatar imagecarton99 ( 2017-09-21 02:45:34 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2017-09-20 03:44:56 -0500

Seen: 447 times

Last updated: Sep 20 '17