1
$\begingroup$

I'm very new to Python and I need to draw vectors between dark and light spots on an image. Ive managed to convert it to greyscale but I'm struggling with identifying the dark and light spots. If I can identify the co-ordinates of the centre of the bright spots then I should be able to draw a vector on. The aim is to get it to work on an image with one pair of spots then extend this to multiple pairs.

Thanks to anyone who helps.

enter image description here

$\endgroup$
2
  • $\begingroup$ What is a "blob" in this case? It might be as easy as thresholding between the extremal values or require something more complex such as texture features (?) $\endgroup$
    – A_A
    Oct 4, 2018 at 11:21
  • $\begingroup$ Are you using whatever computer vision library (e.g. openCV, ITK ... )? Such frameworks inherently have methods to return image properties, you could therefore use them to get the darkest and lightest spot and then draw a line using Python. $\endgroup$
    – avazula
    Oct 4, 2018 at 11:52

1 Answer 1

2
$\begingroup$

The keyword here is blob detection. Search OpenCV blob detection and I'm sure there are many examples.

One of the common methods is to use the Laplacian of Gaussian operator. The Laplacian is a measure of the strength of the second-order derivatives. If you think of the blobs as peaks and valleys on a 3D surface, at the middle of the blobs the slope (derivative) of the surface is changing (second derivative) rapidly from negative to positive and vice-versa.

The Gaussian is there to average out this measurement over a wider area. Any area averaging kernel could be used, but the Gaussian is special* in that increasing the size of the kernel does not introduce any new features. Using multiple kernels creates a scale space, and allows you do scale invariant blob detection.

*I think the Poisson kernel can create a scale-space too with a slight rule relaxation.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.