matlab quantization 1 ~ 8 層

来源:互联网 发布:鼠标垫品牌 知乎 编辑:程序博客网 时间:2024/06/05 14:49
G =imread('newborn.tif');[h, w] = size(G);                    % 讀入G的高和寬qntzPlane = uint8(zeros(h, w, 8));   % 建立8層空plane,分別儲存1~8個分層figure;subplot(3, 3, 1);                     % 畫在九宮格的第1個位置   imshow(G);                            % 畫出grayscale圖案Gtitle('origin');for n = 1:8        qntzPlane(:,:,n) =  grayslice(G,2^n) ;       % 量化為 2^n 灰階,n = 1 ~ 8       subplot(3,3,n+1);                            % 畫在九宮格的第n+1個位置        subimage(qntzPlane(:,:,n),gray(2^n));        % 繪出量化圖形, 使用2︿n階的grayscale colormap    axis off;                                    % 關閉座標軸    title( ['qntz plane : ',num2str(2^n) ] );    % 標題顯示為第幾個qntzPlaneend  



影響區域:臉部和頭部

參考網址:http://www.mathworks.com/help/images/displaying-images-using-the-imshow-function.html

imshow() 共用colormap

subimage() 獨立colormap

原创粉丝点击