資源簡介
本案例是利用Matlab來查找兩幅圖像的不同之處,利用SURF特征匹配的算法將圖片對齊,之后采用形態學算法,對圖像進行處理。大家下載之后可以快速的入門,歡迎大家下載。

代碼片段和文件信息
function?on2?=?Align(MOVINGFIXED)
%?This?function?can?be?used?to?image?registration?該函數可用于圖像配準
%?moving?is?image?A?fixed?is?image?B?
%?type?is?the?method?used
%?type?‘no‘do?not?use?image?registration?
%?type?‘auto‘?use?the?automatic?image?registration.
%?type?‘user‘?use?the?user?defined?control?points?to?registration
????????%??registerImages??Register?grayscale?images?using?auto-generated?code?from?Registration?Estimator?app.
????????%??[MOVINGREG]?=?registerImages(MOVINGFIXED)?Register?grayscale?images
????????%??MOVING?and?FIXED?using?auto-generated?code?from?the?Registration
????????%??Estimator?App.?The?values?for?all?registration?parameters?were?set
????????%??interactively?in?the?App?and?result?in?the?registered?image?stored?in?the
????????%-----------------------------------------------------------
????????%?Feature-based?techniques?require?license?to?Computer?Vision?System?Toolbox
????????%?基于特征的技術需要計算機視覺系統工具箱的許可
????????checkLicense()
????????%?Default?spatial?referencing?objects?默認空間引用對象
????????fixedRefObj?=?imref2d(size(FIXED));
????????movingRefObj?=?imref2d(size(MOVING));
????????%?Detect?SURF?features?檢測SURF特征并返回SURFPoints對象
????????fixedPoints?=?detectSURFFeatures(FIXED‘MetricThreshold‘750.000000‘NumOctaves‘3‘NumScaleLevels‘5);
????????movingPoints?=?detectSURFFeatures(MOVING‘MetricThreshold‘750.000000‘NumOctaves‘3‘NumScaleLevels‘5);
????????%?Extract?features?特征提取
????????[fixedFeaturesfixedValidPoints]?=?extractFeatures(FIXEDfixedPoints‘Upright‘false);
????????[movingFeaturesmovingValidPoints]?=?extractFeatures(MOVINGmovingPoints‘Upright‘false);
????????%?Match?features?特征匹配
????????indexPairs?=?matchFeatures(fixedFeaturesmovingFeatures‘MatchThreshold‘50.000000‘MaxRatio‘0.500000);
????????fixedMatchedPoints?=?fixedValidPoints(indexPairs(:1));
????????movingMatchedPoints?=?movingValidPoints(indexPairs(:2));
????????MOVINGREG.FixedMatchedFeatures?=?fixedMatchedPoints;
????????MOVINGREG.MovingMatchedFeatures?=?movingMatchedPoints;
????????%?Apply?transformation?-?Results?may?not?be?identical?between?runs?because?of?the?randomized?nature?of?the?algorithm
????????%?應用轉換——由于算法的隨機性,運行之間的結果可能不相同
????????tform?=?estimateGeometricTransform(movingMatchedPointsfixedMatchedPoints‘projective‘);
????????MOVINGREG.Transformation?=?tform;
????????MOVINGREG.RegisteredImage?=?imwarp(MOVING?movingRefObj?tform?‘OutputView‘?fixedRefObj?‘SmoothEdges‘?true);
????????on2=MOVINGREG.RegisteredImage;
end
function?checkLicense()
%?Check?for?license?to?Computer?Vision?System?Toolbox?獲取計算機視覺系統工具箱許可證
CVSTStatus?=?license(‘test‘‘video_and_image_blockset‘);
if?~CVSTStatus
????error(message(‘images:imageRegistration:CVSTRequired‘));
end
end
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????2881??2018-12-24?16:31??Align.m
?????文件????????3217??2018-12-24?16:33??Main.m
?????文件????????2857??2018-12-24?16:15??Remove_LargeArea.m
?????文件???????64930??2018-12-12?20:01??test2-1.jpg
?????文件???????73861??2018-12-13?18:26??test2-2.jpg
?????文件??????146086??2018-12-13?10:29??timg-1.1.jpg
?????文件??????147725??2018-12-13?09:38??timg-2.2.jpg
?????文件??????108559??2018-12-12?19:56??timg2-1.jpg
?????文件??????115671??2018-12-13?18:42??timg2-2.jpg
?????文件???????84459??2018-12-13?18:45??timgKT-1.jpg
?????文件???????98614??2018-12-13?18:52??timgKT-2.jpg
?????文件?????????215??2018-12-25?19:56??程序說明.txt
評論
共有 條評論