You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Git: pass `-P` or `--no-pager`, or pipe to `Out-String`; e.g. `git --no-pager diff`
63
63
- Use `cat` for displaying file contents.
64
+
65
+
## Adding a new OpenCV class wrapper
66
+
67
+
> **Scope**: This checklist covers `cv::SomeClass : cv::Algorithm` subclasses. OpenCV also has classes that do **not** inherit from `Algorithm` — those may follow different ownership and lifetime patterns (see existing non-Algorithm wrappers such as `BackgroundSubtractor` or classes in `core/` for reference).
68
+
69
+
Follow this checklist when wrapping a new `cv::SomeClass : cv::Algorithm` class:
// C# side — [MarshalAs(UnmanagedType.Bool)] makes bool marshal as 4-byte BOOL matching int in C
163
+
[StructLayout(LayoutKind.Sequential)]
164
+
public struct SomeClassParams {
165
+
[MarshalAs(UnmanagedType.Bool)] public bool SomeBool;
166
+
// other fields...
167
+
}
168
+
// P/Invoke: out SomeClassParams / ref SomeClassParams
169
+
```
170
+
171
+
### Namespace access note
172
+
173
+
From `namespace OpenCvSharp.Internal`, types in `namespace OpenCvSharp` are directly visible (outer scope rule). Types in a sub-namespace such as `namespace OpenCvSharp.XImgProc` are NOT — add an explicit `using` directive in the NativeMethods file when referencing structs defined there.
-`std::vector<Vec6d>` → `VectorOfVec6d` (added in EdgeDrawing PR)
181
+
- New vector types: add `#pragma region` in `std_vector.h`, `#region` in `NativeMethods_stdvector.cs`, and create `VectorOfXxx.cs`
182
+
183
+
### EdgeDrawing as reference implementation
184
+
185
+
See `src/OpenCvSharpExtern/ximgproc_EdgeDrawing.h`, `src/OpenCvSharp/Modules/ximgproc/EdgeDrawing.cs` for a complete example covering: factory, OutputArray methods, std::vector methods, nested Params struct with bool fields, and VectorOfVec6d.
0 commit comments