Reputation: 1265
I have 5 images that are some maps that are calculated by multiplying a mask in an RGB image. Now, I need to find out the union of all regions in these maps. How can I calculate it in MATLAB? When I use union
in Matlab it produces a vector, but my images are 512x512x3. Could you please tell me what should I do for this? For example I have 5 images like the following image and I want to calculate the union of all these images to find all parts that users select.
Upvotes: 0
Views: 453
Reputation: 60443
The union of two or more binary images (logical matrices) is computed using the element-wise logical OR operation (|
):
mask = mask1 | mask2 | mask3;
For gray-value images use max
instead:
mask = max(mask1, mask2);
mask = max(mask, mask3);
union
is a function that computes the union of two sets, and is not applicable to images.
Upvotes: 1