Eliminated threaded version. Now we are doing process only over a small part of the image around the beads. 450X450 pixels in size. Time cost reduced considerably. The non-showing version costed almost 3 minutes when applied to the whole picture. Now it is costing about 45-50 seconds. In the same way the showing version costed more than 4 minutes and now costs only 2 minutes.