ROI colour change
1 回表示 (過去 30 日間)
古いコメントを表示
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.
0 件のコメント
回答 (1 件)
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.
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!