2008年10月16日 星期四

CH2

這一禮拜一開始來上課的人來的很少,所以老師稍微跟大家聊聊天,也講了一些我沒有聽過的東西(看起來有上過其他課的人都聽過了)
其中有說了apple的ipod貴的原因=>因含有很多功能
Podcast(播客)就是其中一種
就如同網路上的RSS一樣(兩樣我都沒用過= =)
老師將之前大家提出的問題進行說明
原來之前有問題的”Current Pixel”跟”neighborhood”是在後面的Neighborhood Processing有關
而Color map 則是省容量的用法(使用顏色較少的時候),但在顏色多時,所佔的容量則較大。

CH2
輸入指令
w=imread('wombats.tif');
在這之前必須先設定位置
可以選擇用下圖所顯示的地方去更改讀取資料夾位置
或打成如下
w=imread(' C:\Users\Joy\Desktop\DIP images\wombats.tif');
指令執行時有下列兩點需注意
1.It ends in a semicolon(not displaying the results of the command to the screen)
=>也就是說上面讀取的圖片索取得的矩陣256x256的數值將不會被顯示出來。
2. The name wombats.tif is given in signal quotation marks.( wombats.tif被引入至一符號中,而不是從檔案取得)

指令
figure,imshow(w),pixval on

顯示結果
Figure =>開一個空白的圖檔(如果不使用此指令,則在顯示圖檔時會覆蓋前一個圖檔)
Imshow(NAME)=>顯示圖檔(NAME可以用圖檔位置或是程式中設定之變數)
Pixval on 在圖檔下可以有顯示游標所在之座標以及其灰階度
“,”=>逗號適用於區分同一行的不同指令
=====================================================
RGB Images
a=imread('autumn.tif');
figure,imshow(a),pixval on

=>取得三維矩陣
利用imfinfo取得其圖片資訊

imfinfo('autumn.tif')

Filename: 'D:\MATLAB\toolbox\images\imdemos\autumn.tif'
FileModDate: '04-十二月-2000 13:57:54' 檔案建立日期
FileSize: 213642 檔案大小
Format: 'tif' 檔案類型
FormatVersion: []
Width: 345 寬(Column)
Height: 206 長(row)
BitDepth: 24 (色深,可知此圖為24位元)
ColorType: 'truecolor'
FormatSignature: [73 73 42 0]
ByteOrder: 'little-endian'
NewSubFileType: 0
BitsPerSample: [8 8 8]
Compression: 'Uncompressed'
PhotometricInterpretation: 'RGB'
StripOffsets: [30x1 double]
SamplesPerPixel: 3
RowsPerStrip: 7
StripByteCounts: [30x1 double]
XResolution: 72
YResolution: 72
ResolutionUnit: 'Inch'
Colormap: []
PlanarConfiguration: 'Chunky'
TileWidth: []
TileLength: []
TileOffsets: []
TileByteCounts: []
Orientation: 1
FillOrder: 1
GrayResponseUnit: 0.0100
MaxSampleValue: [255 255 255]
MinSampleValue: 0
Thresholding: 1
老實說蠻攏長的
看起來很多不必要(而且也看不太懂)


三維陣列(three-dimensional)=>rows,columns,pages
a(:,:,1)=>RED
a(:,:,2)=>GREEN
a(:,:,3)=>BLUE
Indexed color image
figure,imshow('emu.tif'); (圖為下面左邊那張)

em=imread('emu.tif');
imshow(em) (圖為右邊的那張)
將圖片轉成MATLAB的矩陣後由於圖片為Indexed color Image
將會顯示出非原來之圖片
因此可以利用[em,emap]=imread(‘emu.tif’);取得陣列以及color map
並利用figure,imshow(em,emap)顯示

如果想將索引圖片轉換則可以使用
Ind2gray 索引影像轉換為灰階影像
Ind2rgb 索引影像轉換為RGB影像

(其他請參照課本Page 29)

GIF and PNG
GIF(Graphics Interchange Format):
(1)GIF is an image format that was first proposed in the late 1980s as a means for distributing images over networks.
(2)Colors are stored using a color map.(色彩最多為256色)
(3)GIF doesn’t allow binary or grayscale images (except as can be produced with RGB values)
(4)The pixel data is compressed using LZW(Lempel-Ziv-Welch)
(5)The GIF format allows multiple images per file.

LZW
http://zh.wikipedia.org/w/index.php?title=LZW&variant=zh-tw
參考網站:
http://zh.wikipedia.org/w/index.php?title=GIF&variant=zh-tw

PNG(Portable Network Graphics)
(1)The PNG format has been more recently designed to replace GIF and to overcome some of GIF’s disadvantages
(2)PNG does not rely on any patented algorithms, and it supports more image types than GIF.
PNG參考網址
http://zh.wikipedia.org/w/index.php?title=PNG&variant=zh-tw

JPEG:
(1)The JPEG algorithm uses lossy compression, in which not all the original data can be recovered.
(2)JPEG images are in general mush smaller than GIF or PNG images.
(3)apply the discrete cosine transform (DCT)

TIFF(Tagged Image File Format) :
(1)one of the most comprehensive image formats.
(2)It allows different compression routines(可允許其他壓縮程序=>LZW,JPEG,Huffman,run-length encoding)
(3)It allows different byte ordering.(接受不同位元排序)
(4)It allows binary, grayscale, truecolor, or indexed images, and allows opacity(半透明) or transparency(透明).

DICOM(Didital Imaging and Communications in Medicine醫療數位影像傳輸協定):
(1)The DUCOM defines an image format that, like GIF, may hold multiple image files.
(2)DICOM has become a standard for medical digital-imaging modalities.(在醫學數位影像上的標準規範)
(3)最近常用於病理學診斷上
(4)The DICOM file contains a header, which contains image inform, as we as the modality used, patient information, and compression used.

參考網址:
http://zh.wikipedia.org/w/index.php?title=DICOM&variant=zh-tw



心得與問題
有些相關MATLAB的語法在之前就已經看過了,不過課本上面講的比以前看的解釋上更詳細,但是由於一些以前用過,會一直有一種慾望想把課本翻到夠後面幾課,不過在看英文上還是比較吃力,所以沒辦法迅速看完前面直奔到後面


1 則留言:

  1. i have the book
    alasdair maandrew introduction to dip
    but hard to find the image file(.tif ..)
    can you share your
    "C:\Users\Joy\Desktop\DIP images\*"
    tks in advance!

    回覆刪除