필터 지우기
필터 지우기

ROI colour change

조회 수: 1 (최근 30일)
M M
M M 2011년 6월 13일
I am wondering if anyone knows how I can change the output colour of an roi?
outlineMat = outlineMat + roipoly(zerosMat,x,y)
is there a function to add onto roipoly that will allow me to change it's output colour when I run the program? right now what I get is a black background and the roi in white.

답변 (1개)

Walter Roberson
Walter Roberson 2011년 6월 13일
roipoly creates a 2D mask, and 2D images are either black and white, grayscale, or pseudo-color. If the result you get is pseudocolor, you could adjust the color map so that the high values mapped to color, but then all the high values would map to color, including ones that were already high in outlineMat.
What you could do, if you do not need to do further grayscale processing, so something like,
roi = roipoly(zerosMat,x,y);
outlineMatC(:,:,1) = outlineMat + R * roi;
outlineMatC(:,:,2) = outlineMat + G * roi;
outlineMatC(:,:,3) = outlineMat + B * roi;
where R, G, and B are the appropriate color components of the color you want the ROI to become.
Yes, this could be shortened to one or two lines, but they are not going to be immediately understandable
roi = roipoly(zerosMat,x,y);
outlineMatC = repmat(outlineMat,1,1,3) + cat(3, R*roi, G*roi, B*roi);
Sometimes clarity is best.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by