My OCR

Optical Character Recognition in C

Matrix Code GIF

Matrix Logic

Scanning GIF

Image Processing

Project Overview

This project involves the development of a complete Optical Character Recognition (OCR) system written entirely in C. Unlike typical Python implementations using libraries like TensorFlow or PyTorch, this project required implementing the mathematical core of a neural network (backpropagation, matrix operations, activation functions) from scratch.

Neural Network Visualization

Technical Architecture

The software pipeline transforms a raw image of text into digital characters through several distinct stages:

1. Preprocessing

Raw images are often noisy. We implemented several filters to prepare the data:

Binary Code GIF
Processing GIF

2. Segmentation

The system isolates individual characters using XY-Cut algorithm and histogram projection profiles. This step creates the specific input matrices that will be fed into the neural network.

3. Neural Network (The Core)

We built a Multilayer Perceptron (MLP) in C.

Challenges & Optimization

The main challenge was performance and memory management. Since we allocated memory manually for large matrices representing weights and biases, preventing memory leaks (checked with Valgrind) was critical. We also optimized the training loop to converge efficiently on the XOR problem before scaling to OCR datasets.

Optimization GIF

Conclusion

This project achieved a final grade of 16.87/20. It was a rigorous exercise in applying low-level programming concepts to high-level AI problems. The source code is available here: GitHub - Perceptio-S3-EPITA.