Add morphology operation#874
Conversation
Codecov Report
@@ Coverage Diff @@
## master #874 +/- ##
===========================================
+ Coverage 51.71% 51.81% +0.1%
- Complexity 1158 1160 +2
===========================================
Files 247 248 +1
Lines 7812 7862 +50
Branches 533 533
===========================================
+ Hits 4040 4074 +34
- Misses 3591 3607 +16
Partials 181 181 |
|
I'm good with this. I assume you tested this and it worked the way you wanted? |
|
Yeah. Although I'm not sure how you feel about my hard coded enums. I couldn't figure out where to get that value from since the other ones use 'generated' code but I can't find it. |
|
How do I add things to code generation? It's not very useful without it |
| @@ -0,0 +1,14 @@ | |||
| @staticmethod | |||
| final int kernelType = typeSocket.getValue().get().value; | ||
|
|
||
| outputSocket.setValue(opencv_imgproc.getStructuringElement(kernelType, new Size(widthValue, | ||
| heightValue))); |
There was a problem hiding this comment.
Won't this allocate a new matrix every time this perform method is called.
Don't you instead want to pass in an existing matrix so the memory can be reused?
There was a problem hiding this comment.
Ideally you'd create the kernel once with all the variables, but idk how to get that behavior.
Do you mean the Size matrix?
There was a problem hiding this comment.
There should be an overload that takes a dest as a parameter.
There was a problem hiding this comment.
I'm not sure I understand. Is there an example in the code I can copy?
There was a problem hiding this comment.
Unfortunately no.
What we are trying to avoid is allocating new memory on every call.
So there should be an alternative method called getStructuringElement that takes an additional arg called dest. You can pass a pre-allocated matrix so we aren't allocating more memory on every call.
There was a problem hiding this comment.
It's december of the next year, which means it's my turn to comment 😂
Going back and looking through this, I understand what we are going for, but not sure how that functionality is created in GRIP. The kernel creating isn't part of the pipeline, just the setup, although I think i'm combining the code generation with the actual application..lemme see what I can come up with for the application part and then I'll worry about code gen later
|
So i updated the python code to alleviate this I think. Instead of putting the function in process, it puts it in |
|
@SamCarlberg Do you have any time to finish up this PR? I don't really at this exact moment. |
This adds the opencv
morphologyExfunction. More info here