Tracking displacement of objects from a stationary point in an image
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
WARNING: I am VERY new to MATLAB so I apologise if this question is naive.
I currently have images (300+) such as the one attached with scattered 'black' markers. Throughout the series of images, the markers move in one direction and in fairly small amounts. The goal is to determine a stationary point (chosen by the user) then find the initial distance between the stationary marker and every other marker, then find how much each marker is displaced in reference to that stationary point.
I was able to loop through all the images and detect all the markers in each by finding their centroids. I then saved them each into cells using:
cent{i} = centroids.
I also was able to let the user choose a stationary point by using:
figure, imshow(firstImage);
stationaryPoint = ginput(1);
Now I am trying to sort out how to find that initial distance then loop through all the images and find how much that distance changes by. Any advice would be more than helpful. Thanks!
0 Commenti
Risposte (1)
Image Analyst
il 3 Ago 2017
Try this
% Threshold the image
binaryImage = grayImage < 128;
% Label
[labeledImage, numRegions] = bwlabel(binaryImage);
% Find centroids.
props = regionprops(labeledImage, 'Centroid');
xyCentroids = [props.Centroid]; % [x1,y1,x2,y2,x3,y3,x4,y4,.....]
xCentroids = xyCentroids(1:2:end);
yCentroids = xyCentroids(2:2:end);
[x,y] = ginput(1);
distances = sqrt((xCentroids - x) .^ 2 + (yCentroids - y) .^ 2);
That gets the distance of every black blob's centroid to the point the user specifies with ginput().
4 Commenti
Vedere anche
Categorie
Scopri di più su Image Processing Toolbox in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!