资源简介
使用归一化相关函数进行配准,Step 1: Read Images,
%Step 2: Choose Subregions of Each Image,Step 3: Do Normalized Cross-correlation and Find Coordinates of Peak。。。。。。
代码片段和文件信息
%使用归一化相关函数进行配准
%Step 1: Read Images
lily = imread(‘lily.tif‘);
flowers = imread(‘flowers.tif‘);
figure imshow(lily)
figure imshow(flowers)
%Step 2: Choose Subregions of Each Image
% non-interactively
rect_lily = [93 13 81 69];
rect_flowers = [190 68 235 210];
sub_lily = imcrop(lilyrect_lily);
sub_flowers = imcrop(flowersrect_flowers);
% OR
% interactively
% [sub_lilyrect_lily] = imcrop(lily); % choose one petal of lily
% [sub_flowersrect_flowers] = imcrop(flowers); % choose whole lily
% display sub images
figure imshow(sub_lily)
figure imshow(sub_flowers)
%Step 3: Do Normalized Cross-correlation and Find Coordinates of Peak
c = normxcorr2(sub_lily(::1)sub_flowers(::1));
figure surf(c) shading flat
%Step 4: Find the Total Offset Between the Images
% offset found by correlation
[max_c imax] = max(abs(c(:)));
[ypeak xpeak] = ind2sub(size(c)imax(1));
% corr_offset = [(xpeak-size(sub_lily2))
% (ypeak-size(sub_lily1))];
%相关运算,参考点为模板右下角(因为进行了翻转),实际参考点应该为模板左上角
corr_offset = [(xpeak-size(sub_lily2)+1)
(ypeak-size(sub_lily1)+1)];
% relative offset of position of subimages
rect_offset = [(rect_flowers(1)-rect_lily(1))
(rect_flowers(2)-rect_lily(2))];
% total offset
offset = corr_offset + rect_offset;
xoffset = offset(1);
yoffset = offset(2);
%Step 5: See if the Image Lily Was Extracted from the Image Flowers
% xbegin = xoffset+1;
% xend = xoffset+ size(lily2);
% ybegin = yoffset+1;
% yend = yoffset+size(lily1);
%此时偏移点已经是图像左上角
xbegin = xoffset;
xend = xoffset+ size(lily2)-1;
ybegin = yoffset;
yend = yoffset+size(lily1)-1;
% extract region from flowers and compare to lily
extracted_lily = flowers(ybegin:yendxbegin:xend:);
if isequal(lilyextracted_lily)
disp(‘lily.tif was extracted from flowers.tif‘)
end
%Step 6: Pad the Lily Image to the Size of the Flowers Image
recovered_lily = uint8(zeros(size(flowers)));
recovered_lily(ybegin:yendxbegin:xend:) = lily;
figure imshow(recovered_lily)
%Step 7: Transparently Overlay Lily Image on Flowers Image
[mnp] = size(flowers);
mask = ones(mn);
i = find(recovered_lily(::1)==0);
mask(i) = .2; % try experimenting with different levels of transparency
% overlay images with transparency
figure imshow(flowers(::1)) % show only red plane of flowers
hold on
h = imshow(recovered_lily); % overlay recovered_lily
set(h‘AlphaData‘mask)
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2556 2005-04-18 17:28 nccr.m
----------- --------- ---------- ----- ----
2556 1
- 上一篇:气动机械手装配图及气动系统原理图
- 下一篇:UML大作业 选课管理系统的各种图
相关资源
- wincc 电机程序
- wincc 动画显示
- S7-300软冗余调试总结--WINCC组态
- 图像匹配-NCC算法实现
- halcon ncc 模板匹配
- TIA V15 V14 WINCC CCLicenseService 免狗破解补
- WinCC-Graphics.zip
- WINCC-如何使用自定义的对话框实现用
- harris+ncc+ransac
- WINCC注册MSCOMM控件
- WinCC脚本的口令解密
- wincc通信不上解决办法
- 经典NCC局域立体匹配算法 tsukuba图像为
- 新浪博客wincc7.4破解.docx
- wincc flexible用户登录、注销及显示
- wincc_flexible创建脚本的技巧
- Wincc画面窗口操作教程
- WinCC用户登录退出_用户注销_权限设置
- Wincc 7.0 SP3亚洲版授权文件+硬件狗破解
- WINCC 7.4 SP1硬件狗破解-最新版
- Wincc常用C脚本.docx
- 西门子授权工具Simatic_EKB_Install_2012_
- Wincc自动生成excel的c脚本
- wincc 脚本手册,可提供脚本函数的详
- TIA Portal V15.1 V15 V14 WINCC CCLicenseServic
- wincc7.2中文版破解文件,win764位旗舰版
- zw_lgf1818-9818280-nccsimple.zip
- Wincc7.4安装包+授权+视频
- wincc标准和内部函数书签版
- WINCC 7.0英文版地址及安装方法
评论
共有 条评论