Al-Hazen Project
This is one of the experimental products developed in the Ar-PHP project labs

Al-Ḥasan ibn al-Haytham (Latinized: Alhacen or Alhazen) was a Muslim scientist. Alhazen made significant contributions to the principles of optics, as well as to physics, astronomy, mathematics, ophthalmology, philosophy, visual perception, and to the scientific method. He is frequently referred to as Ibn al-Haytham, and sometimes as al-Basri, after his birthplace in the city of Basra.

A lhazen's most famous work is his seven volume Arabic treatise on optics, Kitab al-Manazir (Book of Optics), written from 1011 to 1021. This work enjoyed a great reputation during the Middle Ages. Alhazen argued that the process of vision occurs neither by rays emitted from the eye, nor through physical forms entering it. He reasoned that a ray could not proceed from the eyes and reach the distant stars the instant after we open our eyes. He also appealed to common observations such as the eye being dazzled or even injured if we look at a very bright light. He instead developed a highly successful theory which explained the process of vision as rays of light proceeding to the eye from each point on an object, which he proved through the use of experimentation. His unification of geometrical optics with philosophical physics forms the basis of modern physical optics.

Khaled Al-Sham'aa
E-Mail account

    $obj = new ArabicOCR();

    // To show the ink density histogram at the image side as well as recognized area, lines, and words

    // Scan the area from (x1, y1) to (x2, y2)
    $obj->calcHist($x1, $y1, $x2, $y2);
    // Detect text lines in scanned area, returns two arrays for line start and end in pixels
    list($lineFrom, $lineTo) = $obj->findLines();
    // Scan specific line to be ready for words detection process (first line id is 0, so this for 5th line)
    // Detect words in scanned line, returns two arrays for word start and end in pixels
    list($wordFrom, $wordTo) = $obj->findLineWords();

    // Output the edited image in PNG format because we activated the debug option
    header("Content-type: image/png");

Sample debug output:

Sample debug output

Filtering Examples:


    // Available filters:
    // blurFilter, moreBlurFilter, sharpenFilter, hEdgesFilter, vEdgesFilter, 
    // dEdgesFilter, edgesFilter, embossFilter, meanFilter
    list($filter, $factor, $bias) = $obj->edgesFilter;

    $obj->im = $obj->applyFilter($filter, $factor, $bias);

    header('Content-type: image/png');

Sample filter output:







Detect Skin Example:


    header('Content-type: image/png');

O ur code still in the pre-Alpha developing stage, but as an open source project we would like to share it with all interested developers and we are looking forward to get your feedback. Download it now!