图像倾斜校正 Radon 变换原理及函数
radon校正
Radon(拉东)算法是一种通过定方向投影叠加,找到最大投影值时角度,从而确定图像倾斜角度的算法。具体过程如图所示
拉东变换
matlab实现
clear all
clc
close all[inputfilename,dirname] = uigetfile('*.*');
inputfilename = [dirname, inputfilename];
im = imread(inputfilename); % For example: 'input.jpg'grayImage = rgb2gray(im);
%%%%%%%%%% Edge detection and edge linking....
binaryImage = edge(grayImage,'canny'); % 'Canny' edge detector
binaryImage = bwmorph(binaryImage,'thicken'); % A morphological operation for edge linking
%%%%%%%%%% Radon transform projections along 180 degrees, from -90 to +89....
% R: Radon transform of the intensity image 'grayImage' for -90:89 degrees.
% In fact, each column of R shows the image profile along corresponding angle.
% xp: a vector containing the radial coordinates corresponding to each row of 'R'.
% Negative angles correspond to clockwise directions, while positive angles
% correspond to counterclockwise directions around the center point (up-left corner).
% R1: A 1x180 vector in which, each element is equal the maximum value of Radon transform along each angle.
% This value reflects the maximum number of pixels along each direction.
% r_max: A 1x180 vector, which includes corresponding radii of 'R1'.
theta = -90:89;
[R,xp] = radon(binaryImage,theta);
imagesc(theta,xp, R); colormap(jet);
xlabel('theta (degrees)');ylabel('x''');
title('theta方向对应的Radon变换R随着x''的变化图');
colorbar
%%%%%[R1,r_max] = max(R);
theta_max = 90;
while(theta_max > 50 || theta_max<-50)[R2,theta_max] = max(R1); % R2: Maximum Radon transform value over all angles. % theta_max: Corresponding angle R1(theta_max) = 0; % Remove element 'R2' from vector 'R1', so that other maximum values can be found.theta_max = theta_max - 91;
endcorrectedImage = imrotate(im,-theta_max); % Rotation correction
correctedImage(correctedImage == 0) = 255; % Converts black resgions to white regionssubplot(1,2,1), subimage(im)
subplot(1,2,2), subimage(correctedImage)
或
function [bw,qingxiejiao]=radontran(bwbone,bw)%radon倾斜校正theta=1:90; [R,xp]=radon( bwbone,theta);[I0,J]=find(R>=max(max(R)));%找倾斜角
qingxiejiao=90-J;bw=imrotate(bw,qingxiejiao,'bilinear','crop');
clc;
clear all;
close all;
[fn pn fi]=uigetfile('*.*','choose a picture');
Img=imread([pn fn]);
imshow(Img);title('Original image');
I = rgb2gray(Img);
I=improve_hist(I);
bw=edge(I,'canny');
theta=1:179;
[R,xp]=radon(bw,theta);
[I0,J]=find(R>=max(R(:)));%J记录了倾斜角
qingxiejiao=90-J;
I1=imrotate(Img,qingxiejiao,'bilinear','crop');
subplot(1,2,1),imshow(Img);title('Original image');
subplot(1,2,2),imshow(I1);title('correct image');
其中
图像倾斜校正 Radon 变换原理及函数相关推荐
- ocr 图像倾斜矫正-radon变换
图像预处理 在ocr处理时候,可能遇到的图片会是倾斜的,导致检测不全问题,进而影响后续识别问题. 常见的倾斜矫正方法 霍夫变换轮廓检测 randon 变换 基于PCA的方法 radon变换 本节说下r ...
- matlab 倾斜矫正,matlab图像倾斜校正
4 图像颜色畸变校正介绍图像颜色畸变现象可以是由摄像器材导致,也可以是由于真实环境本身就偏 色导致,还有的是由于图像放置过久氧化.老化导致.无论其产生的原因如何, 其校正方法都是类似的.如果用 Mat ...
- 图像倾斜校正 Hough校正 原理及函数
Hough校正是通过寻找参数最大重叠点对应的的角度进行图像倾斜矫正的. 具体过程见图2.3 Hough变换解析
- MATLAB基于Randon变换的图像倾斜校正算法及实现
Radon变换的基本原理: 一个平面内沿不同的直线(直线与原点的距离为d,方向角为alfa)对f(x,y)做线积分,得到的像F(d,alfa)就是函数f的Radon变换.也就是说,平面(d,alfa) ...
- python图像倾斜校正_图像倾斜矫正
没有找到关于图像倾斜矫正的综述性文献,那就自己整理一下吧. 图像倾斜可以分为两种情况,一种是平面倾斜,这种情况下拍照设备与试卷平行,拍出来的图像只需要进行旋转即可完成矫正:另一种是Z轴倾斜,这种情况下 ...
- python图像倾斜校正_python 图像倾斜校正
图像倾斜可以分为两种情况,一种是平面倾斜,这种情况下拍照设备与试卷平行,拍出来的图像只需要进行旋转即可完成矫正:另一种是Z轴倾斜,这种情况下拍照设备与试卷存在一定的角度,拍出来的图像要先进行透视变换, ...
- matlab 图像透视变换矩阵,[转载]图像倾斜校正、透视变换 MATLAB
过去也写过透视变换,当时算法真是弱爆了,我竟然会通过两次变换.不过那引用的三篇文章都是非常好的文章,直到今天我才看明白.所谓的倾斜校正,一定要有标定点,将一个倾斜的矩形变为不倾斜的.因此可以从原四边形 ...
- python图像倾斜校正_校正倾斜的文本
有时候文本是倾斜的,则不利于文本识别,如下图所示,那么进行文本识别之前我们需要应用文本倾斜校正算法(text skew correction,deskewing text). 对于一幅包含旋转文本块的 ...
- python 图像倾斜校正_边缘投影法对文本图像矫正——python
图像矫正就是通过一些已知的参考点,即无失真图象的某些象素点和畸变图象相应象素的坐标间对应关系,拟合出映射关系中的未知系数,并作为恢复其它象素的基础. 1.矫正原理 在进行图片矫正时,有些图片具有小角度 ...
最新文章
- 丛高教授《空间数据管理和挖掘及在智慧城市的应用》演讲笔记
- springcloud(九):配置中心和消息总线(配置中心终结版)
- SystemCenter2012SP1实践(19)集成WSUS更新服务器2012
- 极简短网址-一套简约的短网址程序
- The LAO将于4月2日启动Neptune DAO,旨在为其他区块链项目提供流动性
- Gene Ontology (GO) 简介
- 解决 ThinkPad x270 安装 ubuntu 14.04 后的网络问题
- android网易云桌面歌词,网易云怎么设置桌面歌词?
- 神经网络反向传播(BP)算法推导
- HTML5+CSS:03优惠券
- linux返回根目录的命令
- 【魔兽世界插件】魔兽世界插件实战笔记从入门到放弃的心理历程 第三节-窗体颜色设置与渐变
- 赴日本常见问题QA (2转 不明原处)
- 唯众本科Web前端专业解决方案
- 任正非与美国思想家的咖啡对话全文
- 桑基图绘制的简易操作
- 常用小工具:一款好用、实用的“日常工作安排”桌面日历
- IIS 配置PHP环境,可以运行PHP网站
- 高德地图API和百度地图API哪个更适合开发者?
- 线性代数|学习笔记|18.065MIT公开课 lecture05