ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: Lindsii on June 22, 2017, 02:44:31 AM

Title: copy ALL exif information for multispectral camera
Post by: Lindsii on June 22, 2017, 02:44:31 AM
Hi all,
I really hope you can help me with this.
I am using images from a MicaSense RedEdge camera.

I  need to make corrections like ISO and Exposure normalization and radiometric calibration. I do this in a script written with R, where I then write my corrected images as raster tiff. So far so good.

The problem is now, that the exif header doesn't get copied. I used exiftool and copied the exif information from the original images. Nevertheless, the information about the channel doesn't get copied.

When I use the exiftool for the original images I can see the channel information. Why doesn't it get copied?

I use this code to copy information from the original images in one folder (rom\%f.tif) to same named corrected images in another folder (to\):

exiftool -tagsFromFile from\%f.tif -all:all to\

Could you provide help?

Thank you very much in advance!!
Title: Re: copy ALL exif information for multispectral camera
Post by: Phil Harvey on June 22, 2017, 07:33:10 AM
I don't know what you mean by "channel information", but you should take a look at the EXIF Tags documentation (https://exiftool.org/TagNames/EXIF.html) for the specific tags to see if they are writable.  Also see FAQ 2 (https://exiftool.org/faq.html#Q2) if you are having problems determining the tag names.

- Phil
Title: Re: copy ALL exif information for multispectral camera
Post by: Lindsii on June 22, 2017, 08:35:02 AM
Hi Phil,

thank zou very much for your answer.

The camera is a multispectral camera producing 5 images at once in each channel or band specifying the special electromagnetic wavelength spectrum. Like channel blue with wavelength center at 475 and band width 20. I need this information in the corrected images as well. Since I can see these tags in the original data with exiftool it is not clear to me, why this indformation couldn't get copied. I couldn't find the tag in the provided information list.

Is there maybe a workaround, like force all information to get copied or something similiar?
Thank your for your help
Linda
Title: Re: copy ALL exif information for multispectral camera
Post by: Phil Harvey on June 22, 2017, 08:46:01 AM
Hi Linda,

I still have no idea what you are trying to copy.  Can you show me the relevant lines from the output of exiftool -a -G1 -s ?

- Phil
Title: Re: copy ALL exif information for multispectral camera
Post by: Lindsii on June 22, 2017, 09:58:49 AM
Hi Phil,

i see know, that it is XMP infrmation:

[IFD0]          OpcodeList3                     : (Binary data 184 bytes, use -b option to extract)
[XMP-x]         XMPToolkit                      : XMP Core 4.4.0
[XMP-rdf]       About                           : Pix4D Camera Information
[XMP-Camera]    CentralWavelength               : 475
[XMP-Camera]    BandName                        : Blue
[XMP-Camera]    WavelengthFWHM                  : 20
[XMP-Camera]    BandSensitivity                 : 1702040981.6335442
[XMP-Camera]    RigCameraIndex                  : 0
[XMP-Camera]    Yaw                             : -2.8166874111129836
[XMP-Camera]    Pitch                           : -7.0993857082231706
[XMP-Camera]    Roll                            : 16.019641792563799
[ExifIFD]       ExposureTime                    : 1/644
[ExifIFD]       FNumber                         : 2.8
[ExifIFD]       ExposureProgram                 : Program AE
[ExifIFD]       ISOSpeed                        : 400

I need all of the XMP-Camera entries. How to do that?
Thank you so much!

Title: Re: copy ALL exif information for multispectral camera
Post by: Phil Harvey on June 22, 2017, 10:04:56 AM
Ah.  We are talking about XMP not EXIF.

To copy the XMP block (overwriting existing XMP information), you can do this:

exiftool -tagsFromFile from\%f.tif -xmp to\

- Phil
Title: Re: copy ALL exif information for multispectral camera
Post by: Lindsii on June 22, 2017, 10:24:43 AM
Hi Phil,
how amazing, amd that you have time to answer so fast. I am very impressed by you and thak you so much!!!

Just one more thing, then I won't bother anymore:

To extract opcodelist:
[IFD0]          OpcodeList3                     : (Binary data 184 bytes, use -b option to extract)

Is this code enough?
exiftool -b IMG_0002_1.tif
this doesn't give the results:
exiftool -OpcodeList3 -b IMG_0002_1.tif
Thanks again!!
Title: Re: copy ALL exif information for multispectral camera
Post by: Phil Harvey on June 22, 2017, 10:46:22 AM
Quote from: Lindsii on June 22, 2017, 10:24:43 AM
[...] then I won't bother anymore

(that may be overly optimistic)

QuoteTo extract opcodelist:
[IFD0]          OpcodeList3                     : (Binary data 184 bytes, use -b option to extract)

