GRIP
GRIP copied to clipboard
Add contour angle to contours report
Angle is from minAreaRect, and is in the closed range [-90, 0]
Rework contours operations to be a bit more functional
Make filter contours a bit more optimized
Add a LazyInit class for lazily creating objects, instead of using a bizarre pattern with Optional
Add a utility class for streaming Java-fied std::vector types such as MatVector as Java Stream objects. This currently just supports MatVector, but can be added to in the future.
Just want to make sure we're not unintentionally introducing any memory leaks with this logic. Are there any native pointers that are created in these new stream operations that need to be cleaned up?
The stream operation itself doesn't allocate anything - it's just standard indexed iteration. A new RotatedRect array is created for each contour report object, but the impact in native memory is minimal and the garbage collector can easily handle it.
Reminder, the garbage collector has no idea how large native objects truly are, so it can leave them around for far longer than you think it will.
If there is a clean place to de-allocate them after usage, please do so. Otherwise, it's fine.
Right. The C++ class is small (only holds a few numbers), so the memory impact is low. We also prompt the garbage collector every few seconds so I'm not too worried
Codecov Report
Merging #915 into master will increase coverage by
0.11%. The diff coverage is29.09%.
@@ Coverage Diff @@
## master #915 +/- ##
============================================
+ Coverage 52.86% 52.98% +0.11%
Complexity 1 1
============================================
Files 327 329 +2
Lines 8852 8869 +17
Branches 560 555 -5
============================================
+ Hits 4680 4699 +19
+ Misses 3969 3967 -2
Partials 203 203