How to detect a moving object robustly?

3 views (last 30 days)
tethys
tethys on 15 Jul 2016
Commented: Image Analyst on 18 Jul 2016
Hi, I have collected some images for Particle Image Velocimetry. In addition to the small particles (which I use to calculate the velocities), I have an additional circular object in the flow, which also moves with the dynamic water surface. I would like to get the centroid of the large circular object, and track it through many images. I have benefited a lot from the forum. However, I could not detect the object in a robust way in all images. I have tried difference of Gaussians with a variety of sigma values, which also did not work effectively. How can I achieve this? Additionally, is there a robust way to detect the coordinates of the moving water surface and exclude the particles (data) above it - making them zero like a dynamic masking?
A = imread(image);
% Equalize contrast
% A = double(A);
% Filtsize = 20; Level = 60;
% domain = ones(Filtsize, Filtsize);
% N = size(domain,1)*size(domain,2);
% low = filter2(domain, ordfilt2(A,1,domain))/N;
% upp = filter2(domain, ordfilt2(A,N,domain))/N;
% contrast = upp-low;
% cont = immultiply(contrast > Level, contrast-Level) + Level;
% A = 64*imdivide((A)-(low),cont);
% A = mat2gray(A);
level = 0.35;
B = im2bw(A,level);
se = strel('disk',2);
C = imdilate(B,se);
D = bwareaopen(C,1000);
E = imfill(D,'holes');
F = edge(E);
radii = 100:10:300;
h = circle_hough(F, radii,'same');
[~,maxIndex] = max(h(:));
[i,j,k] = ind2sub(size(h), maxIndex);
radius = radii(k);
center.x = j;
center.y = i;

Answers (1)

Image Analyst
Image Analyst on 15 Jul 2016
You can pull out the large blob from your binary image with bwareafilt():
largestBlobOnly = bwareafilt(binaryImage, 1);
Then do whatever you want, such as finding it's centroid with regionprops() and storing that centroid location as a function of video frame number.
  2 Comments
tethys
tethys on 18 Jul 2016
Image Analyst, thanks for your response. I tried your suggestion, but since I cannot completely remove the line, I found that the centroid is located on the line. How can I happen to remove the line automatically?
Image Analyst
Image Analyst on 18 Jul 2016
Show me a screenshot. I find it hard to believe that the centroid of the biggest white region would be located on the thin white line, even though it does go through the large roundish white blob.

Sign in to comment.

Categories

Find more on Particle & Nuclear Physics in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!