A Skew Angle Detection Algorithm based on Maximum Gradient

DOI : 10.17577/IJERTV3IS030568

Download Full-Text PDF Cite this Publication

Text Only Version

A Skew Angle Detection Algorithm based on Maximum Gradient

Yogesh Kumar

Electrical Engineering Veermata Jijabai Technological Institute

Mumbai, India

Abstract-In order to resolve the problem of skew phenomenon in the handwritten document image during the scanning process, a new skew angle detection algorithm based on maximum gradient as well as interpolation was proposed in the paper. Firstly calculate skew angle by two co-ordinate point and then we use the method of non-text filtering to get rid of shorter text lines and dots. Experiment results shows that the algorithm detects skew angles of document image more rapidly and accurately than Hough transform alone

Keywords-Maximum gradient; skew angle detection; interpolation; bilinear


    Archive picture transforming incorporates filtering data, pretreatment, layout examination, character recognizable proof operations et cetera. Because of the reason created by workman on the other hand human element, the record skew wonder is unavoidably handled when changing over paper pictures into advanced pictures, which has a negative impact on emulating steps, for example, content division, layout investigation and character distinguishing proof. So the skew revision gets to be more vital, also, the center segment of skew remedy is skew point recognition [1]. So far numerous archive skew location calculations have been proposed, a few calculations are dependent upon tenets and former information of location. Case in point, the written works [1] is in view of content line technique and the written works [2] is dependent upon the system for reference line, which extraordinarily enhances the productivity and correctness, yet the skew recognition impact might be not as impeccable obviously if there are few characters in each one line, and the deficiency of the reference line calculation is its provision reach constrained to report pictures with the littler reference line. While different calculations utilizing an earlier learning of the technique as report pictures characteristics has solid flexibility, for example, projection [3], KNN [4] and additionally Hough-based [5]. The technique for projection looks from alternate points of view of projections of archive pictures so as to find the ideal projection effects to gauge the skew point. Then again, the technique needs expansive measure of count to bargains gravely with multicolumn layout report picture skew recognition. Besides, it is troublesome to enhance location exactness when there are clamors around the report pictures. KNN is

    primarily to figure out K closest neighbor purposes of the middle of joined locales, and after that the top of projection on the foundation of vector heading of neighbor focuses is utilized as skew edge of the entire page. Despite the fact that the effect has better estimation exactness, time many- sided quality is still higher if there are numerous nearby parts in the report picture. Moreover, Fourier change which utilizes Fourier spatial thickness greatest bearing as the skew plot is proposed by Pstl W [6], however the strategy is not utilized generally within commonsense provisions due to prolonged and higher space intricacy. Brushing focal points of most extreme slope distinction (MGD) and Hough convert, a skew edge identification calculation of manually written record pictures was proposed in the paper. The edge data of content was concentrated by the technique for content line diminishing, which decreases the impact of skew point recognition and the time. At last skew point location could be done adequately by two-stage Hough convert.


    A transcribed archive picture with immaculate content for the most part incorporates character data and there are some particular attributes which basically reflect in the accompanying viewpoints:

    1) Characters inside a content line have solid edge data and there are incredible changes between the forefront and foundation shade. Angle can reflect tragic level of change, while character strokes have qualities of positive and negative angle changes.

    Fig (1) Document image

    There are altered bearings of content lines with straight line characteristics. In for the most part, any level or vertical heading content line and line slopping bearing are as per skew edge of the entire record picture. In the same way that in figure 3, skew bearing of content line might be gotten by locating edge data.

    3) Because of the distinctive thickness or slenderness of strokes between characters in the same content line, then again, thickness or slimness of a stroke has some negative impact on skew edge location of the report picture. So some times recently Hough change, characteristic focuses which are by and large level edge data might be concentrated as the target pixels, which is useful to lessen the impact of precision and additionally the measure of count of the calculation.


    A. Basic Thought of Skew Angle Detection

    Original document image

    figure; image(I/255); axis image; title('input image');

    % make transformation matrix (T) [X Y] = ginput(2);

    a=diff(X); b=diff(Y); c=sqrt(a^2+b^2); p1=a/c;


    T =[ p1 p2 0 ; -p2 p1 0 ; 0 0 1 ];

    % warp incoming corners to determine the size of the output image

    cp = T*[ 1 1 w w ; 1 h 1 h ; 1 1 1 1 ];

    Xpr = min( cp(1,:) ) : max( cp(1,:) ); % min x : max x

    Ypr = min( cp(2,:) ) : max( cp(2,:) ); % min y : max y [Xp,Yp] = ndgrid(Xpr,Ypr);

    [wp hp] = size(Xp); % = size(Yp)

    % do backwards transform (from out to in) n = wp*hp;

    X = T \ [ Xp(:) Yp(:) ones(n,1) ]'; % warp

    % re-sample pixel values with bilinear interpolation clear Ip;

    xI = reshape( X(1,:),wp,hp)';

    yI = reshape( X(2,:),wp,hp)';

    Ip(:,:,1) = interp2(I(:,:,1), xI, yI, 'bilinear'); % red

    Ip(:,:,2) = interp2(I(:,:,2), xI, yI, 'bilinear'); % green

    Ip(:,:,3) = interp2(I(:,:,3), xI, yI, 'bilinear'); % blue

    % show the warping result

    figure; image(Ip/255); axis image; title('warped image');

    Calculation of slope

    Calculation of co-ordinate Point

    1. RESULT

      Calculation of skew angle

      Output image

      Image Skew angle Detection flow chart

      4 Mat lab codes for skew angle correction

      % load input image clc;

      close all;

      I = double(imread('1.jpg')); [h w d] = size(I);

      % show input image


      By examining the attributes of picture content and the point of interest of Hough change, we propose another skew plot recognition calculation dependent upon Maximum Gradient Distinction and Hough change. The calculation embraces Greatest Gradient Difference to consolidate the characters inside the same content line, with a specific end goal to enhance the precision of skew plot recognition, we extricate the top and base edge of content line, and apply two-stage Hough convert to removed edge data with the "harsh" to "fine" technique. Furthermore, a suitable size of

      window ought to be deliberately set when identifying the skew point of manually written content. The test shows that contrasted and the system of Hough change alone; our calculation has relative high exactness and rate with a certain vigor and suitability. We can find that there are some adjustable issues in the test, for instance, the recognition effect is not perfect the point when skew edge is under 5o. The following step is to move forward the correctness rate of skew edge when the skew point is in the little extend.


  1. CHUL YU, YUAN Y TANG, CHNG Y SUEN. Document skew detection based on the fractal and least squares method[C] IEEE 1995:1149-1152

  2. the document spectrum for page layout analysis[J] IEEE Transaction on PAMI, 1993,15(11):1162-1173

  3. CIARD IELLO G, SCAFUR G, DRGRANDIM, et al An Experimental System for Office Document Handling and Text Recognition[A]. 1998:739-743

  4. He Xiping, LI Yunfeng, ZHU Qingsheng, An Efficient Algorithm for Automatic Skew-Correction of Color Document Image[J], Journal of Image and Graphics, 2006,1(3):367-370

  5. QU Yang, YANG Li-ping, Hough transform OCR Image Slant Correction Method, Journal of Image and Graphics 2001178-181

  6. Pstl W. Detection of linear oblique structure and skew scan in digitized documents[C]//Proceedings of the 8th International Conference on Pattern Recognition, Paris,France,1986:587-489

  7. GAN Ling, LIN Xiaojing, Vehicle license plate location algorithm based on maximum gradient difference and edge search, Journal of Chongqing University of Posts and Telecommunications(Natural

    Science Edition),20106(3):371-374

  8. JAE H K, TAE T P,YANG H C et al, Photo-text segmentation in complex color document[C], The 5thIapan- Lorean Joint Symposium on Imaging Materials and Technologies,Kyoto,Japan,Nov.2004:44-47

  9. OTSU N,A threshold selection method form gray-level histograms [J]. IEEE Trans. Systems, Man and Cybernetics, 1979,9(1):62-66

  10. LI Zheng, YANG Yang, XIE Bin, Skew angle detection and correction of document images based on Hough transform [J], Computer Applications200525(3):583-585

Leave a Reply