I am trying to write a program that uses computer vision techniques to detect (and track) tiny blobs in a stream of very noisy images. My data is of two types: one set of images are not so noisy, which I am just using to try different techniques with, and the other set are noisier, and this is where the detection needs to work at the end. Here are some samples of the higher-noise images. The blobs that need to be detected are the small black spots near the center of the image.

Sample image 1 enter image description here enter image description here

Initially I started off with a simple contour/blob detection techniques in OpenCV, which were not very helpful. Eventually I moved on to techniques such as "opening" the image using morphological operators, and subsequently performing a Laplacian of Gaussian blob detection to detect areas of interest. This gave me better results for the low-noise versions of the images, but fails when it comes to the high-noise ones: gives me too many false positives. Here is a result from a low-noise image (please note input image was inverted).

enter image description here

The code for my current LoG based approach in MATLAB goes as below:

while ~isDone(videoReader)
    frame = step(videoReader);
    roi_frame = imcrop(frame, [660 410 120 110]);

    I_roi = rgb2gray(roi_frame);
    I_roi = imcomplement(I_roi);
    I_roi = wiener2(I_roi, [5 5]);
    background = imopen(I_roi,strel('disk',3));

    I2 = imadjust(I_roi - background);
    K = imgaussfilt(I2, 5);
    level = graythresh(K);
    bw = im2bw(I2);

    sigma = 3;    
    % Filter image with LoG
    I = double(bw);
    h = fspecial('log',sigma*30,sigma);
    Ifilt = -imfilter(I,h);

    % Threshold for points of interest
    Ifilt(Ifilt < 0.001) = 0;
    % Dilate to obtain local maxima
    Idil = imdilate(Ifilt,strel('disk',50));

    % This is the final image
    P = (Ifilt == Idil) .* Ifilt;

Is there any way I can improve my current detection technique to make it work for images with a lot of background noise? Or are there techniques better suited for images like this?


2 Answers 2


I'd recommend looking at the state of the art using deep convolutional neural networks (CNNs) for object localization and detection.

The difference is that a deep CNN architecture facilitates a data-driven approach, where the output of your CNN is a trainable classifier, that with more and different kinds of noisy/scaled/translated/permuted input data, can learn the feature maps that allow the CNN to generalize much better (say to different light & noise conditions) than your hand-engineered features (morph filtering, laplace of gaussians, thresholding) used with a static threshold (0.001)

Start on github.

Convnet used for image classification

  • $\begingroup$ Thanks for the answer, will take a look at your references. Can you comment on how much training data I'd approximately need to adapt CNNs to a visual detection application like this? $\endgroup$ Dec 19, 2016 at 20:30
  • $\begingroup$ have a look at CIFAR-10 (cs.toronto.edu/~kriz/cifar.html), one of the most common training sets, you have 60k images. That said, a few thousand images might be a good place to start, and you'd have a network of an accordingly smaller capacity. Verify first that this is an appropriate tool for your problem domain (ujjwalkarn.me/2016/08/11/intuitive-explanation-convnets) $\endgroup$ Dec 19, 2016 at 21:13

you can try Blob detection in opencv as mentioned here

Be aware of difference between speckle and blob. From your question it is not clear if you want to detect and track speckle or a blob. It would be difficult to collect a good training data for speckles or blobs. I am not sure if blob detection would work on speckles directly. Otherwise, you may try some image resizing or look in windows of 20x20 depending upon your image sizes.


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.