图像配准matlab代码.docxVIP

  • 16
  • 0
  • 约2.07千字
  • 约 4页
  • 2023-03-15 发布于上海
  • 举报
registration.m clear clc img = imread(.\image\test1.tif); figure(1) imshow(img) disp(获取原图像四个顶点在该图中的坐标); impixelinfo %四个顶点的坐标 x1 = 0; y1 = 0; x2 = 688; y2 = 200; x3 = 20; y3 = 688; x4 = 708; y4 = 888; rs = size(img); rows = rs(1); %行数columns = rs(2); % 列数 %[rows , columns] = size(img); %获取原图的大小 R = round(((y3-y1)+(y4-y2))./2); %行 C = round(((x2-x1)+(x4-x3))./2); %列 D1 = rows -R; %垂直偏移像素数 D2 = columns -C; %水平偏移像素数 img1 = zeros(R,C); for i = 1:R d2 = round(D2*i./R); for j = 1:C d1 = round(D1*j./C); img1(i,j) = floor(img(i+d1,j+d2)); end end figure(2) imshow(img1) imwrite(uint8(img1),strcat(.\ima

文档评论(0)

1亿VIP精品文档

相关文档