@@ -7,7 +7,7 @@ to detect the bounding box of a Sudoku puzzle given an image from a newspaper or
77goes on to solve the puzzle and show the solution.
88
99It works pretty well but the OpenCV.js file is very big. I have managed to get it down to about 4 MB from 8 MB by
10- exlcuding some bits that I am not using. However, it occurred to me that if I could move the bounding box code
10+ excluding some bits that I am not using. However, it occurred to me that if I could move the bounding box code
1111from JavaScript to C++ and then build it as a WebAssembly, the overall result might be smaller.
1212
1313> ** UPDATE:** This isn't the final version of the code but results so far are encouraging - my
@@ -67,7 +67,7 @@ npm run build:wasm
6767
6868# Running
6969
70- This assumes that you have already cloned and built OpenCV as described above.
70+ The following sections assume that you have already cloned and built OpenCV as described above.
7171
7272## Running a local server
7373
@@ -100,6 +100,28 @@ This will automatically rebundle when a change is made to files of type .js, .ht
100100If you change a C++ source file, you will have to explicitly re-run ` npm run build:wasm ` .
101101The resulting WebAssembly should then be automatically rebundled.
102102
103+ # Unit Tests
104+
105+ I have added a single unit test so far. This can be run from the command line or a web browser
106+ (inspired by chapter 13 of [ WebAssembly in Action] ( https://www.manning.com/books/webassembly-in-action ) ).
107+
108+ The following sections assume that you have already cloned and built OpenCV as described above.
109+
110+ ## Running unit tests from the command line
111+
112+ ```
113+ npm run build
114+ npm test
115+ ```
116+
117+ ## Running unit tests from a web browser
118+
119+ ```
120+ npm run build
121+ PORT=3434 npm start
122+ open http://localhost:3434/tests.html
123+ ```
124+
103125# Links
104126
105127* https://github.com/mpizenberg/emscripten-opencv.git
0 commit comments