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

조회 수: 7(최근 30일)
Emily Williamson
Emily Williamson 2021년 12월 6일
답변: yanqi liu 2021년 12월 7일
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.

답변(1개)

yanqi liu
yanqi liu 2021년 12월 7일
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