How to change detection parameters of a "SimpleBlobDetector" instance in runtime?

Hi there,

I have the following code which is insensitive to any change on the parameters on the following code:

// Declaration
public static SimpleBlobDetector simpleBlobDetector ;
public static Params params;

// Instantiation ( I don’t know how to link ‘params’ instance here )
simpleBlobDetector = SimpleBlobDetector.create();

params.set_filterByArea (true);
params.set_minArea(BlobAreaMin);
params.set_maxArea(BlobAreaMax);

The only way I could do that was by reading/writing the parameters as this:

simpleBlobDetector.read(“PARAMETERS.TXT”);

…which is a quite weird approach, since it makes access to filesystem, which adds unwanted overhead to overall processing.

So, how could I do that by using the methods “set_filter_…” available on OpenCV library ?

Thanks in advance,
Andre.

create the params before the detector, and pass them as arg to

SimpleBlobDetector.create(params);

https://docs.opencv.org/4.x/javadoc/org/opencv/features2d/SimpleBlobDetector.html#create(org.opencv.features2d.SimpleBlobDetector_Params)