Skip to content

Commit a6e17cc

Browse files
authored
Revise contribution instructions for OpenCV modules
Updated contribution guidelines for adding new OpenCV modules and documentation.
1 parent cc0237c commit a6e17cc

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

CONTRIBUTING.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,18 @@
1111

1212
If you want to add new opencv API/Module,
1313

14-
1. build [libdartcv](https://github.com/rainyl/dartcv/blob/main/README.md) from source
15-
2. add new C wrappers in `src` and make sure it is correctly build
16-
3. add your `.h` file to ffigen in [dartcv4](https://github.com/rainyl/opencv_dart/tree/main/packages/dartcv) and run `dart run ffigen --config ffigen.yaml`
17-
4. add corresponding dart code in [lib](https://github.com/rainyl/opencv_dart/tree/main/packages/dartcv/lib)
18-
5. write testing code and test whether it works as expected
19-
20-
Note: C wrappers should be added to [dartcv](https://github.com/rainyl/dartcv) and dart bindings should be added to [dartcv4](https://github.com/rainyl/opencv_dart/tree/main/packages/dartcv)
14+
1. take a look at OpenCV official documents and make sure the required functions/modules are absent in opencv_dart
15+
2. the native C/C++ code is managed by CMake, you will find a `CMakeLists.txt` in `packages/dartcv/src`
16+
3. add new C wrappers in `packages/dartcv/src/dartcv` and make sure it is correctly build, Note:
17+
- take a look at the existed code, especially `packages/dartcv/src/dartcv/core/types.h` which defines basic structures
18+
- if you want to add new modules, create a new directory in `packages/dartcv/src/dartcv`, e.g., `packages/dartcv/src/dartcv/cuda`
19+
- nearly all C-wrappers of C++ class/struct are wrapped in a struct, you can define a C wrapper of a C++ class via `CVD_TYPEDEF`, e.g., `CVD_TYPEDEF(cv::Mat, Mat)`
20+
4. add your `.h` file to ffigen in [dartcv4](https://github.com/rainyl/opencv_dart/tree/main/packages/dartcv/ffigen) and run `dart run ffigen --config ffigen.yaml`, this will generate corresponding dart:ffi wrappers.
21+
5. add corresponding dart code in [lib](https://github.com/rainyl/opencv_dart/tree/main/packages/dartcv/lib)
22+
6. write testing code and test whether it works as expected, you can refer to [OpencvSharp](https://github.com/shimat/opencvsharp) and [gocv](https://github.com/hybridgroup/gocv) to write tests.
23+
24+
~~Note: C wrappers should be added to [dartcv](https://github.com/rainyl/dartcv) and dart bindings should be added to [dartcv4](https://github.com/rainyl/opencv_dart/tree/main/packages/dartcv)~~
25+
Since `2.x`, C/C++ code are embeded to this (opencv_dart) repo and no longer needed to develop separetely, just implement your C/C++ code in `packages/dartcv/src/dartcv` and it will be processed by dart native hooks.
2126

2227
## Contribute to Documentation
2328

@@ -31,9 +36,8 @@ For Windows:
3136

3237
1. `git clone https://github.com/rainyl/opencv_dart`
3338
2. cd `opencv_dart/packages/dartcv`
34-
3. install dependencies and add dynamic library path to PATH environment variable.
39+
3. install dependencies via `dart pub get` ~~and add dynamic library path to PATH environment variable.~~
3540
4. now write new dart tests and place them in `test/` directory.
3641
5. run `dart test`
37-
6. (Optional) add the **absolute** path of opencv_dart/windows to PATH environment variable, which can ebable the testing sidebar of VSCode.
3842

3943
Other platforms are similar.

0 commit comments

Comments
 (0)