function [ imgout ] = imMosaic( img1,img2,adjColor )
%[ imgout ] = imMosaic( img1,img2,adjColor )
% img1 and img2 can (both) be rgb or gray, double or uint8.
% If you have more than 2 images to do mosaic, call this function several
% times.
% If you set adjColor to 1, imMosaic will try to try to adjust the
% color(for rgb) or grayscale(for gray image) of img1 linearly, so the 2
% images can join more naturally.
% Yan Ke @ THUEE, 20110123, xjed09@gmail.com
% use SIFT to find corresponding points
[matchLoc1 matchLoc2] = siftMatch(img1, img2);
% use RANSAC to find homography matrix
[H corrPtIdx] = findHomography(matchLoc2',matchLoc1');
H %#ok
tform = maketform('projective',H');
img21 = imtransform(img2,tform); % reproject img2
figure,imshow(img1)
figure,imshow(img21)
% adjust color or grayscale linearly, using corresponding infomation
[M1 N1 dim] = size(img1);
[M2 N2 dd] = size(img2);
if exist('adjColor','var') && adjColor == 1
radius = 2;
x1ctrl = matchLoc1(corrPtIdx,1);
y1ctrl = matchLoc1(corrPtIdx,2);
x2ctrl = matchLoc2(corrPtIdx,1);
y2ctrl = matchLoc2(corrPtIdx,2);
ctrlLen = length(corrPtIdx);
s1 = zeros(1,ctrlLen);
s2 = zeros(1,ctrlLen);
for color = 1:dim
for p = 1:ctrlLen
left = round(max(1,x1ctrl(p)-radius));
right = round(min(N1,left+radius+1));
up = round(max(1,y1ctrl(p)-radius));
down = round(min(M1,up+radius+1));
s1(p) = sum(sum(img1(up:down,left:right,color))); % 取四周点色度
end
for p = 1:ctrlLen
left = round(max(1,x2ctrl(p)-radius));
right = round(min(N2,left+radius+1));
up = round(max(1,y2ctrl(p)-radius));
down = round(min(M2,up+radius+1));
s2(p) = sum(sum(img2(up:down,left:right,color)));
end
sc = (radius*2+1)^2*ctrlLen;
adjcoef = polyfit(s1/sc,s2/sc,1);
img1(:,:,color) = img1(:,:,color)*adjcoef(1)+adjcoef(2);
end
end
% do the mosaic
pt = zeros(3,4);
pt(:,1) = H*[1;1;1];
pt(:,2) = H*[N2;1;1];
pt(:,3) = H*[N2;M2;1];
pt(:,4) = H*[1;M2;1];
x2 = pt(1,:)./pt(3,:);
y2 = pt(2,:)./pt(3,:);
up = round(min(y2));
Yoffset = 0;
if up <= 0
Yoffset = -up+1;
up = 1;
end
left = round(min(x2));
Xoffset = 0;
if left<=0
Xoffset = -left+1;
left = 1;
end
[M3 N3 dd] = size(img21);
imgout(up:up+M3-1,left:left+N3-1,:) = img21;
% img1 is above img21
imgout(Yoffset+1:Yoffset+M1,Xoffset+1:Xoffset+N1,:) = img1;
end
没有合适的资源?快使用搜索试试~ 我知道了~
image-stitching--matlab.rar_SIFT图像拼接_matlab图像拼接_sift 图像拼接_图像拼接算法
共51个文件
jpg:39个
m:9个
asv:1个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 5 下载量 37 浏览量
2022-07-14
01:58:33
上传
评论
收藏 6.53MB RAR 举报
温馨提示
改进的图像拼接算法,基于sift算法,实现图像的自动拼接,测试,完美运行
资源推荐
资源详情
资源评论
收起资源包目录
image-stitching--matlab.rar (51个子文件)
image stitching matlab
ransac1.m 2KB
siftMatch.m 2KB
mosaic3.jpg 264KB
data
a.jpg 177KB
b.jpg 177KB
11b.jpg 97KB
mosaic_a.jpg 48KB
2.jpg 152KB
1.jpg 184KB
b2.jpg 56KB
b1.jpg 39KB
a1.jpg 87KB
keble_b.jpg 68KB
q6.jpg 85KB
3.jpg 147KB
a2.jpg 96KB
5.jpg 136KB
keble_c.jpg 67KB
22.JPG 105KB
keble_a.jpg 68KB
d1.jpg 31KB
111.JPG 138KB
c1.jpg 58KB
mosaic_hall.jpg 49KB
44a.jpg 68KB
q4.jpg 85KB
c2.jpg 65KB
bb.jpg 14KB
4.jpg 132KB
c.jpg 173KB
11a.jpg 112KB
44b.jpg 111KB
11.JPG 112KB
33.JPG 107KB
222.JPG 141KB
333.JPG 142KB
q5.jpg 85KB
d2.jpg 38KB
findHomography.m 678B
appendimages.m 461B
tmp.key 6.21MB
mosaic4.jpg 305KB
mosaic2.jpg 224KB
sift.m 2KB
solveHomo.m 585B
imMosaic.m 2KB
randIndex.m 418B
mosaic1.jpg 166KB
mosaicTest.asv 310B
mosaicTest.m 833B
siftWin32.exe 92KB
共 51 条
- 1
资源评论
- Wednesday。2023-08-25简直是宝藏资源,实用价值很高,支持!
- qq_415873452022-11-26资源不错,对我启发很大,获得了新的灵感,受益匪浅。
- pengchen12303212023-03-24总算找到了想要的资源,搞定遇到的大问题,赞赞赞!
- IIIItt2023-11-22资源值得借鉴的内容很多,那就浅学一下吧,值得下载!
- 2301_773215032023-10-29感谢大佬分享的资源给了我灵感,果断支持!感谢分享~
JaniceLu
- 粉丝: 78
- 资源: 1万+
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- YOLOV4-TINY权重文件
- 以下是一个使用贪心算法解决多机调度问题的基本步骤0.txt
- 基于大数据的房产估价是近年来随着技术的发展而兴起的一种新型估价方法.txt
- 企业供应链管理系统v3.rar
- 富芮坤FR8016HA蓝牙开发板使用手册+硬件PCB图+封装库+DEMO演示软件源代码.zip
- 基于YOLOv7的芯片表面缺陷检测系统
- 京东物流 数字化供应链综合研究报告2018.rar
- 基于YOLOv7的植物虫害识别&防治系统
- 2000.1-2023.8中国经济政策不确定性指数月度数据.xlsx
- Screenshot_2024-04-21-20-42-15-443_com.tencent.mm.jpg
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功