MATLAB 棋盘格图片校准

moveImg=imread('cheesBoard_Object.tiff');
moveImg=rgb2gray(moveImg);
[imagePoints,boardSize] = detectCheckerboardPoints(moveImg);%检测棋盘格角点
figure(1)
imshow(moveImg);
hold on;
 plot(imagePoints(:,1),imagePoints(:,2),'ro');
% for i=1:length(imagePoints(:,1))
%     str = [num2str(i)];
%     text(imagePoints(i,1),imagePoints(i,2),str,'color','black');%显示信息
%     plot(imagePoints(i,1),imagePoints(i,2),'ro');
% end
movingPoints=imagePoints;
hold off
%
fixedImg=imread('cheesBoard_1280_800_40.bmp');
% fixedImg=rgb2gray(fixedImg);
[imagePoints_fixedImg,boardSize_fixedImg] = detectCheckerboardPoints(fixedImg);
figure(2)
imshow(fixedImg);
hold on;
plot(imagePoints_fixedImg(:,1),imagePoints_fixedImg(:,2),'ro');
% for i=1:length(imagePoints_fixedImg(:,1))
%     str = [num2str(i)];
%     text(imagePoints_fixedImg(i,1),imagePoints_fixedImg(i,2),str,'color','black');%显示信息
%     plot(imagePoints_fixedImg(i,1),imagePoints_fixedImg(i,2),'ro');
% end
hold off
tempPoints1=reshape(imagePoints_fixedImg(:,1),boardSize_fixedImg(1)-1,boardSize_fixedImg(2)-1);
tempPoints2=reshape(imagePoints_fixedImg(:,2),boardSize_fixedImg(1)-1,boardSize_fixedImg(2)-1);
fixedPoints1=tempPoints1(1:boardSize(1)-1,1:boardSize(2)-1);
fixedPoints2=tempPoints2(1:boardSize(1)-1,1:boardSize(2)-1);
fixedPoints=[fixedPoints1(:),fixedPoints2(:)];

mytform = cp2tform(movingPoints,fixedPoints, 'projective');%求出投影变化的矩阵
registered = imtransform(moveImg, mytform, 'bicubic');%进行变化

figure(3)
imshow(imadjust(registered));

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值