Display time with milliseconds - page 2 - Feature Requests - CHDK Forum supplierdeeply

Display time with milliseconds

  • 19 Replies
  • 10833 Views
Re: Display time with milliseconds
« Reply #10 on: 16 / May / 2012, 19:24:58 »
Advertisements
Thanks Phil, the idea was to turn on the camera, take of picture of a GPS output (20Hz precision timing) in order to have the reference time. Then process with a python script all the subsequent picture info compared to the reference picture to generate a GPS time of the week in milliseconds.
There must be a better way to go but that's the only one that came to my mind.
The pictures will actually be shot in DNG... could the SubSecTime be added through a script of does it require a modification of the code itself ?

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: Display time with milliseconds
« Reply #11 on: 16 / May / 2012, 19:32:43 »
The pictures will actually be shot in DNG... could the SubSecTime be added through a script of does it require a modification of the code itself ?

Doing it in the DNG code would be fairly straightforward so long as a suitable milliseconds value is available or can be calculated.

By the time you get to run a script the image capture time is long past so determining the correct value would be quite hard.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

Re: Display time with milliseconds
« Reply #12 on: 16 / May / 2012, 19:46:46 »
Yes that's was i was afraid of with the script...
I've looked at EXIF documentation, since the SubSecTime type is ASCII (and count = any) could i simply push the get_tick_count value into the SubSecTime tag ?

Re: Display time with milliseconds
« Reply #13 on: 16 / May / 2012, 20:42:40 »
get_tick_count returns the number of milliseconds since the camera was last started.
You would also need a reference time point (i.e. the time the camera was started) in order to convert the get_tick_count value to an actual time
I've looked at EXIF documentation, since the SubSecTime type is ASCII (and count = any) could i simply push the get_tick_count value into the SubSecTime tag ?
Seems like a simple exercise to convert the returned values from get_time() to tics and add that to get_tic_count as your scipt runs  ?
Ported :   A1200    SD940   G10    Powershot N    G16


*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: Display time with milliseconds
« Reply #14 on: 16 / May / 2012, 21:31:35 »

Seems like a simple exercise to convert the returned values from get_time() to tics and add that to get_tic_count as your scipt runs  ?


This would only work if you always use the script and the script takes the image - even then there will be a large discrepancy between the script call to get_time and the actual image time.

To get the most accurate value would require capturing the image time milliseconds value in the CHDK code.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

Re: Display time with milliseconds
« Reply #15 on: 16 / May / 2012, 21:49:29 »
Seems like a simple exercise to convert the returned values from get_time() to tics and add that to get_tic_count as your scipt runs  ?

The main problem is that there is no precise way to set the camera time, i think the best way to go is not bother with time and use only tick_count and do the post processing from a reference image.

To get the most accurate value would require capturing the image time milliseconds value in the CHDK code.

I will have a look at the code... Phil maybe you have a lead so i can get off on the right foot ?

Thanks.

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: Display time with milliseconds
« Reply #16 on: 16 / May / 2012, 22:05:34 »

I will have a look at the code... Phil maybe you have a lead so i can get off on the right foot ?


In core/dng.c.
You would need to add the SubSecTime tag to the exif_ifd arrray and set the value in capture_data_for_exif() - there is code in there already setting the capture date/time so you should set SubSecTime at the same point.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: Display time with milliseconds
« Reply #17 on: 18 / May / 2012, 20:31:34 »
I've done some investigation into this.

The return value from the 'time()' function is in seconds so you need to use the 'get_tick_count()' function to get a sub second time value - this is only accurate to 1/100th of a second though.

I've added the SubSecTime and SubSecTimeOriginal tags to the DNG header using the following logic:
- at startup wait until time() ticks over to the next second value, grab the get_tick_count() value to calculate the tick count offset when the time() value changes.
- when the time() value is recorded for the DNG image header, also record the get_tick_count() value
- use the get_tick_count() value,  offset by the amount calculated at startup, to calculate the SubSecTime value

Since get_tick_count() is only accurate to 1/100th second I'm only storing 2 digits in SubSecTime.

This seems to work, when I load DNG images into Lightroom the created time shows the SubSecTime.

I'll add this to SVN shortly in the trunk version.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)


Re: Display time with milliseconds
« Reply #18 on: 22 / May / 2012, 16:10:40 »
That's wonderful Phil... good approach, much better of course that what i've started to do.
10 ms resolution is a huge improvement, very nice to have this feature on CHDK.
I will try to compile from trunk and let you know the results.
Thank you all for your support !

*

Offline fudgey

  • *****
  • 1705
  • a570is
Re: Display time with milliseconds
« Reply #19 on: 27 / May / 2012, 17:19:30 »
I suppose this is related:

http://chdk.setepontos.com/index.php?topic=5783.msg56561#msg56561

Of course, note that the old patch there may or may not apply to current source without modification (I didn't check).

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal