'How to load an opencv dnn model from memory?

I have a caffemodel and deploy.txt that I would like to load from memory, instead of hard disk. My thoughts are :

1 - to encrypt these files

2 - attached at the end of a library.so (or an executable)

These steps are ready.

Now,

3 - I would decrypt these files (in memory)

4 - I would like to open these dnn model from memory (instead of files)

I know how to do step 3, but no idea about step 4.

So basically how to use cv::dnn::readNetFromCaffe, but instead of files, from memory.

Would appreciate even more if the answer is in C++.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source