aardvark-platform / aardvark.algodat

Aardvark.Algodat contains advanced geometric and photometric data structures and algorithms. It is part of the open-source Aardvark Platform for visual computing, real-time graphics, and visualization.
https://aardvarkians.com/
GNU Affero General Public License v3.0
34 stars 6 forks source link

Added prototype support for loading PNG and JPG byte arrays #5

Closed amenzies closed 5 years ago

amenzies commented 5 years ago

This branch contains lightly tested code to load jpeg and png image buffers from e57 files. I'm not terribly familiar with the format but through some reverse engineering I found that a mysterious +16 byte offset had to be applied to the start position specified in the xml header in GetImageBytes(). Perhaps start positions are relative to some header offset I am unaware of?

In any case, I tested against several of these datasets including:

Cheers, -Alex

stefanmaierhofer commented 5 years ago

Hi Alex,

this is great, thanks! We are currently catching up on things (after the Christmas break) and I will come back to you as soon as possible.

Cheers, Stefan

amenzies commented 5 years ago

Thanks Stefan! I did find an issue while testing against some more scans. It appears to be related to the mysterious +16 offset I had to add to the image start position. In some cases this can place the start position in the 4 byte checksum region. Detecting this and then moving to the next non-checksum bit fixed this for the one case I found.

https://github.com/aardvark-platform/aardvark.algodat/blob/1bae64560e082466f1cf05de5938e9f8e500669e/src/Aardvark.Data.E57/ASTM_E57.cs#L2350

This is pretty ugly. I haven't been able to find any technical documentation of the e57 format (nothing free anyway) so I'm doing a lot of reverse engineering here. Perhaps there is an obvious conversion having to do with physical/logical addresses that I am unaware of.

Thanks!

haraldsteinlechner commented 5 years ago

Dear @amenzies,

thanks a lot for your contribution. Unlike most other repositories of aardvark-platform this one is licenced under AGPL as you might have noticed. For this reason, unfortunately we need to handle contributions accordingly (similarly to other repositories with such a licence). I just pushed a file licence agreement. Although this might look discouraging - we like external contributions (also in our more permissive apache/MIT licensed repos), so please send us (info@aardvark.graphics) the filled form in order to finally get your contribution into the next package :heart:

amenzies commented 5 years ago

Sorry for the late reply, license agreement is pretty dense and I'm afraid I'd have to read through it in detail which I don't have the time to do at the moment.

Since this is such a small change perhaps it could be sufficient for me to state in writing here that I release all intellectual property writes and copywrite for this code and give you permission to use it however you like and under whatever license you choose. It's also trivially re-implementable if someone else on the team would like to take that on.

Promise I'm not trying to be difficult here. Really happy to find a library that can read E57s and would love to see this functionality show up in master one way or another.

stefanmaierhofer commented 5 years ago

Merged pull request. Pushed nuget packages 4.5.7. Thanks again @amenzies ! :-)

amenzies commented 5 years ago

Awesome! So happy you guys were able to take the change! Also really grateful to find a C# library out there that can read E57s!

Cheers, -Alex