rainyl / opencv_dart

OpenCV bindings for Dart language and Flutter. Support Asynchronous Now!
https://pub.dev/packages/opencv_dart
Apache License 2.0
112 stars 14 forks source link

Improve the performance of at and set, add Mat.atU8, Mat.setU8, etc. #58

Closed rainyl closed 4 months ago

rainyl commented 4 months ago

Releated:

simple perf test:

Mat(3840, 2160, CV_8UC1).at: 6937ms
Mat(3840, 2160, CV_8UC1).atU8: 4701ms
Mat(3840, 2160, CV_8UC1).set: 6188ms
Mat(3840, 2160, CV_8UC1).setU8: 3124ms

Maybe faster with Native Assets:

00:10 +305 ~2: test\core\mat_test.dart: Mat at set perf
Mat(3840, 2160, CV_8UC1).at: 6394ms
Mat(3840, 2160, CV_8UC1).atU8: 4512ms
Mat(3840, 2160, CV_8UC1).set: 5258ms
Mat(3840, 2160, CV_8UC1).setU8: 2829ms

at: Mat.atU8, Mat.atI8, Mat.atU16, Mat.atI16, Mat.atI32, Mat.atF32, Mat.atF64

set: Mat.setU8, Mat.setI8, Mat.setU16, Mat.setI16, Mat.setI32, Mat.setF32, Mat.setF64

Mat.set support native types, e.g., Mat.set()

In previous version, determine the Mat type is very expensive, but considering the mat type may change after creation, so it has to be get from native pointer, which costs lots of time, so for performance sensitive occasions, use atU8/setU8-like API.

codecov-commenter commented 4 months ago

Codecov Report

Attention: Patch coverage is 81.44330% with 18 lines in your changes are missing coverage. Please review.

Project coverage is 88.76%. Comparing base (66fa454) to head (f24dab0).

Files Patch % Lines
lib/src/core/mat.dart 81.44% 18 Missing :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #58 +/- ## ========================================== + Coverage 88.65% 88.76% +0.11% ========================================== Files 34 34 Lines 4777 4789 +12 ========================================== + Hits 4235 4251 +16 + Misses 542 538 -4 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.