How to retrieve the RGB color information from its original image to the segmented sub-images after applying bwlabel()

조회 수: 1 (최근 30일)
Hi everyone, I have an project which currently need to segmented blast cells from a microscopic image. I had done the watershed segmentation, and I had tried to use bwlabel() function to crop out the blast cells into several sub-images. However, I would like to ask about how to retrieve back the original RGB color space to the sub-images which is just a binary image. I hope someone can help me in this matter, thanks in advance.

답변 (1개)

awezmm
awezmm 2019년 2월 28일
If I understand you correctly, you want overlay the masked binary back into the RGB so that single cells show up as color.
Lets say that rgb_img is the variable for your rgb image
binary_img is the variable for your masked image
overlayed = bsxfun(@times, rgb_img, cast(binary_img,class(rgb_img)))
  댓글 수: 1
Leow Bin
Leow Bin 2019년 2월 28일
Hi Mr. Awezmm, thank you for answering my question. That's exact what I meant! However, I had found the similar solution this morning by using masked image too. I had creating crop RGB images for the masked Image, and overlay into the binary Image. The idea was getting from the articles grabcut from matworks. Anyway, thank you for your answer and below is my code:
subImage1 = imcrop(rgbImage, thisBlobsBoundingBox);
subImage = imcrop(thisBlob, thisBlobsBoundingBox); ho
maskedImage2 = subImage1;
maskedImage2(repmat(~subImage,[1 1 3])) = 0;

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Get Started with Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by