Image analysis of irregular shape of binary image
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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](https://www.mathworks.com/matlabcentral/answers/uploaded_files/471872/Image%20extracted%20from%20vedio%20vs%20binary%20.jpeg)
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](https://www.mathworks.com/matlabcentral/answers/uploaded_files/471877/0.jpeg)
![0.5 second](https://www.mathworks.com/matlabcentral/answers/uploaded_files/471877/0.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/471882/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/471887/image.jpeg)
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.
Réponses (2)
Rohit Pappu
le 30 Déc 2020
To analyse the region of interest, Image Segmentation can be done. Image Segmentation tutorial can be found here
0 commentaires
Image Analyst
le 30 Déc 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));
0 commentaires
Voir également
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!