フィルターのクリア

How do I use cross correlation to detect the Position of a particle in a 130x296x3 double struct (3 frames)

3 ビュー (過去 30 日間)
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))

採用された回答

Image Analyst
Image Analyst 2022 年 3 月 27 日
See my normalized cross correlation demo. Adapt as needed.
  2 件のコメント
Gucci
Gucci 2022 年 3 月 29 日
編集済み: Gucci 2022 年 3 月 29 日
@Image Analyst can you take look at the 3 images I uploaded on the post, I have tried to modify the normxcorr2 example code but I do not know how to implement it for all 3 images in my stack.
i need to track the displacement of the particle on each and compare to the previous one
can view each one using:
imagesc(ims(:,:,1));
imagesc(ims(:,:,2));
imagesc(ims(:,:,3));
Image Analyst
Image Analyst 2022 年 3 月 29 日
%============================================================================================================================================
% 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)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeExplore and Edit Images with Image Viewer App についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by