Connecting Connected-Components (image regions) at Different Intensity Levels

1 visualización (últimos 30 días)
Hi,
I am trying to develop and implement some image processing algorithm. The idea of the algorithm is to:
(1) find the connected components (regions) at intensity level "k",
(2) and simultaneously calculating their associated region moments
(3) and then connected the regions at intensity level "k" with regions of intensity level "k-1", if any adjacent region(s) has/have lower intensity values, to form a larger regions (without knowing the pixels of the region at the lower intensity, but knowing only its region moments).
For example, consider the image below with the black, blue, green and purple regions that identify the intensity from smallest to largest (0->4).
I will first insert the black regions and find each region moments. Then I will proceed and find the region moments of the next intensity level, the blue "2", and now since the blue region is connected to a region with smaller intensity, both will merge (and their moments will add up). And we proceed in a similar fashion until all regions moments are calculated and ultimately merge.
I have completed steps (1) and (2) successfully, but got stuck at step (3). In fact, I am wondering if I can merge the two connected regions without using (knowing) their pixels or at least knowing the pixels of intensity "k" but not "k-1" or any before.
Any suggestions? Many thanks.

Respuestas (1)

Image Analyst
Image Analyst el 5 de En. de 2016
You will have to find all the unique numbers, then use ismember to pull them out into a binary image. Then use bwlabel to identify multiple blobs of that one label and again use ismember to pull them out into a binary image for just that one blob. Then compute the moments.
allLabels = unique(classifiedImage);
for k = 1 : length(allLabels)
% Pull out the blobs with number k:
thisNumber = ismember(classifiedImage, allLabels(k)) > 0;
% Identify separate blobs, if there are multiple ones.
[labeledImage, numRegions] = bwlabel(thisNumber);
for k2 = 1 : numRegions
thisBlob = ismember(labeledImage, k2) > 0;
% Now compute image moments on this single blob region.
end
end
I'm attaching my demo for computing image moments.

Community Treasure Hunt

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

Start Hunting!

Translated by