Clear Filters
Clear Filters

selecting area on a image and Tracking the same area in the next subsequent images automatically

5 views (last 30 days)
I have 12 images in the folder, i want to select area (Basically i want to mark a region and see where those pixels are going in the next subsequent images,We do call ROI) on the first image, this same area to be tracked in the nest subsquent images (These remaining images moves upwards as image number increases ).
How can i do it. Please any one guide me to do this task.
Below images are for your reference (how i wanted to).
As you can see in the image1 marked region, pixels in the image1. Now see the last image marked region is there itself (marked region fixed) but pixels in last image is moved upwards(color portion moved upwards (colour might be different )).
Any leads will be much appriciated.
Thanks in adavance

Accepted Answer

Constantino Carlos Reyes-Aldasoro
Ok, the first part of this problem is rather simple, if I understand correctly, you want to select a region of interest in one image and then have the same region in subsequent images. Say your image is
a = randn(200,60);
Then you can select a region, say that your area of interest is (20:90,20:30)
so define these as the rows and columns
rows=20:90; columns=20:30;
ROI = a(rows,columns);
imagesc (ROI)
now you only need to do the same to all your images.
Now the second part may not be so trivial depending on what you mean by "tracking". But hope this helps you get started.
Constantino Carlos Reyes-Aldasoro
OK, so select one ROI in the first frame with roipoly(), then run a cross correlation as suggested by Image Analyst, that will give you the movement of the ROI (assuming that the ROI is moving and not deforming or changing significantly) and then you can locate the new position of the ROI.

Sign in to comment.

More Answers (1)

Image Analyst
Image Analyst on 12 Jan 2023
You might look into opticalFlow or normxcorr2 (demo attached).

Sign in to comment.




Community Treasure Hunt

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

Start Hunting!