Open EmmanuelMess opened 4 years ago
Do you mean transplant opencv source code? If yes, I tought of this before, but I wasn't capable of build it myself. My idea was to build a custom opencv only with functions needed by ONS and use it.
The aditional download is already solved on embedded-opencv branch and is this one that goes to Google Play and to the releases section of project, with optimiz ed package size. Unfortunately f-droid doesn't support splitted builds yet.
Em 11 de outubro de 2020 15:33:09 BRT, Emmanuel notifications@github.com escreveu:
Move OpenCV to this app and statically link, then remove unused funtions. This would allow for a smaller APK, and the need to download another app.
-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/ctodobom/OpenNoteScanner/issues/237
-- E-mail enviado do meu celular Android usando K-9 Mail. Por favor, desculpe minha brevidade.
Do you mean transplant opencv source code? If yes, I tought of this before, but I wasn't capable of build it myself.
Not really, I mean the library, statically linked to another library, that would then be shipped in the app. What did you try?
This is already done in the embedded-opencv branch. Is is not on master because f-droid doesn't support splitted builds and the apk in fdroid would be huge be cause it needs to contain opencv for every arch supported.
Em 11 de outubro de 2020 17:49:05 BRT, Emmanuel notifications@github.com escreveu:
Do you mean transplant opencv source code? If yes, I tought of this before, but I wasn't capable of build it myself.
Not really, I mean the library, statically linked to another library, that would then be shipped in the app.
-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/ctodobom/OpenNoteScanner/issues/237#issuecomment-706766244
-- E-mail enviado do meu celular Android usando K-9 Mail. Por favor, desculpe minha brevidade.
This is already done in the embedded-opencv branch. Is is not on master because f-droid doesn't support splitted builds and the apk in fdroid would be huge be cause it needs to contain opencv for every arch supported.
Why is it so heavy? Couldn't you just strip unused functions on the second library?
I think I'm understanding now what you suggesting. It is to create a new library that will compile and statically link to the used opencv functions, generating a smaller binary that then will be called from ons. Did I got it?
Do you know how to do this? I tried to build opencv myself without success, so to me it appears to be very hard!
On the embedded-opencv branch, all I did was include the official opencv dynamic libraries inside the apk.
Em 11 de outubro de 2020 19:03:53 BRT, Emmanuel notifications@github.com escreveu:
This is already done in the embedded-opencv branch. Is is not on master because f-droid doesn't support splitted builds and the apk in fdroid would be huge be cause it needs to contain opencv for every arch supported.
Why is it so heavy? Couldn't you just strip unused functions on the second library?
-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/ctodobom/OpenNoteScanner/issues/237#issuecomment-706774421
-- E-mail enviado do meu celular Android usando K-9 Mail. Por favor, desculpe minha brevidade.
I think I'm understanding now what you suggesting. It is to create a new library that will compile and statically link to the used opencv functions, generating a smaller binary that then will be called from ons. Did I got it?
Yes.
Do you know how to do this? I tried to build opencv myself without success, so to me it appears to be very hard!
I know how to compile and install opencv on Ubuntu, and I know how to dinamically link to opencv with a program written in C++. Not much after that. I'll see if I can learn how to do it in the next few days.
Related: https://github.com/VlSomers/native-opencv-android-template
this guide shows how to use the dynamic libraries built by opencv project, this is already done in the embedded-opencv (with a different approach, through the inclusion of a maven dependency that includes the libraries).
Main problem is on how to build a custom opencv dynamic library only with functions needed by Open Note Scanner. I tried to build OpenCV libraries from source without success.
The sdk has the static libraries at sdk/natives/staticlibs/*, no need to recompile OpenCV.
Great, please work on this in a branch, since I will try to propagate changes already made on master branch to the other ones.
I think that main problem can be publishing on f-droid, they don't like code with binaries and static libraries used on build may be activate some antifeatures there, if it is included through maven from another project, it is ok.
I am stuck, having these two issues: Build statically, missing cv::countNonZero(cv::_InputArray const&) and Building OpenCV statically in app fails “error: undefined reference to 'ippicvsRound_64f'”. The time for this project has ended, but will update if some answers come back.
my 50ct regarding this discussion:
I second that this would be an important improvement. When an app asks you for permission to install other Apps, then this is a serious security risk your users need to take in order to use this app. Not many people care when the download is a couple of Megabytes larger, but a lot of people care about the security of their phones.
When the problem is rooted in the fact that OpenCV supports a lot of different architectures and hence provides several architecture-specific apks, then a pragmatic solution would be to also provide multiple architecture-specific apks each containing the matching version of OpenCV for that architecture. This way the download size would be increased only by the size of the one OpenCVs apk, not by all of them and still your app would be usable across all architectures supported by OpenCV. Of course this would make packaging your app a little more complicated, but things like these can be automated.
@whatever42 ... this is already done on the apks available in the releases section of the project and also for app through Google Play... unfortunately F-Droid doesn't allow package bundles and on F-Droid this solution would embed on one apk all the versions of OpenCV.
Move OpenCV to this app and statically link, then remove unused funtions. This would allow for a smaller APK, and the need to download another app.