2015年3月28日 星期六

[MATLAB] im2frame() colormap & Array Preallocation

There has some thing to notice is that im2frame need to assign a colormap

ie.  mov = im2frame(img_variable, colormap);

img_variable is the name of a image file that you are dealing with

colormap decide which kind of image you are using, like RGB color image or gray scale

imge etc.

So, next time don't forget to assign the colormap



Another thing is

when we want to make a video from a sequence of images

be careful this problem (Variable appears to change size on every loop iteration )

If not, you'll find out your RAM will overload when there are hundreds of images you

want to process.

(Related  1. Understanding Array Preallocation ;

                2. More about automatic array growth improvements in MATLAB R2011a

                3. Performance penalties)



2015年3月26日 星期四

[論文寫作] Word 格式建立使用技巧

之前在撰寫論文計畫書時對於如何生成自動章節編號有些不清楚

所以在這邊把網路上找到的文章列在下面

當作提醒用

1. 主題式論文排版技巧

裡面詳細列出論文撰寫所需要的格式

2. Word 2010 如何插入頁碼、目錄、圖/表目錄、取消封面頁碼

Word 2010自動產生圖表目錄

論文裡面的圖片不需要自己手動輸入,只要先按照第一篇文章對章節進行設定,

2010以後的Word就能夠自動幫你生成圖片的序號 (Ex. 圖1-1)。之後建立圖表目錄也

是相當方便。

3. [word寫作] 如何以交互參照建立參考文獻 (Reference) 與插入其標號

論文裡面的參考文獻標號可以利用 "交互參照" 這個功能來建立,不需要傻傻的自

己手動輸入,手動輸入勞心又勞力。



2015年3月11日 星期三

[Matlab] Loading multiple images files and converting to movie

最近因為實驗上需要, 想使用 Matlab 讀取多張影像, 並將影像播放出來

首先, 需要克服的是如何讀取檔案的問題。

1. 讀取多張影像 / Load images into Matlab

(1) Loading multiple images files  (2)Matlab 中 Dir 的用法

Matlab 中提供了一個指令叫做 dir('path') ,  這邊的path需要提供明確的資料夾路徑位

置  Ex. C:\users\folder\

而後面如果要抓出特定的影像格式檔, 例如tiff檔, 則使用 *.tif

這邊的*是指所有為tif檔案格式的檔案

下面我從別人的博客借來的範例程式碼

fpath = dir('path\*.tif'); 
n = length(fpath); 
data = cell(n,1); 

for i=1:n 
 filename = ['path\',fpath(i).name]; 
 data{i} = imread(filename); 
end

for 迴圈裡面則是執行讀檔的動作

2.將影像轉成影片 / Convert images into movie

這邊 getframe 與 im2frame 這兩個指令可以使用(官方對於im2frame指令的說明)

將圖片存成一個序列檔

例如

imshow('1.tif'); 
F(1) = getframe; 

imshow('2.tif'); 
F(2) = getframe; 

... 

imshow('n.tif'); 
F(n) = getframe;

movie(F);

最後, Matlab 就會將數張影像進行播放, 達到播放影片般的效果


/* 載入prettify的autoloader */ /* 載入JQuery */