Is this code enough?
exiftool -b IMG_0002_1.tif
this doesn't give the results:
exiftool -OpcodeList3 -b IMG_0002_1.tif

The opcode lists are extracted only in binary format so they will be of limited usefulness.  But to extract it to a file, you would do this:

exiftool -opcodelist3 -b IMG_0002_1.tif > out.dat

- Phil
Title: Re: copy ALL exif information for multispectral camera
Post by: Lindsii on June 22, 2017, 10:50:02 AM
Thanks heaps!!!
I have the binary information to convert them, so I will see how it goes.
Thanks so much
linda
Title: Re: copy ALL exif information for multispectral camera
Post by: Lindsii on June 22, 2017, 11:31:43 AM
Hi Phil,
damn another question, should the content get written out with 0 and 1 or is it possible taht might look similiar like this:

Title: Re: copy ALL exif information for multispectral camera
Post by: Phil Harvey on June 22, 2017, 11:37:31 AM
I'm afraid that I can't make any sense of your last post.
Title: Re: copy ALL exif information for multispectral camera
Post by: Lindsii on June 22, 2017, 11:46:51 AM

Is wonder if this is a possibe output of the opcodelist and if so how to transfer when i have the information about the byte order?

See attachement
Thank you!!
Title: Re: copy ALL exif information for multispectral camera
Post by: Phil Harvey on June 22, 2017, 11:58:24 AM
This looks like a valid opcode list, but I have no information about the opcodes used (which are 0xbe63 and 0xa16f -- the DNG spec only defines opcodes 0x0001 to 0x000d).  The byte order is big endian.

I don't know what you mean by "how to transfer".

- Phil
Title: Re: copy ALL exif information for multispectral camera
Post by: Lindsii on June 22, 2017, 12:12:40 PM
 I mean how to get decimal numbers from that opcode. I just know, that the opcode has 184 bytes and 19 following entries. The first entry is LONG, the others DOUBLE... (Although this is not 184 bytes obviously)...
Title: Re: copy ALL exif information for multispectral camera
Post by: Phil Harvey on June 22, 2017, 12:28:24 PM
Here are some dumps that might help (using two of my utilities):

