2

I need some help. I have this sample:

enter image description here

which is a piece of plastic with some nanoparticles inside (you can see the small black dots). Can someone help me figure out a quick and dirty algorithm where I can find the particles and color them in another color.

Bart Kiers
  • 166,582
  • 36
  • 299
  • 288
Markus
  • 2,526
  • 4
  • 28
  • 35
  • 8
    I cannot even find the boundaries of those particles manually - looks more or less like a big blur to me. Perhaps you should enhance contrasts and run an edge detection filter first, using some standard imaging software, before trying to apply any algorthm. – Doc Brown Sep 22 '11 at 19:36
  • 2
    *"quick and dirty algorithm"*? In image processing? :-) Man, you are trying to do the task at the bleeding edge of current CS! But I like the naivity. Like: "I do two for loops and that's it .. :-)". – Tomas Sep 22 '11 at 19:42
  • A histogram stretch might help as well (especially if the whiter regions near the left and right edges are cropped like @Ed Staub writes) – Throwback1986 Sep 22 '11 at 20:11
  • I'm sure this is extremely magnified, but we've no idea what a nanoparticle looks like in this image. Can we actually see some here? If possible, highlight some on the image, or just describe, being sure to say roughly how many pixels across they are in the image (unscaled). – Ed Staub Sep 22 '11 at 23:22
  • Is the "black" of the specks chromatically different from the "black" at the edges of the sample? Could you simply reassign "black" to some other color? Can you get an image of a similar sample that has no particles? – Beta Sep 23 '11 at 00:12
  • 3
    Before you do anything else - if possible, get a better image, with improved focus, contrast, and brightness. Will the edges on left and right be pre-cropped out of the image? If not, are they in a fixed position, so that they can effectively be pre-cropped by the algorithm? – Ed Staub Sep 22 '11 at 19:35
  • If this is a visible light image, then those particles are not "nano". If it is an electron image (SEM or TEM), perhaps, but you can't really tell. You need to play with your sample preparation to spread them out more, and play with focus and contrast to get the edges right. Note that contrast can vary extremely dependent on the crystal orientation (think about bragg condition). – Svante Sep 23 '11 at 05:38
  • related: http://stackoverflow.com/questions/5298884/finding-number-of-colored-shapes-from-picture-using-python http://stackoverflow.com/questions/3684484/peak-detection-in-a-2d-array – jfs Sep 23 '11 at 06:17
  • 2
    Here comes my 2 cents. First of all, this is the images we have and we can not make new ones. Secondly, the resolution (not pixel size) is around 40 nm, and it is an X-ray image. The particles in question are simple the small dark areas, they are not very big. Because it is an X-ray image and the sample therefore is partially transparent it is not as simple as recoloring black to read because particles denser areas will be darker because of density difference rather that because of a particle – Markus Sep 23 '11 at 06:48
  • 2
    @Markus: Don't comment on your own question. Update the question with a new information. – jfs Sep 23 '11 at 12:19
  • We can get around the density problem, but you haven't really answered the question so I don't have enough information to tell whether this approach will work. – Beta Sep 25 '11 at 21:15

3 Answers3

1

Quick and dirty... OK :)

  1. [optional] blur it even more
  2. find local minimums which:
    • are <= any neighbour in some radius (the radius should be close to expected radius of a particle)
    • 2.2. are <= (average-threshold), this threshold is for filtering out false detections due to noise
maxim1000
  • 6,297
  • 1
  • 23
  • 19
  • Thank you, it is something like this I am looking for. It does not have to be perfect or fast. – Markus Sep 23 '11 at 06:43
0

You say quick 'n dirty, but given this is matlab you probably won't notice a difference between the best solution and a "quick and dirty one". Here is what is probably straight-up the best way to accomplish the task: Scale-space blob detection. Using the laplacian method is the simplest.

Start by Gaussian-blurring you image with a sigma close to that of your expected nano particle standard deviation: IE a quarter of its screen width.

Then your blobs will be the points where the Laplacian is most-negative; ensuring that it has greater magnitude than its surrounding points followed by a simple thresholding will do. To see how to implement this in matlab go to:

http://dl.acm.org/citation.cfm?id=363419.363423

It will only be about 10 lines of code.

Also, remember to work on a logarithmic (decibel) scale as you are dealing with transmission rather than reflection.

DanielOfTaebl
  • 713
  • 5
  • 13
0

This isn't in Matlab, but the WolframBlog covered something like this for Mathematica and it may suit your needs.

rcollyer
  • 10,475
  • 4
  • 48
  • 75