I would like to question the relevance of making OpenCV a mandatory dependency for Spectacle…
I looked in the code, and as far as I understand, it is used to make blur.
To me, it’s like using a blowtorch to light up a cigarette… the dependency is too large and could be avoided in my opinion.
I volunteer for making a change in the code: what I propose is to make OpenCV an optional dependency, if you agree.
But in the meantime, may some developer shed me some light on the reasoning behind this choice?
I looked in the code, and as far as I understand, it is used to make blur.
To me, it’s like using a blowtorch to light up a cigarette… the dependency is too large and could be avoided in my opinion.
I volunteer for making a change in the code: what I propose is to make OpenCV an optional dependency, if you agree.
I’m not a big fan of optional dependencies. They tend to make code more complex for little gain. Sometimes we get bug reports about features missing because they’re optional even though there isn’t a bug. Another complication is that QML has no equivalent to C/C++ preprocessors. You’d need to create a scriptable API to let the UI know that OpenCV is not available and hide all the features that would have something to do with OpenCV.
The installed size of libopencv410 on openSUSE Tumbleweed is 26.3 MiB and opencv is only 318.5 KiB. On Arch, it’s 101 MiB because they include opencv_contrib in their opencv package, so they could reduce the size of their package. Unless you’re removing more than 50 MiB, saving space isn’t a good reason to make something optional to me. That amount of space is just not a serious concern for most users especially when the libraries can be shared with other apps.
I’d rather switch dependencies if necessary, but there would be some requirements. See the bug report conversation linked above.
So this means I have your approval to submit a pull request to make OpenCV optional?
You don’t need to ask for permission to submit an MR. The contents of the MR will determine whether or not it is approved.
Personally I disagree about your take on optional dependencies, especially in this case because currently, OpenCV is used too sparingly to justify such inclusion in Spectacle… switching could be the solution indeed…
What would you think of my draft of merge request that make OpenCV optional and I’ve written alternative code for when it’s not found, using only the Qt library (QGraphicsBlurEffect for blurring, etc)?
It’s certainly perfectible, ultimately I would understand if you prefer to reject it.
P.S: I found two functions that seems to be unused. boxBlur and fastPseudoBlur… I erased it, I hope I have done well.