Opening and finding distance between circles in multiple images from a Tiff Stack

조회 수: 2 (최근 30일)
I am trying to write a code that would allow me to calculate the distance between circles in 100 images all from one .tif file. I was able to get the code to work for the first image in the stack, and am now stuck on how to get the code to look at the other 99 images in the stack. Any ideas?
Also, after computing the distance on all of the images, I want matlab to give me a matrix with all of the data, how do I do that?
Here is what I have so far:
a = imread('My_image.tif');
bw = a > 40000;
imshow(bw)
[centersBright,radiiBright,metricBright] = imfindcircles(bw,[20 25], ...
'ObjectPolarity','bright','Sensitivity',0.92,'EdgeThreshold',0.1);
stats = regionprops('table',bw,'Centroid',...
'MajorAxisLength','MinorAxisLength');
centers = stats.Centroid;
distance = pdist2(centers(1,:),centers(2,:));

채택된 답변

Pujitha Narra
Pujitha Narra 2020년 2월 26일
Hi,
You can use indexing along with 'imread' like this:
a = imread('My_image.tif', i); % ith image in the stack
Using this with a loop would help.
For the second part, you could use concatenation like this:
distance = [];
% Calculate the values for a new image
distance = [distance; new_values]; % Concatenate it the existing data
Hope that helps!

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by