Skip to content

Commit

Permalink
add dnn module
Browse files Browse the repository at this point in the history
  • Loading branch information
rainyl committed Mar 3, 2024
1 parent 898061e commit e77d416
Show file tree
Hide file tree
Showing 25 changed files with 1,149 additions and 236 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/dart_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
dart run opencv_dart:setup -p linux -a x64
- name: Run tests
run: flutter test -x skip-workflow
run: flutter test -x skip-workflow,no-local-files

test_windows:
runs-on: windows-latest
Expand All @@ -49,4 +49,4 @@ jobs:
run: |
$env:PATH = "${{github.workspace}}\windows;${env:PATH}"
echo "PATH=$env:PATH" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
flutter test
flutter test -x no-local-files
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ __pycache__
*.lib
.cache/
small2.mp4
test/models/

# Files and directories created by pub
.dart_tool/
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 0.6.0

* add `dnn` module
* add more friendly error message, use `cv.registerErrorCallback();` before potential error occurring.
* change return shape of `Mat.toList()` from `(cols, rows)` to `(rows, cols)`

## 0.5.0

* add `asyncarray`
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ prebuilt binaries.
| videoio | :white_check_mark: | :white_check_mark: | VideoIO module |
| asyncarray | :white_check_mark: | :white_check_mark: | AsyncArray module |
| calib3d | :white_check_mark: | :white_check_mark: | Calib3D module |
| dnn | :x: | :x: | DNN module |
| dnn | :white_check_mark: | :white_check_mark: | DNN module |
| photo | :white_check_mark: | :white_check_mark: | Photo module |
| cuda | :x: | :x: | CUDA module |
| contrib | :x: | :x: | Contrib module |
Expand Down
30 changes: 0 additions & 30 deletions example/test/widget_test.dart
Original file line number Diff line number Diff line change
@@ -1,30 +0,0 @@
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility in the flutter_test package. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';

import 'package:example/main.dart';

void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(const MyApp());

// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);

// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();

// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
2 changes: 2 additions & 0 deletions ffigen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ headers:
- src/gocv/calib3d.h
- src/gocv/core.h
- src/gocv/dnn.h
- src/gocv/exception.h
- src/gocv/features2d.h
- src/gocv/highgui_gocv.h
- src/gocv/imgcodecs.h
Expand All @@ -34,6 +35,7 @@ headers:
- src/gocv/calib3d.h
- src/gocv/core.h
- src/gocv/dnn.h
- src/gocv/exception.h
- src/gocv/features2d.h
- src/gocv/highgui_gocv.h
- src/gocv/imgcodecs.h
Expand Down
6 changes: 4 additions & 2 deletions lib/src/core/asyncarray.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ library cv;
import 'dart:ffi' as ffi;

import 'package:ffi/ffi.dart';
import 'package:opencv_dart/src/core/cv_exception.dart';

import '../core/exception.dart';
import '../core/base.dart';
import '../core/mat.dart';
import '../opencv.g.dart' as cvg;
Expand All @@ -16,6 +16,8 @@ class AsyncArray implements ffi.Finalizable {
finalizer.attach(this, ptr);
}

factory AsyncArray.fromPointer(cvg.AsyncArray ptr) => AsyncArray._(ptr);

factory AsyncArray.empty() {
final _ptr = _bindings.AsyncArray_New();
return AsyncArray._(_ptr);
Expand All @@ -29,7 +31,7 @@ class AsyncArray implements ffi.Finalizable {
final dst = Mat.empty();
final result = _bindings.AsyncArray_GetAsync(ptr, dst.ptr);
final dartStr = result.cast<Utf8>().toDartString();
if (dartStr.length > 0) throw OpenCvDartException("$dartStr");
if (dartStr.isNotEmpty) throw OpenCvDartException(dartStr);
return dst;
});
}
Expand Down
1 change: 1 addition & 0 deletions lib/src/core/core.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import '../opencv.g.dart' as cvg;

final _bindings = cvg.CvNative(loadNativeLibrary());


/// get version
String openCvVersion() {
final v = _bindings.openCVVersion().cast<Utf8>().toDartString();
Expand Down
45 changes: 0 additions & 45 deletions lib/src/core/cv_exception.dart

This file was deleted.

Loading

0 comments on commit e77d416

Please sign in to comment.