【发布时间】:2014-07-24 22:19:45
【问题描述】:
我想让较亮的像素以绿色显示,而不亮的特征以蓝色显示。这是我尝试过的
for i=1:128
mycolormap(64:128,2)=i/128;
mycolormap(1:63,3)=i/128;
mycolormap(1:63,2)=0;
mycolormap(64:128,3)=0;
mycolormap(i,1)=0;
end
我正在使用 Uint16 .tif 的图像 在实例化之前,我考虑过将颜色图转换为双精度图。 谢谢!
阅读您添加的评论内容确实有助于我思考问题,因此我调整了我的代码并通过一些廉价的编码得到了我想要的东西。但现在我得到了我想要的谢谢!
for i=1:128 % start a loop (see comment above about i variable)
% then in EACH iteration
mycolormap(i,2)=i/128; % fill bottom half of 2nd column of MYCOLORMAP with i/128
mycolormap(i:63,3)=i/128; % fill top half of 3rd column of MYCOLORMAP with i/128
mycolormap(1:63,2)=0; % fill top half of 2nd column of MYCOLORMAP with 0
mycolormap(64:128,3)=0; % fill bottom half of 3rd column of MYCOLORMAP with 0
mycolormap(i,1)=0; % fill i-th row of 1st column with 0
end
>> mycolormap
mycolormap =
0 0 0.0078
0 0 0.0156
0 0 0.0234
0 0 0.0313
0 0 0.0391
0 0 0.0469
0 0 0.0547
0 0 0.0625
0 0 0.0703
0 0 0.0781
0 0 0.0859
0 0 0.0938
0 0 0.1016
0 0 0.1094
0 0 0.1172
0 0 0.1250
0 0 0.1328
0 0 0.1406
0 0 0.1484
0 0 0.1563
0 0 0.1641
0 0 0.1719
0 0 0.1797
0 0 0.1875
0 0 0.1953
0 0 0.2031
0 0 0.2109
0 0 0.2188
0 0 0.2266
0 0 0.2344
0 0 0.2422
0 0 0.2500
0 0 0.2578
0 0 0.2656
0 0 0.2734
0 0 0.2813
0 0 0.2891
0 0 0.2969
0 0 0.3047
0 0 0.3125
0 0 0.3203
0 0 0.3281
0 0 0.3359
0 0 0.3438
0 0 0.3516
0 0 0.3594
0 0 0.3672
0 0 0.3750
0 0 0.3828
0 0 0.3906
0 0 0.3984
0 0 0.4063
0 0 0.4141
0 0 0.4219
0 0 0.4297
0 0 0.4375
0 0 0.4453
0 0 0.4531
0 0 0.4609
0 0 0.4688
0 0 0.4766
0 0 0.4844
0 0 0.4922
0 0.5000 0
0 0.5078 0
0 0.5156 0
0 0.5234 0
0 0.5313 0
0 0.5391 0
0 0.5469 0
0 0.5547 0
0 0.5625 0
0 0.5703 0
0 0.5781 0
0 0.5859 0
0 0.5938 0
0 0.6016 0
0 0.6094 0
0 0.6172 0
0 0.6250 0
0 0.6328 0
0 0.6406 0
0 0.6484 0
0 0.6563 0
0 0.6641 0
0 0.6719 0
0 0.6797 0
0 0.6875 0
0 0.6953 0
0 0.7031 0
0 0.7109 0
0 0.7188 0
0 0.7266 0
0 0.7344 0
0 0.7422 0
0 0.7500 0
0 0.7578 0
0 0.7656 0
0 0.7734 0
0 0.7813 0
0 0.7891 0
0 0.7969 0
0 0.8047 0
0 0.8125 0
0 0.8203 0
0 0.8281 0
0 0.8359 0
0 0.8438 0
0 0.8516 0
0 0.8594 0
0 0.8672 0
0 0.8750 0
0 0.8828 0
0 0.8906 0
0 0.8984 0
0 0.9063 0
0 0.9141 0
0 0.9219 0
0 0.9297 0
0 0.9375 0
0 0.9453 0
0 0.9531 0
0 0.9609 0
0 0.9688 0
0 0.9766 0
0 0.9844 0
0 0.9922 0
0 1.0000 0
【问题讨论】:
-
你能告诉我们你得到了什么吗?我在这里回答了类似的问题:stackoverflow.com/questions/24488378/…
-
另外:不要在matlab中使用i作为变量,使用ii。我是复数