|
6 | 6 | for JPEG/PNG/TIFF guards against the codecs building but silently no-op'ing - or hanging - on |
7 | 7 | wasm (#2043). libjpeg-turbo/libpng/libtiff use setjmp/longjmp for error handling, which hung |
8 | 8 | (rather than threw) when OpenCvSharpExtern.a was built with a different Emscripten version than |
9 | | - the one the .NET wasm SDK links it with; see EM_VERSION in .github/workflows/wasm.yml. *@ |
| 9 | + the one the .NET wasm SDK links it with; see EM_VERSION in .github/workflows/wasm.yml. A |
| 10 | + Cv2.Dnn.BlobFromImage call exercises the dnn module's native wrapper without needing a trained |
| 11 | + model file on disk, guarding against the OpenCV build config showing dnn as built while the |
| 12 | + wasm wrapper actually fails to link or crashes at runtime. *@ |
10 | 13 |
|
11 | 14 | <pre id="result" data-status="@status">@status: @detail</pre> |
12 | 15 |
|
|
40 | 43 | throw new InvalidOperationException($"ImDecode({ext}) round trip failed: empty={decoded.Empty()}, size={decoded.Size()}"); |
41 | 44 | } |
42 | 45 |
|
| 46 | + // Exercises the dnn module's native wrapper (cv::dnn::blobFromImage) without loading a trained |
| 47 | + // model file - just confirms the wasm build actually links and runs dnn, not merely that OpenCV's |
| 48 | + // CMake config reports it as built. |
| 49 | + using var blob = Cv2.Dnn.BlobFromImage(mat, size: new Size(64, 64)); |
| 50 | + if (blob.Empty()) |
| 51 | + throw new InvalidOperationException("Cv2.Dnn.BlobFromImage produced an empty blob"); |
| 52 | + |
| 53 | + var blobShape = string.Join('x', Enumerable.Range(0, blob.Dims).Select(blob.Size)); |
| 54 | + |
43 | 55 | status = "ok"; |
44 | | - detail = $"OpenCV {version}, ORB keypoints: {keypoints.Length}"; |
| 56 | + detail = $"OpenCV {version}, ORB keypoints: {keypoints.Length}, dnn blob shape: {blobShape}"; |
45 | 57 | } |
46 | 58 | catch (Exception ex) |
47 | 59 | { |
|
0 commit comments