Find end to end distance of fusing droplets

조회 수: 3 (최근 30일)
Archishman Ghosh
Archishman Ghosh 2020년 4월 28일
답변: Archishman Ghosh 2020년 4월 28일
I have a series of images of fusing droplets. I would like to get the horizontal end to end distance of the fusing droplets. This distance shortens over time as the two droplets fuse.
I have tried the regionprops boundingbox approach but it doesn't seem to work. Several tiny rectangles form around the droplets. Perhaps the image needs to be cleaned up after turning into binary.
Does anyone have an alternative approach to this?
function [] = boundingbox(file,level)
image=imread(file);
figure
BW=im2bw(image,level);
BW = ~BW;
imshow(BW)
st = regionprops(BW, 'BoundingBox' );
for k = 1 : length(st)
thisBB = st(k).BoundingBox;
rectangle('Position', [thisBB(1),thisBB(2),thisBB(3),thisBB(4)],...
'EdgeColor','r','LineWidth',2 )
end
end

답변 (1개)

Archishman Ghosh
Archishman Ghosh 2020년 4월 28일
This works only for images with very high contrast. So the code is limited to the contrast. Anyway to enhance contrast without introducing noise in an image?
function D = boundingbox(file,level)
image=imread(file);
figure
BW=im2bw(image,level);
%BW = ~BW;
imshow(BW)
BBs = [];
measurements = regionprops(BW, 'BoundingBox', 'Area');
for k = 1 : length(measurements)
thisBB = measurements(k).BoundingBox;
%rectangle('Position', [thisBB(1),thisBB(2),thisBB(3),thisBB(4)],...
%'EdgeColor','r','LineWidth',2 )
BBs = [BBs;thisBB];
end
areas=cat(1,measurements.Area);
[sortedAreas, sortingIndexes] = sort(areas, 'descend');
fusionindex = sortingIndexes(2);
rectangle('Position', [BBs(fusionindex,1),BBs(fusionindex,2),BBs(fusionindex,3),BBs(fusionindex,4)],...
'EdgeColor','r','LineWidth',2 )
D = BBs(fusionindex,3);
end

카테고리

Help CenterFile Exchange에서 Image Segmentation and Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by