colour-checker-detection icon indicating copy to clipboard operation
colour-checker-detection copied to clipboard

[FEATURE]: Adaptive samples count

Open roshameow opened this issue 3 years ago • 2 comments

Description

I noticed that in segmentation.py/detect_colour_checkers_segmentation the samples is a passed in parameter. Would it be more natural if we instead pass in the ratio of samples/colorchecker to adapt different checkerboard size?

This line can be modified as following: https://github.com/colour-science/colour-checker-detection/blob/develop/colour_checker_detection/detection/segmentation.py#L1097

samples_ratio=4
samples = int(np.sqrt(height*width/(swatches_h*swatches_v))/samples_ratio)
masks = swatch_masks(width, height, swatches_h, swatches_v, samples)

roshameow avatar Sep 19 '22 06:09 roshameow

Hi @roshameow,

Sorry for the late reply, this slipped through the many cracks!

We tend to like knowing how much samples are being processed in my field, that said we could have a utility function to compute them so that they could be passed a bit more easily this way.

Cheers,

Thomas

KelSolaar avatar Oct 06 '22 08:10 KelSolaar

Hi Thomas,

I see your concern here. Are you talking about a utility function like

def get_sample_by_ratio(height, width, swatches_h, swatches_v, samples_ratio=0.25):
    return int(np.sqrt(height*width/(swatches_h*swatches_v))*samples_ratio)

and add flag like "use_sample_ratio" in the parameter dict? I totally agree.

Also much thanks for your work. It did speed up a lot when I was doing a color correction process.

roshameow avatar Oct 06 '22 11:10 roshameow