Image analysis of irregular shape of binary image

9 views (last 30 days)
ying zhou
ying zhou on 27 Dec 2020
Answered: Image Analyst on 30 Dec 2020
Hello everyone,
I am very new to matlab and data analysis. My question might have some related answers but not all applicable to my questions. I have video of stretching transparent membrane with cross polarizers. Basically, If membrane is being stretched, there is stress inside membrane so light can penetrate through it. I extract image from video and use threshold to turn it into binary image. Figure 1 shows the comparison of image directly extracted from video and image after im2bw.
Image extracted from vedio vs binary
However, because the edge will reflect some light and the edge of the membrane is irreguular, it is difficult for me to know the height and area of the region where membrane is being stretched. I would like to know the length and area of the center region where there is light penetration. Following figures are my goal. 0.5 second
Also, it is a continuous process with around 1000 images so I want to export it continuously.
Thank you for your reading and I am looking forward to your advice.

Answers (2)

Rohit Pappu
Rohit Pappu on 30 Dec 2020
To analyse the region of interest, Image Segmentation can be done. Image Segmentation tutorial can be found here

Image Analyst
Image Analyst on 30 Dec 2020
Is the width (left and right) always the same? If so you can just look between certain columns of the image and get the average or max extent in the vertical direction.
[rows, columns] = size(mask);
topRows = zeros(1, columns);
bottomRows = zeros(1, columns);
for col = column1 : column2
row = find(mask(:, col), 1, 'first');
if ~isempty(t)
topRows(col) = row;
row = find(mask(:, col), 1, 'last');
bottomRows(col) = row;
end
end
% Get rid of zeros
topRows(topRows == 0) = [];
bottomRows = bottomRows(bottomRows > 0); % just a different way
% Draw lines across and compute means.
meanTopRow = mean(topRows);
yline(meanTopRow, 'Color', 'r', 'LineWidth', 2)
meanBottomRow = mean(bottomRows);
yline(meanBottomRow, 'Color', 'r', 'LineWidth', 2)
meanHeight = mean(bottomRows - topRows)
message = sprintf('The mean height is %f pixels', meanHeight)
uiwait(helpdlg(message));

Community Treasure Hunt

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

Start Hunting!

Translated by