view centroid in a video

Knowing the coordinates of the centroid as I could see it in the video I tried to use hold on followed by plot point, but it does not work

Respuestas (1)

Image Analyst
Image Analyst el 20 de Dic. de 2013

0 votos

Can you use the Computer Vision System Toolbox to do tracking http://www.mathworks.com/products/computer-vision/description5.html ?

14 comentarios

luigi
luigi el 20 de Dic. de 2013
I have to make a graphic of the various centroids moving
Image Analyst
Image Analyst el 20 de Dic. de 2013
Then use the Computer Vision System Toolbox. Did you see the examples where they put boxes around the moving things they tracked? You just do the same thing except put up a dot or cross or some other symbol at the centroid. If you don't have that toolbox and can't afford it, let me know. It can be done with the Image Processing Toolbox alone.
luigi
luigi el 20 de Dic. de 2013
I have the Image Processing Toolbox.where I can see these examples?
Image Analyst
Image Analyst el 20 de Dic. de 2013
I'd have to custom make one for you. I might be able to get to it today if you want.
luigi
luigi el 20 de Dic. de 2013
I have a video with objects movimento.Ogni object has a centroid. By using the centroid have to make a graph for each centroid, but the first step is to be able to view the centroid in the video. Using this as an example:http://www.mathworks.it/it/help/vision/examples/motion-based-multiple-object-tracking.html
Image Analyst
Image Analyst el 20 de Dic. de 2013
Alright, good, You say that you already have the centroid stored in your object - your "movimento.Ogni" structure. So then simply do this to plot the centroid over the image:
hold on;
plot(xCentroid, yCentroid, 'r*', 'MarkerSize', 25, 'LineWidth', 3);
luigi
luigi el 21 de Dic. de 2013
thank you so much. I'll try and let you know
Image Analyst
Image Analyst el 21 de Dic. de 2013
Not sure if you were able to do it so I made a demo for you. See attached demo below in blue text.
luigi
luigi el 22 de Dic. de 2013
I have a structure. In this structure, there are a variety of information including the centroid. To view the video and the mask I use two objects of type vision.VideoPlayer. how can I plot the centroid?
Image Analyst
Image Analyst el 22 de Dic. de 2013
Editada: Image Analyst el 22 de Dic. de 2013
luigi, did you actually download and run my test3.m file I created for you? If you had, you would see that I have a structure, and I plot the centroid of the blobs over the blobs. This is just what you asked for, twice. Please run my video and you'll have your answer. Look - I extracted the relevant portion for you. Here it is:
% Label the blobs.
labeledImage = bwlabel(binaryImage, 8); % Label each blob so we can make measurements of it
% Get all the blob properties. Can only pass in originalImage in version R2008a and later.
blobMeasurements = regionprops(labeledImage, 'Centroid');
numberOfBlobs = size(blobMeasurements, 1);
if numberOfBlobs >= 1
blobMeasurementsCentroids = [blobMeasurements.Centroid];
xCenters = blobMeasurementsCentroids(1:2:end);
yCenters = blobMeasurementsCentroids(2:2:end);
hold on;
% Mark centroid with a star inside a circle.
plot(xCenters, yCenters, 'r*', 'LineWidth', 2, 'MarkerSize', 20);
plot(xCenters, yCenters, 'ro', 'LineWidth', 2, 'MarkerSize', 20);
hold off;
promptMessage = sprintf('Do you want to Continue processing,\nor Cancel to abort processing?');
titleBarCaption = 'Continue?';
button = questdlg(promptMessage, titleBarCaption, 'Continue', 'Cancel', 'Continue');
if strcmpi(button, 'Cancel')
return;
end
end
luigi
luigi el 24 de Dic. de 2013
I tried to adapt your code to mine, but I couldn't.This is my piece of code: newTrack = struct(... 'id', nextId, ... 'bbox', bbox, ... 'kalmanFilter', kalmanFilter, ... 'age', 1, ... 'totalVisibleCount', 1, ... 'consecutiveInvisibleCount', 0,... 'centroide',centroids);
centro=tracks(i).centroide;
centrox=centro(1:2:end);
centroy=centro(2:2:end);
hold on;
plot(centrox,centroy, 'r*', 'LineWidth', 2, 'MarkerSize', 20);
But it does not work as I would like
luigi
luigi el 24 de Dic. de 2013
I have this function insertObjectAnnotation I have this function and I put the coordinates of the centroid with the symbol *, it gives me error
Image Analyst
Image Analyst el 24 de Dic. de 2013
You forgot to post the error. Post all the red text. But I don't have that toolbox so I may not be able to help much.
luigi
luigi el 24 de Dic. de 2013
i have matlab2013

Iniciar sesión para comentar.

Categorías

Etiquetas

Preguntada:

el 20 de Dic. de 2013

Comentada:

el 24 de Dic. de 2013

Community Treasure Hunt

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

Start Hunting!

Translated by