-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add contour angle to contours report #915
base: master
Are you sure you want to change the base?
Add contour angle to contours report #915
Conversation
* | ||
* @param <T> the type of held data | ||
*/ | ||
public class LazyInit<T> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So there are no thread safety guarantees offered? Is this intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping!
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 |
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 |
Angle is from minAreaRect, and is in the range [-90, 0) Rework contours operations to be a bit more functional Make filter contours a bit more optimized
d870e8b
to
5efa91e
Compare
Codecov Report
@@ 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 |
* | ||
* @param factory the factory to use to create the held value | ||
*/ | ||
public LazyInit(Supplier<? extends T> factory) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you don't make this expose a constructor, it doesn't tightly couple this to needing to be newed.
*/ | ||
public void clear() { | ||
value = null; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why should you be able to clear a lazy?
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 withOptional
Add a utility class for streaming Java-fied
std::vector
types such asMatVector
as JavaStream
objects. This currently just supportsMatVector
, but can be added to in the future.