필터 지우기
필터 지우기

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 CenterFile Exchange에서 Explore 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