Skip to content

Arminea/Particle-detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Particle detection - image processing

author: Tereza Štanglová

Table of contents

Particles' generator

This is the first step of whole process. You can specify the number of particles. The particles' sizes are random, between 10 and 25 pixels. The particles' positions are also random. The particles can overlap each other. When particles overlap they seems to look like one. The final image is an input for particle detection.

Area

Algorithm:

  1. Analyze the image line by line and search for red points (pixels).
  2. Check the area around the red point.
  3. If there is another red point in the area around, add its coordinates to the stack. Change the color of the current point to the color of background (black in this case).
  4. Is the stack empty?
  • No - Pop the first element and go to 2.
  • Yes - End.

Perimeter

At this stage we know the coordinates of all points of each particle. This knowledge can be used for detection of internal boundaries of particles (perimeter). Internal boundary can be detect by erosion - morphological transformation. Internal boundary is defined by:

Hr = A \ (A ⊖ B),

where A is a matrix of points for each particle, B is a kernel (structuring element) and ⊖ is a vector difference.


Kernel for erosion.

Points of input image are called foreground pixels. Each foreground pixel is superimposed by the structuring element on top of the input image. If for every pixel in the structuring element, the corresponding pixel in the image underneath is a foreground pixel, then the input pixel is left as it is. Pixels that were removed are a part of the internal boundary.


1. Original image.

2. Kernel application on point (1;1).

3. The result of kernel application.

4. Final result of erosion.

Automatic particle counting

The following methods are used for counting particles.

Simple method

For this method we have to know the number of particles N and theirs area Ai. The area of each particle is compared to reference area Aref. Aref is the average area of all Ai.

Estimation of particles' multiplicity ni is defined by:

Then the estimated number of particles Particlessingle can be computed as:

If Ai area is smaller than Aref area, then ni=1. That could be a problem.

Methods for Aref selection:

  • Median.
  • The upper quartile.
  • The lower quartile.

Histogram method

For this method we have to know the number of particles N and theirs area Ai. The next step is to create a histogram of Ai distribution.

Algorithm:

  1. Divide the histogram into intervals , which will have a size q.

2. Select an interval with most particles. 3. Select *Aref* as a lower limit or a middle value of interval. 4. For each particle, if *Ai > Aref*, calculate its multiplicity *nj*. For smaller particles *nj=1*.

5. Then the estimated number of particles *Particlessingle* can be computed as:

Method of circular tracks

For this method we need to define circularity of objects. Circularity is the measure of how closely the shape of an object approaches that of a circle. The higher it goes, the less circular it is. Circularity in descrete space can be defined as:

Algorithm:

  1. For each particle calculate Ai, Pi and VOLi (parameter of circularity) defined by:

,

where *C* is a constant. *C* is approximately *4π*.
  1. Calculate a reference area Aref of particles where Round(VOLi)=1

  1. For each Ai calculate a multiplicity wi defined by:

  1. The estimated number of particles Particlesi in Ai can be computed as:

,

where *k* and *l* are constants that can be changed. Default value is 1.
  1. Then the estimated number of particles Particlessingle can be computed as:

Results

In the table below, one can see results for different number of particles. In the first section are compared the number of particles generated and the number of particles found. With the increasing number of particles generated is reduced the number of particles found. It is caused by overlapping of particles.

Simple method had the best result with median. Lower and upper quartile proved to be not very useful.

Histogram method proved to have better result with increasing number of intervals. But there was also a limit for that number. After that limit, the effectiveness of this method rapidly declined.

Method of circular tracks had the best result with k and l = 1.

Particles
Generated 10 50 75 100 125 150 175 200
Found 10 47 60 82 89 102 114 125
Simple method
Average 10 47 60 82 88,99 102 113,9 124,9
Median 10,14 48,33 67,65 83,33 103,46 122,03 143 158,8
Lower quartile 15,65 80,11 132 157,54 195,58 271,62 318,27 255,8
Upper quartile 8,63 35,23 39,74 69,28 66,56 70,31 90,1 94,61
Histogram method (param: number of intervals)
n=3 2,15 33,75 38,92 36,48 59,29 78,56 84 100
n=5 6 42,93 59,28 59,93 91,93 128,44 129,3 147,42
n=8 6 6,1 70,82 74,22 132 163,43 163,42 197,85
Method of circular tracks (params: k and l)
k=1, l=1 10 53 79 103 126 157 183 190
k=1, l=10 11 50 70 97 126 147 174 188
k=1, l=50 11 46 67 94 120 150 176 180
k=10, l=1 10 50 72 93 116 134 165 172
k=50, l=1 10 50 71 93 114 131 162 169

User documentation

User interface is devided to two sections. The first section includes a preview image. The second section includes all control buttons.

  1. In the first box you can enter a number of particles that will be generated on canvas. The box contains button for generating particles, saving and loading image.
  2. The number of particles, perimeters and areas are computed after generating.
  3. In the Simple method box you can choose a method for Aref selection.
  4. In the Histogram method box you can enter a number of intervals.
  5. In the Circularity box you can enter values for k and l constants.

Easter egg

If you start the program with command line argument deadpool, random particles will look like a little Deadpool.

About

Particle detection (image processing)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages