资源简介
文件夹中包括诸葛大神的透视变换教程、matlab矫正PPT、我自己写的matlab矫正仿真程序(未写注释,比较乱)
代码片段和文件信息
clc clear close all
% [filenamepathname]=uigetfile({‘*.png‘;‘*.jpg‘;‘*.bmp‘;‘*.gif‘}‘choose photo‘);%第一个为默认格式
% str=[pathnamefilename];
% im=imread(‘G:\GTR_Scorpio_2018\PHOTOS\60.png‘);
% im = ~imread(‘G:\GTR_Scorpio_2018\调试助手\生成图片上位机\fire12\fire1000.bmp‘);%颜色翻转;k60保存的图片 1 为黑,0为白
% im = ~imread(‘G:\GTR_Scorpio_2018\调试助手\生成图片上位机\fire13\fire511.bmp‘);%颜色翻转;k60保存的图片 1 为黑,0为白
% im=~imread(‘G:\GTR_Scorpio_2018\调试助手\生成图片上位机\fires\fire3\fire3016.bmp‘);
im = ~imread(‘G:\GTR_Scorpio_2018\调试助手\生成图片上位机\fire14\fire1.bmp‘);%130 158
% axes( handles.axes1 );
% im=rgb2gray(im);
figure(1);
imshow(im); %显示原图像
%图像矫正
img_origin = im;
[img_origin_high img_origin_width] = size(img_origin);
% H=[ 59/9 625/18 1015/9 0 1601/54 -257/9 0 5/54 1]
% H11 =H(1); H12 =H(2); H13 =H(3); H21 =H(4) ; H22 =H(5); H23 =H(6); H31 =H(7); H32 =H(8); H33=H(9);
% img_correction_high =268;
% img_correction_width =750;
% H=[ 649/73 3840/73 3240/73 0 26882/365 1916/73 0 48/365 1];
H = [ 8.8904 52.6027 44.3836 0 73.6493 26.2466 0 0.1315 1 ];%矫正参数
H = [9.7429 72.8571110.2857080.651432.342900.14571]
H11 =H(1) H12 =H(2) H13 =H(3) H21 =H(4) H22 =H(5) H23 =H(6) H31 =H(7) H32 =H(8) H33=H(9)
img_correction_high =500;
img_correction_width =1000;
% H2 = [70.1979-46.7663-1888.179008.8904-233.34280-1.1691654.7717];
H2 = [75.9386-56.7869-6538.292209.7429-315.11180-1.4197785.7753]
% H=[ 119/23 480/23 2614/23 0 2219/115 -420/23 0 4/115 1];
% H11 =H(1); H12 =H(2); H13 =H(3); H21 =H(4) ; H22 =H(5); H23 =H(6); H31 =H(7); H32 =H(8); H33=H(9);
% img_correction_high =444;
% img_correction_width =1200;
img_undist = zeros( img_correction_high img_correction_width);%背景为黑
% img_undist = 255*ones( img_correction_highimg_correction_width);%背景为白
img_size = size( img_origin );
img_undist = uint8( img_undist );
inter_x=[];
inter_y=[];
%未作插值处理 方案1
l=1;
fanjiao=[];
error_y=[];
last_ya = 500;
for i = img_origin_high:-1:1 % 垂直方向
% last_xa=round((i*H22+H23)/(i*H32+H33));
ya=round((0*H21+i*H22+H23)/(0*H31+i*H32+H33));
fprintf(‘%d %d\n‘ i ya );
for j = 1:img_origin_width % 水平方向
Y=i;
X=j;
xa=round((X*H11+Y*H12+H13)/(X*H31+Y*H32+H33));
ya=round((X*H21+Y*H22+H23)/(X*H31+Y*H32+H33));
img_undist2(ya xa) = img_origin(ij);
% if img_undist2(ya xa) ~= 0
% x=xa;
% y=ya;
% X =round((H22*x - H12*y + H12*H23 - H13*H22 - H23*H32*x + H13*H32*y)/(H11*(H22 - H32*y)));
% Y = round( -(H23 - y)/(H22 - H32*y) );
fanjiao_X=round((xa*H2(1)+ya*H2(2)+H2(3))/(xa*H2(7)+ya*H2(8)+H2(9)));
fanjiao_Y=round((xa*H2(4)+ya*H2(5)+H2(6))/(xa*H2(7)+ya*H2(8)+H2(9)));
% fanjiao_X = round( (H12*H23 - H13*H22 + H22*H33*xa - H23*H32*xa - H12*H33*ya + H13*H32*ya)/(H11*H22 - H12*H21 + H21*H32*xa - H22*H31*xa - H11*H32*ya + H12*H31*ya) );
% fanjiao_Y = round( -(H1
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 397731 2019-01-18 09:41 透视变换_朱葛俊.pdf
文件 2309120 2019-01-18 09:42 图像几何变换matlab.ppt
文件 6054 2019-01-03 20:02 矫正.m
----------- --------- ---------- ----- ----
2712905 3
- 上一篇:MATLAB语言——GPOPS工具.zip
- 下一篇:引导滤波matlab源代码
评论
共有 条评论