How do I use cross correlation to detect the Position of a particle in a 130x296x3 double struct (3 frames)
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Gucci
el 26 de Mzo. de 2022
Comentada: Image Analyst
el 29 de Mzo. de 2022
I have to select a region where a particle is located and than track the movement of the particle across a number of frames. (3 frames in the uploaded file)
The tracking program needs to use cross correlation techniques, to find the centroid of the particle and its movement across all frames.
Finally, I need to obtain each centroid (x, and y, coordinates across all images).
I have attempted to do this but the only help I can find is for a stack of .tif images, however my images are of double format, as in the title.
I have also uploaded a file called my_mat_file.mat, and this contains a 130x296x3 struct called 'ims' which is the struct containing the 3 images. Please see if you can work with this... The way to open the first image is to load the mat file, and then use the command as follows:
imagesc(ims(:,:,1))
0 comentarios
Respuesta aceptada
Image Analyst
el 27 de Mzo. de 2022
See my normalized cross correlation demo. Adapt as needed.
2 comentarios
Image Analyst
el 29 de Mzo. de 2022
%============================================================================================================================================
% Initialization Steps.
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format short g;
format compact;
fontSize = 15;
markerSize = 40;
s = load('my_mat_file.mat')
rgbImage = s.ims;
subplot(2, 2, 1);
imshow(rgbImage);
impixelinfo
axis('on', 'image')
grayImage = rgb2gray(rgbImage);
subplot(2, 2, 2);
imhist(grayImage);
grid on;
mask = grayImage > 9000;
mask = bwareafilt(mask, 1); % Take largest blob only.
subplot(2, 2, 3:4);
imshow(mask);
impixelinfo
% Find weighted centroid
props = regionprops(mask,grayImage, 'WeightedCentroid')
xCentroid = props.WeightedCentroid(1);
yCentroid = props.WeightedCentroid(2);
hold on;
plot(xCentroid, yCentroid, 'r+', 'LineWidth', 2, 'MarkerSize', markerSize)
subplot(2, 2, 1);
hold on;
plot(xCentroid, yCentroid, 'r+', 'LineWidth', 2, 'MarkerSize', markerSize)
Más respuestas (0)
Ver también
Categorías
Más información sobre Explore and Edit Images with Image Viewer App en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!