Image analysis of irregular shape of binary image
조회 수: 2 (최근 30일)
이전 댓글 표시
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.
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.
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.
답변 (2개)
Rohit Pappu
2020년 12월 30일
To analyse the region of interest, Image Segmentation can be done. Image Segmentation tutorial can be found here
댓글 수: 0
Image Analyst
2020년 12월 30일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Convert Image Type에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!