Image object detection for image quality testing via sckit

Sample images

1 3 2


Hi all,
I’m working to develop some code that is part of an image quality test that can detect whether various rectangular inserts of varying widths in an test image phantom are visible or not. So a low contrast resolution test basically.

I’m trying to figure out what’s the best approach/algorithm for doing that.

Some of the caveats are

  • the inset may not be in exactly the same position in each image (however approximately the same)
  • the orientation and size will, however, always be constant
  • I’m using sckit, and do not have openCV available

Analysis goals

Each test image has a set of 5 different inserts of varying thicknesses, and I’d like an end result to say which is the thinnest visible insert in that particular image test.

My ideas

  • use sckit match_template as I know each inserts size/orientation to try to match, and a check if it’s a ‘good enough’ match
  • simply use numpy to do an averaged profile along the orientation of the inserts, and check if there is a peak with minumum height discernable from the background noise


For this type of problem, what other ideas or approaches might be usable?


Hi Richard,
I did not really understand the goal is it to tell if the inserts are visible, or to find the thinnest one ?

For the first option, I would first smooth the image to reduce noise (ex: mean filter) and maybe computing the variance of the images or image-regions could allow distinguish between visible (high variance = higher object/background contrast) and invisible inserts (low variance: “everything is dark”).

If you have several insert per image, then indeed localizing individual inserts (with template matching or else) would be necessary to have a measure of variance for each insets.
I made a multi-template matching implementation, that allow the simultaneous search with multiple templates to allow matching different sizes and orientations.
Maybe that can help. However the original version uses opencv.
I also have a branch with scikit image only, which you could potentially install with pip providing the URL of the branch, but I did not really push it further so I am actually not sure that it fully works.

I think properly calibrated, non-local means would be the best tool for denoising here. (Short of deep-learning based approaches.)

Thanks - I’ll try that out!

Thanks Juan,

The scikit non local means does indeed do a good job at cleaning up the noise!