How to fuse or overlay multiple masks of clustering results onto the original image in a for loop

7 visualizzazioni (ultimi 30 giorni)
Something like the final image here but looped for an unknown number of groupings. Iterative imfuse or imoverlay is diminishing the intensity of the colors too much beyond 3 groups and it makes looping impossible when the number of groups is unknown. I was thinking automated binary mask creation for the identified particles in each group but I can't figure out the code to do that.

Risposte (1)

yanqi liu
yanqi liu il 7 Dic 2021
yes,sir
may be use bwlabel and label2rgb to make the maks label to rgb image
then,use imshow handle to set the AlphaData,such as
close all;
clear all;
clc;
im=imread('rice.png');
bw=imbinarize(im,'adaptive');
[L,~] = bwlabel(bw);
Lrgb = label2rgb(L, 'jet', 'w', 'shuffle');
figure; imshow(im, [])
hold on
himage = imshow(Lrgb);
set(himage, 'AlphaData', 0.3);

Community Treasure Hunt

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

Start Hunting!

Translated by