Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Photo taking/tagging/submitting from within OwnTracks app #824

Open
jpmens opened this issue Nov 19, 2024 · 8 comments
Open

Photo taking/tagging/submitting from within OwnTracks app #824

jpmens opened this issue Nov 19, 2024 · 8 comments

Comments

@jpmens
Copy link
Member

jpmens commented Nov 19, 2024

Would it be technically possible to take photographs from within the OwnTracks iOS app (Android would follow suit if feasable) which are then either submitted via MQTT (or HTTP if that is the selected transport) tagged in such a way (EXIF data?) that there can be a direct association between the picture and the OwnTracks location?

I'm thinking along the lines of:

  • open OwnTracks app
  • take photo
  • photo is tagged and transmitted via MQTT to broker (i.e. then to Recorder), maybe as topic /pic where it is stored
  • payload contains base64-encoded photograph, location, current tag and/or current PoI if set.

This might be quite a bit of work, but possibly a neat feature to have, and in fact somebody at #geomobNL recently actually asked for this.

@ckrey
Copy link
Member

ckrey commented Nov 21, 2024

Yes!

First thoughts:

We could either take a photograph or select an existing photograph from the photo library. This would be similar to the process to create a card. With the photograph we could require a "POI" to be entered.

As the next step, we would

  • either send a location message which includes a thumbnail of the image "img":<base64-encoded-thumbnail> and treat is as we do currently with PoI data. We could display the thumbnails on the map... In this case, I would recommend to resize the image to a smaller size e.g. 192x192 pixels as we do for cards.

  • Or we could send the full size image to a special subtopic (e.g. owntracks/<user>/<device>/img). The payload of this message would be the same as a location message, except a "img":<base64-encoded-full-size-image> key/value pair.

  • or somehow link the full size image information to the location message

@jpmens
Copy link
Member Author

jpmens commented Nov 21, 2024

or somehow link the full size image information to the location message

Is it possible to manipulate / augment the EXIF data in a taken photograph with, say, a designated UUID which is could be submitted with the location message to later associate location with the image?

@ckrey
Copy link
Member

ckrey commented Nov 21, 2024

I can extract the original filename e.g. IMG_1255 and put this into the location message.
How would you transmit the actual photo? Via the app or the way you transfer your photos normally?
If you do it via OwnTracks, we could create an UUID and use it both in the location and the image playload.

@jpmens
Copy link
Member Author

jpmens commented Nov 23, 2024

I suspect the taken photograph would remain on the iPhone storage which it should.

Its filename or UUID would be transported in a _type:photo message to the broker at an owntracks/<user>/<device>/img ideally with the current location in it (lat, lon should suffice).

I would suggest the _type:photo has an encoding:base64 tag (maybe one day distinct encodings will be possible) and an "img":<base64-encoded>" photo.

@ckrey
Copy link
Member

ckrey commented Nov 26, 2024

POC:
IMG_1351
IMG_1352

Result:

{
  "tst": "2024-11-26T08:26:09.475577+0000",
  "topic": "owntracks/ck00/iPhoneSE/image",
  "qos": 0,
  "retain": 0,
  "payloadlen": 4342432,
  "payload": {
    "_type": "image",
...
    "image": "/9j/4TorRXhpZgAATU0AKgAAAAgADAEPAAIAAAAGAAAAngEQAAIAAAAbAAAApAESAAMAAAABAAYAAAEaAAUAAAABAAAAwAEbAAUAAAABAA
    "imageName": "IMG_1333",
...
    "lat": 51.196003,
    "lon": 6.688493,
    "poi": "Gans",
    "t": "u",
    "tid": "SE",
...
  }

base64-encoded .jpeg includes EXIF data, etc.:

Bildschirmfoto 2024-11-26 um 09 34 41

But... recorder does not like long payloads (.rec file is correct):

stderr: "invalid strptime format on \/n9aAIvLHr+n\/16ABI+eT\/..."

@jpmens
Copy link
Member Author

jpmens commented Nov 26, 2024

It looks a bit as though curry is on me tomorrow evening!

@jpmens
Copy link
Member Author

jpmens commented Nov 26, 2024

stderr: "invalid strptime format

probably due to falling through as we don't yet have code for _type: image

@jpmens
Copy link
Member Author

jpmens commented Nov 27, 2024

So, after discussion, I think we've settled on:

  • _type: location message will contain poi as well as base64-encoded thumbnail of an image selected from the photo library.
  • in addition the payload will contain the photo's filename as generated by iOS' camera
  • Recorder will extract the thumbnail and store it so it can be viewed from the file system if so desired, similarly to how we currently process faces in a CARD.

That way, people can shoot a photo, then upload a POI location with a thumbnail of the photo. In theory, the thumbnail can be displayed on the map and hopefully Android and Frontend will at some stage have the capabilities of displaying the thumbnail for the location likewise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants