base64 to Mat and Mat to base64

asked 2017-09-15 01:20:46 -0500

carton99 gravatar image

Hi,

I have very poor processing time with base64 image using C++. I don't use third library as boost...

After couple of hour to google search, I use this code to encode and decode image into base 64: http://renenyffenegger.ch/notes/devel...

My problem is my processing time is 40ms to decode image in C++, then to compare with php function my processing time is 3ms. I thought C++ were more speed !

Does really don't exist a direct entry for base64 and openCV ?

thx Christophe

edit retag flag offensive close merge delete

Comments

honestly, you should avoid to encode images to/from base64 at all cost,apart from the compression time, it will blow up the data to a factor of 4.

opencv, being a computer-vision library does not need this at all, and there's nothing built in.

what is your actual use-case for this ?

berak gravatar imageberak ( 2017-09-15 01:36:26 -0500 )edit

thx for your answer, I'am working on cloud vision API. I have a global api.php that receive and process with (C++ openCV ). It's work very fast < 50ms and good.

I choose base64 because it's more easy format for beginner programmer in all language python, js, bash...

Infact last problem to have is with using base64 format with openCV

. . I am open and listen for other idea !!!!

carton99 gravatar imagecarton99 ( 2017-09-15 02:12:38 -0500 )edit

btw, you're probably not trying to encode a cv::Mat to base64, but an already png or jpg encoded image, right ?

so, again, why ?

(only reason for base64 imho would be some 7bit protocol like e-mail (uaaa) or if you need data-encoded images (uaaaaaa))

berak gravatar imageberak ( 2017-09-15 02:18:03 -0500 )edit

Yes you right.

I don't need base64.

I want just a very easy way for in JS, python and JAVA to send data image to a php backend.

Problem for example is with javascript if we get data from image, it is in base64 format

carton99 gravatar imagecarton99 ( 2017-09-15 02:42:41 -0500 )edit