Exif with Highgui.imwrite(filename, myMat); ?

asked 2013-09-23 09:40:47 -0600

updated 2013-09-24 06:43:23 -0600

berak gravatar image

In need to insert some exif tag in a jpg image.

I can't find an easy way to do that.

edit retag flag offensive close merge delete

Comments

you can't with opencv. neither read nor write

berak gravatar imageberak ( 2013-09-23 09:46:58 -0600 )edit

The EXIF support is even an open feature request. Best way to get it into the sourcecode, is to come up with a pull request :)

StevenPuttemans gravatar imageStevenPuttemans ( 2013-09-24 03:42:51 -0600 )edit

However, an idea could be to use an external library for that, and then store the data somewhere. Libexif does exactly that.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-09-24 03:44:03 -0600 )edit

I already tried libexif before, but that need to much step :

1) opencv write the mat to jpeg 2) java read this new jpeg 3) libexif apply exif 4) finally write a second time the jpeg.

Source code is native and cant modifiy it for #java#opencv

Pascal66 gravatar imagePascal66 ( 2013-09-24 04:07:01 -0600 )edit

Is there a reason why you are using the java interface? Because the libexif is C - based and could be easily integrated in a simple workflow with openCV C++ interface. I do not know why you should write the JPEG twice... You can store it as a temporarily element in memory, removing the need of all those abundant read and write operations.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-09-24 04:19:05 -0600 )edit
1

I use Java because I use it an android platform development. libexif exist for java as library. I can use Highguy.imencode to have a Buffer, but how i can handle it with libexif ?

Pascal66 gravatar imagePascal66 ( 2013-09-24 06:36:35 -0600 )edit

Have no experience in Java, will have to find someone else for that :)

StevenPuttemans gravatar imageStevenPuttemans ( 2013-09-24 06:40:14 -0600 )edit

Sure. Even if you can do many things, I think you cant do that. And a library that can read / write metadata IPTC/EXIF from a buffer will be the best.

Pascal66 gravatar imagePascal66 ( 2013-09-24 06:53:03 -0600 )edit