Connected Component Labeling with Different Pixel/Cell Sizes
조회 수: 1 (최근 30일)
이전 댓글 표시
I have a 3D matrix ( 73 x 144 x 25738 ) in which I am using the following code to label clusters of pixels, then further group clusters that are within a certain distance into the same group:
data = 1 slice of 3D matrix or a 73 x 144 boolean
cc = bwconncomp(data);
L = labelmatrix(cc);
bw = bwdist(data) <= 2; % merges clusters based on distance
L2 = labelmatrix(bwconncomp(bw));
s = regionprops(L2, 'Area');
[s.Area];
L2(~data) = 0;
s = regionprops(L2, 'Area');
[s.Area];
But the problem I have is that my pixels or cells are actually lat/long grid cells, thus each pixel is technically a different area (in sq km) and using bw = bwdist(data) <= 2 would need to take this into account. Is there a way to specify the size of each pixel and then use a euclidean distance calculation like bwdist to group close clusters?
댓글 수: 0
답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!