필터 지우기
필터 지우기

how to save the filled region to as an image

조회 수: 3 (최근 30일)
Elysi Cochin
Elysi Cochin 2018년 2월 2일
편집: Rik 2018년 2월 2일
structBoundaries = bwboundaries(binaryImage);
xy = structBoundaries{i};
fill(xy(:,2),xy(:,1),'w');
how to save the filled region to as an image? when i do
im = fill(xy(:,2),xy(:,1),'w');
% im is a patch object
i want "im" as a double datatype or image datatype
i even used poly2mask, but only one region comes at a time, i need 2 regions out of 5 regions from structBoundaries to come in the mask

채택된 답변

Rik
Rik 2018년 2월 2일
편집: Rik 2018년 2월 2일
You can create a binary mask in your desired resolution with this FEX submission. You can then use that mask to set the pixels in any color you like.
Edit:
If you have binary masks for one region at a time with poly2mask, you can just use the binary OR ('|') to merge multiple masks.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by