# A Survey of OCR in Arabic Language: Applications, Techniques, and Challenges
## 3 OCR Process
### Preprocessing
#### 3.1.3 Deskewing  
Deskewing is the detection of rotated text in an image and computing its angle to correct its rotation [60]. It involves text-block detection, computing the angle of the rotated text, rotating the text, and correcting the image's skewness.  
An adaptive deskewing method for document pictures that recognizes the image type and selects an appropriate correction technique based on image type is proposed by [61]. The text direction of the document picture is determined by the method and is used as a parameter to pick a more appropriate projection direction. The research provides many approaches for repairing various sorts of document photographs, as well as a layout-based image categorization system. The results of the experiments suggest that the algorithm is accurate and resilient, although its complexity may restrict its capacity to predict skew over a specific threshold. A voting-based deskewing method is proposed by [62]; it chooses the best deskewing algorithm based on the accuracy of skew correction for large digitization projects.  
The Probabilistic Hough Transformation (PHT) method for skew detection and correction in OCR systems for scanned documents is presented in [63]. The method works in two steps: detecting lines of text and clustering them. Factors that affect OCR performance, such as skew, blur, image distortion, and noise, are addressed in the preprocessing phase, with skew being the main focus; an example is shown in Figure 6. The proposed method was tested on different datasets and showed better results than other methods used by researchers. The method calculates skew angles using the following equations:  
\[n_{\mathit{hieight}}=(n_{\mathit{width}}*h)/w \tag{1}\]  
where \(n_{\mathit{height}}\) represents normalized height, \(n_{\mathit{width}}\) represents normalized width, and \(w\) and \(h\) represent width and height, respectively.  
\[\begin{split} m=(y_{2}-y_{1})/(x_{2}-x_{1})\\ A=arctan[(y_{2}-y_{1})/(x_{2}-x_{1})]\end{split} \tag{2}\]  
where \(m\) represents slope/gradient of a line, and \(A\) represents the angle of each line. The proposed skew detection and correction method is used on different datasets and achieves good results compared to other methods used by researchers.  
Figure 5: Opening and closing of an image.  
Hough transformation (HT) is a technique to detect lines in an image and deskew the text. The authors of [7] use the HT method for skew correction. HT creates a parameter space (Hough space) in which each point in the space represents a possible line in the image. By detecting lines in the image, the method can detect the skew of the text by finding the angle at which the lines are inclined. The proposed method can detect skew angles with an accuracy of about 97% and can correct them with an average error of about 0.8\({}^{\circ}\). The method was evaluated through experiments on a dataset of Quran images. The method is robust to noise, which means it can still detect and correct skew even when images have noise present. It can also be applied to images of different quality, showing consistent performance regardless of the image quality. The method was tested on a diverse set of Quran images, including images with different text sizes and levels of quality, and the results were consistent.