EnoxSoftware / OpenCVForUnity

OpenCV for Unity (Untiy Asset Plugin)
https://assetstore.unity.com/packages/tools/integration/opencv-for-unity-21088
557 stars 175 forks source link

Is there a reason that the SimpleBlobDetector class is not wrapped? #38

Closed MattijsKneppers closed 5 years ago

MattijsKneppers commented 5 years ago

It looks like SimpleBlobDetector, that is part of the OpenCV 4.0.x package, is not in OpenCVforUnity. Is this intentional or could this be an oversight?

MattijsKneppers commented 5 years ago

Interestingly, you did wrap a Params class that seems to be the equivalent of cv::SimpleBlobDetector::Params in OpenCV. As far as I can see this Params class is currently never used in OpenCVForUnity.

Maybe I am missing something though, in that case it would be great if you could point me in the right direction.

EnoxSoftware commented 5 years ago

Since this package is a clone of OpenCV Java, you are able to use the same API as OpenCV Java 4.0.0. So, SimpleBlobDetector class is not supported for now. The Params class is currently never used as you pointed out. I plan to fix this bug in a future version. https://docs.opencv.org/4.0.0/javadoc/org/opencv/features2d/Params.html Also, Since OpenCV is open source, it is possible to refer to SimpleBlobDetector's algorithm. https://github.com/opencv/opencv/blob/master/modules/features2d/src/blobdetector.cpp

MattijsKneppers commented 5 years ago

Thanks for the quick reply and for clarifying, it is especially useful to know that looking at the Java version docs is most useful to understand the Unity port.

rubentorresbonet commented 5 years ago

Did you manage to port it @MattijsKneppers ? I am in need of that class. Thanks

MattijsKneppers commented 5 years ago

I did, however I'd need to properly test it for more general use and maybe make an example before I do a pull request. Or I could just do a pull request with the file as is and leave it up to the authors to test and integrate. @EnoxSoftware would you have a preference?

rubentorresbonet commented 5 years ago

I can definitely help with testing with my use case if you share a PR or temporal pastebin.

MattijsKneppers commented 5 years ago

Here are the files in a zip, just taken straight out of the project without any testing:

SimpleBlobDetector.zip

rubentorresbonet commented 5 years ago

Thanks, I will let you know how it is on my side!

rubentorresbonet commented 5 years ago

The biggest flaw I found was the findblob is using the input image and not its binary version. After fixing that I got some results. However, the python implementation is quite superior. I didnt have time to pinpoint exactly where the issue comes from.

MattijsKneppers commented 5 years ago

findblob is using the input image and not its binary version

Hey, nice catch! It worked for me, but now it will likely work better. In fact I don't see why the original image is passed in at all in the original code.

For the archives here is the fixed version. SimpleBlobDetector V2.zip

However, the python implementation is quite superior

I tried to do a literal port of the original code, but if you ever find out what is different that makes the python version work better, I'd love to know!

ZyanyaNochipa commented 5 years ago

Hi @MattijsKneppers

Thanks for your work, it works for me.