I get the concept of applying regionprops to extract ROI. Basically, regionprops uses connected components technique to extract the object. But, the thing I wanted to ask is using regionprops on "BoundingBox", what is the default value for connected components (number of connectivity)? I tried searching about it but I could not really find the answer.
-
If I am not wrong, there is no need to know it. AFAIK, "BoundingBox" will only return a single bounding box, where all your non-zero entries will be bounded. It doesn't return a bounding box per connected region. – Ander Biguri Oct 12 '15 at 08:50
-
Are you sure? because I have done some reading about bounding box, and it stated that it collects the dimension of connected components? So it must have the number of connectivity for connected components to label them? @AnderBiguri – Wong Wengkeong Oct 12 '15 at 08:54
-
Go to the documentation, and after reading the documentation for the "BoundingBox", read the next one, "Centroid". You have an image with an example of "BoundingBox" – Ander Biguri Oct 12 '15 at 09:00
2 Answers
I didn't see the default connectivity on regionprops
, but the default connectivity for both bwlabel and bwconncomp (for 2-dimensional matrices) is 8-connected
. I would expect regionprops
to be the same. You should be able to easily determine if this is the case for regionprops
by constructing a test image something like this:
1 1 0 0
1 1 0 0
0 0 1 1
0 0 1 1
Alternatively, you could use bwlabel
or bwconncomp
first and control the connectivity parameter. regionprops
accepts the output from either of these, as well as a BW image.

- 16,331
- 3
- 32
- 49
Take a look to the Matlab documentation about regionprops:
https://www.mathworks.com/help/images/ref/regionprops.html
In the section Tips you can see: ''If you need to specify nondefault connectivity, call bwconncomp and then pass the result to regionprops'' as:
CC = bwconncomp(BW, CONN);
S = regionprops(CC);
So answer to you question: It uses default connectivity that is 8, and you can also change it as you want with the parameter CONN when calling bwconncomp.

- 286
- 1
- 5
- 19