1、contrast函数:调整灰色对比度
2、用法说明:
(1)cmap = contrast(x) 函数返回一灰度色图cmap,该色图与当前色图x有相同的维数
(2)cmap = contrast(x,m) 函数返回维数为m×3的当前色图x的灰度色图cmap
3、实例
(1)显示框图
>> load clown
>> cmap1 = contrast(X)
cmap1 =
0.1249 0.1249 0.1249
0.2387 0.2387 0.2387
0.2636 0.2636 0.2636
0.2650 0.2650 0.2650
0.3009 0.3009 0.3009
0.3093 0.3093 0.3093
0.3700 0.3700 0.3700
0.3770 0.3770 0.3770
0.4078 0.4078 0.4078
0.4426 0.4426 0.4426
0.4633 0.4633 0.4633
0.4711 0.4711 0.4711
0.4794 0.4794 0.4794
0.4907 0.4907 0.4907
0.4918 0.4918 0.4918
0.5005 0.5005 0.5005
0.5081 0.5081 0.5081
0.5586 0.5586 0.5586
0.5600 0.5600 0.5600
0.5603 0.5603 0.5603
0.6005 0.6005 0.6005
0.6216 0.6216 0.6216
0.6223 0.6223 0.6223
0.6399 0.6399 0.6399
0.6539 0.6539 0.6539
0.6547 0.6547 0.6547
0.6554 0.6554 0.6554
0.6626 0.6626 0.6626
0.6856 0.6856 0.6856
0.7062 0.7062 0.7062
0.7072 0.7072 0.7072
0.7097 0.7097 0.7097
0.7447 0.7447 0.7447
0.7638 0.7638 0.7638
0.7831 0.7831 0.7831
0.7944 0.7944 0.7944
0.7948 0.7948 0.7948
0.7953 0.7953 0.7953
0.7963 0.7963 0.7963
0.7971 0.7971 0.7971
0.7990 0.7990 0.7990
0.7991 0.7991 0.7991
0.8181 0.8181 0.8181
0.8377 0.8377 0.8377
0.8380 0.8380 0.8380
0.8481 0.8481 0.8481
0.8592 0.8592 0.8592
0.8725 0.8725 0.8725
0.8726 0.8726 0.8726
0.8762 0.8762 0.8762
0.8822 0.8822 0.8822
0.8824 0.8824 0.8824
0.8827 0.8827 0.8827
0.8862 0.8862 0.8862
0.9098 0.9098 0.9098
0.9106 0.9106 0.9106
0.9174 0.9174 0.9174
0.9309 0.9309 0.9309
0.9310 0.9310 0.9310
0.9379 0.9379 0.9379
0.9744 0.9744 0.9744
0.9794 0.9794 0.9794
0.9984 0.9984 0.9984
1.0000 1.0000 1.0000
(2)显示图像
>> image(X)
(3)调整图片的灰度
>> colormap(cmap1)
(4) cmap = contrast(x,m)
>> cmap1 = contrast(X,100)
cmap1 =
0.1248 0.1248 0.1248
0.2385 0.2385 0.2385
0.2412 0.2412 0.2412
0.2412 0.2412 0.2412
0.2635 0.2635 0.2635
0.2649 0.2649 0.2649
0.3008 0.3008 0.3008
0.3092 0.3092 0.3092
0.3092 0.3092 0.3092
0.3152 0.3152 0.3152
0.3698 0.3698 0.3698
0.3768 0.3768 0.3768
0.4076 0.4076 0.4076
0.4076 0.4076 0.4076
0.4394 0.4394 0.4394
0.4424 0.4424 0.4424
0.4631 0.4631 0.4631
0.4709 0.4709 0.4709
0.4709 0.4709 0.4709
0.4793 0.4793 0.4793
0.4841 0.4841 0.4841
0.4905 0.4905 0.4905
0.4916 0.4916 0.4916
0.4917 0.4917 0.4917
0.5003 0.5003 0.5003
0.5080 0.5080 0.5080
0.5560 0.5560 0.5560
0.5584 0.5584 0.5584
0.5598 0.5598 0.5598
0.5598 0.5598 0.5598
0.5602 0.5602 0.5602
0.5968 0.5968 0.5968
0.6003 0.6003 0.6003
0.6215 0.6215 0.6215
0.6215 0.6215 0.6215
0.6221 0.6221 0.6221
0.6398 0.6398 0.6398
0.6526 0.6526 0.6526
0.6538 0.6538 0.6538
0.6538 0.6538 0.6538
0.6545 0.6545 0.6545
0.6553 0.6553 0.6553
0.6625 0.6625 0.6625
0.6638 0.6638 0.6638
0.6638 0.6638 0.6638
0.6855 0.6855 0.6855
0.7060 0.7060 0.7060
0.7071 0.7071 0.7071
0.7096 0.7096 0.7096
0.7096 0.7096 0.7096
0.7345 0.7345 0.7345
0.7446 0.7446 0.7446
0.7637 0.7637 0.7637
0.7830 0.7830 0.7830
0.7937 0.7937 0.7937
0.7937 0.7937 0.7937
0.7943 0.7943 0.7943
0.7947 0.7947 0.7947
0.7951 0.7951 0.7951
0.7962 0.7962 0.7962
0.7962 0.7962 0.7962
0.7965 0.7965 0.7965
0.7970 0.7970 0.7970
0.7989 0.7989 0.7989
0.7990 0.7990 0.7990
0.7990 0.7990 0.7990
0.8180 0.8180 0.8180
0.8234 0.8234 0.8234
0.8376 0.8376 0.8376
0.8379 0.8379 0.8379
0.8379 0.8379 0.8379
0.8480 0.8480 0.8480
0.8486 0.8486 0.8486
0.8592 0.8592 0.8592
0.8724 0.8724 0.8724
0.8725 0.8725 0.8725
0.8725 0.8725 0.8725
0.8762 0.8762 0.8762
0.8820 0.8820 0.8820
0.8822 0.8822 0.8822
0.8823 0.8823 0.8823
0.8823 0.8823 0.8823
0.8827 0.8827 0.8827
0.8861 0.8861 0.8861
0.8884 0.8884 0.8884
0.9098 0.9098 0.9098
0.9098 0.9098 0.9098
0.9106 0.9106 0.9106
0.9173 0.9173 0.9173
0.9300 0.9300 0.9300
0.9309 0.9309 0.9309
0.9309 0.9309 0.9309
0.9310 0.9310 0.9310
0.9379 0.9379 0.9379
0.9744 0.9744 0.9744
0.9761 0.9761 0.9761
0.9761 0.9761 0.9761
0.9794 0.9794 0.9794
0.9984 0.9984 0.9984
1.0000 1.0000 1.0000