Access opencv RidgeDetectionFilter in a groovy script

Is it possible to use opencv.ximgproc functions? I have tried to import org.opencv.ximgproc.RidgeDetectionFilter without success.

Best regards,


What exactly did you try and what happened?

Edit: Tested it and see this

// Import works
import org.opencv.ximgproc.RidgeDetectionFilter

// Methods available
println describe(RidgeDetectionFilter)

// Fails with unsatisfied link
try {
    RidgeDetectionFilter.create(0, 0)
} catch (Throwable t) {
    println t

QuPath is using OpenCV via JavaCPP. I don’t see a way to access RidgeDetectionFilter successfully.

(I have been coding up a different ridge detection/enhancement method that might make it into a future QuPath version, but that is at least some months away. I tend to stay away from the ximproc module.)

1 Like

I have tried:

import org.opencv.ximgproc.RidgeDetectionFilter


def rf = new RidgeDetectionFilter()

Runtime error: javax.script.ScriptException: groovy.lang.GroovyRuntimeException: Could not find matching constructor for: org.opencv.ximgproc.RidgeDetectionFilter()

The error indicates that you should use

def rf = RidgeDetectionFilter.create()

…but as my last post shows, that doesn’t work either (you can ignore the 0,0 bit since I think there are multiple forms for the create method).