【圖像處理】Matlab實(shí)現(xiàn)視頻處理系統(tǒng)
1 簡介
針對(duì)學(xué)生在學(xué)習(xí)"數(shù)字圖像處理"等課程中感覺抽象,難理解的問題,在Matlab的環(huán)境下,基于GUI設(shè)計(jì)了一套信號(hào)處理仿真系統(tǒng).該系統(tǒng)涵蓋數(shù)字圖像處理的經(jīng)典方法,包括圖像的基本運(yùn)算,圖像的增強(qiáng),圖像變換,圖像邊緣提取,圖像濾波等,集運(yùn)動(dòng)目標(biāo)檢測(cè),運(yùn)動(dòng)目標(biāo)跟蹤于一體.該系統(tǒng)參數(shù)調(diào)節(jié)靈活,系統(tǒng)擴(kuò)展方便,而且可轉(zhuǎn)化為.exe可執(zhí)行文件,脫離Matlab環(huán)境運(yùn)行,方便輔助教學(xué).
2 部分代碼
function Video2Images(videoFilePath)
clc;
nFrames = GetVideoImgList(videoFilePath);
function nFrames = GetVideoImgList(videoFilePath)
xyloObj = VideoReader(videoFilePath);
nFrames = xyloObj.NumberOfFrames;
video_imagesPath = fullfile(pwd, 'video_images');
if ~exist(video_imagesPath, 'dir')
? ?mkdir(video_imagesPath);
end
files = dir(fullfile(video_imagesPath, '*.jpg'));
if length(files) == nFrames
? ?return;
end
h = waitbar(0, '', 'Name', '獲取視頻圖像序列...');
steps = nFrames;
for step = 1 : nFrames
? ?temp = read(xyloObj, step);
? ?temp_str = sprintf('%s\\%03d.jpg', video_imagesPath, step);
? ?imwrite(temp, temp_str);
? ?pause(0.01);
? ?waitbar(step/steps, h, sprintf('已處理:%d%%', round(step/nFrames*100)));
end
close(h)
3 仿真結(jié)果
4 參考文獻(xiàn)
[1]齊玉娟, 王延江. 基于Matlab GUI的圖像和視頻處理仿真系統(tǒng)設(shè)計(jì)[J]. 實(shí)驗(yàn)技術(shù)與管理, 2019, 36(03):152-155.