I am trying to develop a simple image processing mobile application using the
Ionic Framework (version 4). I decided to use the
OpenCV.js library and the way I am adding it to my
ionic project is:
I put the
"scripts": [ "src/assets/lib/opencv.js" ]
- I put
declare var cv: any;on top of any ts file that I needed to use the opencv library in and then I just use cv to reference an opencv.js function like for example
My application works well in the browser, as well as on some test devices (I’ve tried
Galaxy Note 10 ,
Galaxy S8 ,
Galaxy S6 ). However, when I try to run the application on a
Samsung Galaxy S5 , the app shows an error on the console upon startup:
Uncaught ReferenceError: WebAssembly is not defined
and then, when I click a button that calls anything related to openCV I get the following message:
ERROR Error: Uncaught (in promise): ReferenceError: cv is not defined
And of couse the
openCV functinality does not work. I realize it must be something related to the phone being pretty old, but I would like to know exactly the reason why it works on other phones but does not on this one. And maybe, if it is possible, it would be great to find out what can be done to make it work on this and other phones like this.
It is a
Samsung Galaxy S5 with
Android 5.0 .
Also I do not really understand why WebAssembly is required in this particular case. I thought the opencv.js file that I downloaded from here
https://docs.opencv.org/master/opencv.js was just a JS file that contains the necessary functions (like a lib). How does webassembly come into play here?