add tag
I am working on a project that uses OpenCV SVMs. The code is executed on mobile devices (Android, iOS) and x86_64 desktops.
Usually, the SVMs are exported in a YAML or XML file format which is then parsed by OpenCV itself.

Especially for the mobile devices, I'd like to avoid using these text files for two reasons:

1. They are huge. This could be somewhat alleviated by compression, but they need to be uncompressed for loading, so the memory of the device can become a bottleneck.
2. They have to be parsed, which is rather slow for larger files.

Hence, I'd like to embed the data such that I basically have a preloaded SVM in memory.

How would I go about this? How can I embed the floats with the correct endianess for each platform?

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.