Image conversion to RGB

조회 수: 3 (최근 30일)
Noor us Saba
Noor us Saba 2019년 4월 23일
댓글: Noor us Saba 2019년 4월 24일
How to convert the binary image (which is extracted from regionprops command) to again RGB image
here is the sample command
stats = regionprops(L,'Area','Centroid', 'Image');
  댓글 수: 1
KSSV
KSSV 2019년 4월 23일
stats is not a image....it is a structure with your required information.

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

채택된 답변

Walter Roberson
Walter Roberson 2019년 4월 23일
With difficulty. You would have to do something like xcorr2 in order to locate stats(K).Image within the label image.
It is a lot easier to instead request PixelIdxList or PixelList or SubarrayIdx, which give you information about the locations within the label image, and use those indices to extract the RGB from the original image. Or perhaps easier would be to use Image together with BoundingBox:
stats = regionprops(L, 'Area', 'Centroid', 'Image', 'BoundingBox');
for K = 1 : length(stats)
BB = stats(K).BoundingBox;
blobRGB = imcrop(YourRGBImage, BB);
mask = repmat(stats(K).Image, [1 1 3]);
blobsRGB{K} = blobRGB .* mask;
end
  댓글 수: 3
Walter Roberson
Walter Roberson 2019년 4월 23일
blobsRGB{K} = blobRGB .* cast(mask, class(blobRGB));
Noor us Saba
Noor us Saba 2019년 4월 24일
Thanks :)

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

추가 답변 (1개)

Noor us Saba
Noor us Saba 2019년 4월 23일
x = stats(k).Image
x is the segemented binary image given from the regionprops function
k is the index of array
Here is the image of x
bin Image.jpg

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

제품


릴리스

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by