Strange resultat using imagesc() on a three-value matrix
1 次查看(过去 30 天)
显示 更早的评论
I want to have a three-color-only visual on a matrix that contains many values which are one of three values. Here is the simplest way I could repeat the issue:
r=rand(1,2000);
r(r>0.6)=70;r(r<=0.3)=0;r((r>0) & (r<70))=35;
figure;imagesc(r);
I would expect the visual to be in accordance with the values in the matrix. I mean, a visual with only 3 colors. Strangely, that does not happen if I replace the value 2000 by 1000 or by 2100. Is it my video card creating this bug? Or something else?
"Ver" returns:
- MATLAB Version: 8.5.0.197613 (R2015a)
- Operating System: Microsoft Windows 7 Édition Familiale Premium Version 6.1 (Build 7601: Service Pack 1)
- Java Version: Java 1.7.0_60-b19 with Oracle Corporation Java HotSpot™ Client VM mixed mode
采纳的回答
更多回答(2 个)
Image Analyst
2017-7-13
I do not see that. I see only 3 colors in your first example, and two colors in your second example, as expected. My guess is it's your video adapter and how it's trying to zoom in, like by pixel replication (which would not introduce any new colors), or bicubic interpolation (which would introduce more colors).
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!