> hexdump ~/Desktop/out.dat
    0000: 00 00 00 02 00 00 be 63 01 02 00 00 00 00 00 00 [.......c........]
    0010: 00 00 00 54 00 00 00 01 40 96 ba 2d 64 b5 fb 06 [...T....@..-d...]
    0020: 40 96 bc c0 bd 0d 06 c9 bf b9 61 d5 9f 16 44 64 [@.........a...Dd]
    0030: 3f c4 ca f8 55 78 df ec bf b0 4b c2 8b 4b c6 6a [?...Ux....K..K.j]
    0040: be f6 76 0d 10 3d ab 08 3f 3c 7c a1 82 15 15 a0 [..v..=..?<|.....]
    0050: 3f e0 60 20 a8 9a 74 26 3f e0 16 3e 63 ac 91 c7 [?.` ..t&?..>c...]
    0060: 00 00 00 00 00 00 00 00 00 00 a1 6f 01 03 00 00 [...........o....]
    0070: 00 00 00 00 00 00 00 40 be e4 c0 f6 f3 03 cf ef [.......@........]
    0080: be 63 29 22 44 0c 00 a7 be 2f 17 f7 13 ca 8d e5 [.c)"D..../......]
    0090: 3d ab 7e de 1d b2 c6 34 bd 13 25 c4 19 a1 f6 86 [=.~....4..%.....]
    00a0: 3c 62 37 53 b2 83 9b b8 3f e1 80 6f 5b 71 58 c6 [<b7S....?..o[qX.]
    00b0: 3f e1 12 1f 6b c2 91 91                         [?...k...]


> phdump -i ~/Desktop/out.dat
      offset        char    hex       long    short1 short2    float      double      date
-----------------   ---- -------- ----------- ------ ------ ---------- ----------- ----------
       0 00000000   .... 00000002           2      0      2  2.803e-45  4.244e-314 01/01/1970 (0%)
       4 00000004   ...c 0000be63       48739      0 -16797   6.83e-41  1.034e-309 01/01/1970 (2%)
       8 00000008   .... 01020000    16908288    258      0  2.388e-38  8.203e-304 07/15/1970 (4%)
      12 0000000c   .... 00000000           0      0      0          0   4.15e-322 01/01/1970 (7%)
      16 00000010   ...T 00000054          84      0     84  1.177e-43  1.782e-312 01/01/1970 (9%)
      20 00000014   .... 00000001           1      0      1  1.401e-45  2.657e-314 01/01/1970 (11%)
      24 00000018   @..- 4096ba2d  1083619885  16534 -17875       4.71        1455 05/03/2004 (13%)
      28 0000001c   d... 64b5fb06  1689647878  25781  -1274  2.686e+22  1.392e+177 07/18/2023 (15%)
      32 00000020   @... 4096bcc0  1083620544  16534 -17216      4.711        1455 05/03/2004 (17%)
      36 00000024   .... bd0d06c9 -1123219767 -17139   1737   -0.03443  -1.289e-14 05/29/1934 (20%)
      40 00000028   ..a. bfb961d5 -1078369835 -16455  25045     -1.448    -0.09915 10/30/1935 (22%)
      44 0000002c   ..Dd 9f164464 -1625930652 -24810  17508 -3.182e-20 -6.335e-159 06/24/1918 (24%)
      48 00000030   ?... 3fc4caf8  1069861624  16324 -13576      1.537      0.1624 11/26/2003 (26%)
      52 00000034   Ux.. 5578dfec  1433985004  21880  -8212   1.71e+13  5.571e+103 06/11/2015 (28%)
      56 00000038   ..K. bfb04bc2 -1078965310 -16464  19394     -1.377    -0.06366 10/23/1935 (30%)
      60 0000003c   .K.j 8b4bc66a -1957968278 -29877 -14742 -3.925e-32  -2.96e-254 12/16/1907 (33%)
      64 00000040   ..v. bef6760d -1091144179 -16650  30221    -0.4814  -2.142e-05 06/05/1935 (35%)
      68 00000044   .=.. 103dab08   272476936   4157 -21752  3.741e-29  1.911e-230 08/20/1978 (37%)
      72 00000048   ?<|. 3f3c7ca1  1060928673  16188  31905     0.7363   0.0004347 08/15/2003 (39%)
      76 0000004c   .... 821515a0 -2112547424 -32235   5536 -1.095e-37 -1.259e-298 01/22/1903 (41%)
      80 00000050   ?.`  3fe06020  1071669280  16352  24608      1.753      0.5117 12/17/2003 (43%)
      84 00000054   ..t& a89a7426 -1466272730 -22374  29734 -1.715e-14 -4.297e-113 07/16/1923 (46%)
      88 00000058   ?..> 3fe0163e  1071650366  16352   5694      1.751      0.5027 12/17/2003 (48%)
      92 0000005c   c... 63ac91c7  1672253895  25516 -28217  6.367e+21   1.38e+172 12/28/2022 (50%)
      96 00000060   .... 00000000           0      0      0          0           0 01/01/1970 (52%)
     100 00000064   .... 00000000           0      0      0          0  2.042e-319 01/01/1970 (54%)
     104 00000068   ...o 0000a16f       41327      0 -24209  5.791e-41   8.77e-310 01/01/1970 (57%)
     108 0000006c   .... 01030000    16973824    259      0  2.406e-38  8.658e-304 07/16/1970 (59%)
     112 00000070   .... 00000000           0      0      0          0  3.162e-322 01/01/1970 (61%)
     116 00000074   ...@ 00000040          64      0     64  8.968e-44  1.374e-312 01/01/1970 (63%)
     120 00000078   .... bee4c0f6 -1092304650 -16668 -16138    -0.4468  -9.896e-06 05/22/1935 (65%)
     124 0000007c   .... f303cfef  -217853969  -3325 -12305 -1.044e+31 -1.082e+246 02/05/1963 (67%)
     128 00000080   .c)" be632922 -1100797662 -16797  10530    -0.2218  -3.569e-08 02/13/1935 (70%)
     132 00000084   D... 440c00a7  1141637287  17420    167        560   6.457e+19 03/06/2006 (72%)
     136 00000088   ./.. be2f17f7 -1104209929 -16849   6135     -0.171   -3.62e-09 01/04/1935 (74%)
     140 0000008c   .... 13ca8de5   332041701   5066 -29211  5.113e-27  2.465e-213 07/10/1980 (76%)
     144 00000090   =.~. 3dab7ede  1034649310  15787  32478    0.08374    1.25e-11 10/15/2002 (78%)
     148 00000094   ...4 1db2c634   498255412   7602 -14796  4.732e-21  1.274e-165 10/15/1985 (80%)
     152 00000098   ..%. bd1325c4 -1122818620 -17133   9668   -0.03592  -1.701e-14 06/03/1934 (83%)
     156 0000009c   .... 19a1f686   430044806   6561  -2426  1.675e-23  3.303e-185 08/18/1983 (85%)
     160 000000a0   <b7S 3c623753  1013069651  15458  14163    0.01381     7.9e-18 02/07/2002 (87%)
     164 000000a4   .... b2839bb8 -1299997768 -19837 -25672 -1.532e-08  -2.327e-65 10/21/1928 (89%)
     168 000000a8   ?..o 3fe1806f  1071743087  16353 -32657      1.762      0.5469 12/18/2003 (91%)
     172 000000ac   [qX. 5b7158c6  1534154950  23409  22726  6.793e+16  3.078e+132 08/13/2018 (93%)
     176 000000b0   ?... 3fe1121f  1071714847  16353   4639      1.758      0.5335 12/18/2003 (96%)
     180 000000b4   k... 6bc29191  1807913361  27586 -28271  4.704e+26           0 04/16/2027 (98%)


From this you can see that the first two double parameters are 1455 and 1455.

- Phil
Title: Re: copy ALL exif information for multispectral camera
Post by: Lindsii on June 22, 2017, 01:01:18 PM
Wow this is very impressive.
From this I get 21 values of 8 bytes each, I should just have 19. But I will check this.

Thank you 1000000 times, Phil!
Title: Re: copy ALL exif information for multispectral camera
Post by: Lindsii on June 22, 2017, 01:07:58 PM
Thanks very much Phil!

From that I will get 1 Long, and 20 Double values, althoug i just should have 18, but I will see why that is.

Thanks again 100000 times, Phil!!
Title: Re: copy ALL exif information for multispectral camera
Post by: Phil Harvey on June 22, 2017, 01:18:34 PM
There look to be 18 double values:  10 in the first opcode starting at offset 24 (dec), and 8 in the second opcode starting at offset 120 (dec).

- Phil
Title: Re: copy ALL exif information for multispectral camera
Post by: Lindsii on June 22, 2017, 01:54:42 PM
wow this is amazing.
Is the phdump available?

And do you see a possibility to batch this process, for exmaple for a whole folder of images?
Thank you so much!
Title: Re: copy ALL exif information for multispectral camera
Post by: Phil Harvey on June 22, 2017, 02:00:22 PM
I hadn't made phdump available yet, but if you can compile it, here is the source code for you.

To compile with g++, the command is:  g++ -o phdump phdump.cxx

Batching this process would require a bit of programming or fancy scripting I think.

- Phil
Title: Re: copy ALL exif information for multispectral camera
Post by: Lindsii on June 22, 2017, 03:59:18 PM
Thank you so much Phil, you helped me so much, I will write about you in my acknoledgements!!
Title: Re: copy ALL exif information for multispectral camera
Post by: CmdrDaniels on August 30, 2017, 05:16:48 PM
Quote from: Lindsii on June 22, 2017, 10:50:02 AM
Thanks heaps!!!
I have the binary information to convert them, so I will see how it goes.
Thanks so much
linda

Hi!  The information in this thread is very useful!
I am also trying to extract and understand the binary information in this XMP block from the RedEdge metadata.

Lindsii - can you share the information that shows how to convert this binary information to the camera parameters?
Thanks
Title: Re: copy ALL exif information for multispectral camera
Post by: marliesL on October 21, 2020, 11:35:06 AM
Hi

I guess my question is the same than the original but I am using Pythonscripts.

My code reads:
subprocess.call(['exiftool', '-m','-overwrite_original', '-TagsFromFile', "old_im.tif", "new_im.tif"])

Although the coordinates are transferred to the new image, the images are not recognised as multispectral data in Agisoft.
Did I not copy the band information?

Thanks
Grtz

Title: Re: copy ALL exif information for multispectral camera
Post by: Phil Harvey on October 21, 2020, 03:23:35 PM
The OpcodeList tags are marked as unsafe (!) (see here (https://exiftool.org/TagNames/EXIF.html)), so they must be copied explicitly.  You might also want to add -all:all to write the tags in the same locations:

subprocess.call(['exiftool', '-m','-overwrite_original', '-TagsFromFile', "old_im.tif", "-all:all", "-opcodelist1", "-opcodelist2", "-opcodelist3", "new_im.tif"])

There may be other tags you want to add as well.

- Phil
Title: Re: copy ALL exif information for multispectral camera
Post by: marliesL on October 22, 2020, 06:37:02 AM
Hi Phil

Thank you for the quick repsonse.
I get this warning:
Warning: Can't convert value for SubIFD:OpcodeList3 (no PrintConvInv)
The images are still nog recognised as multispectral data. Could the tag, holding this information be, 'ImageLayer' or is it in this OpcodeList3?

Kind regards
Marlies


Title: Re: copy ALL exif information for multispectral camera
Post by: Phil Harvey on October 22, 2020, 08:17:50 AM
Right.  You must copy the unconverted values for these tags (ie. -opcodelist1# -opcodelist2# -opcodelist3#).

As I said, you may need to copy more tags than just these.  You'll have to do a bit of detective work yourself to see what is required.

- Phil