Image Processing for OCR

Before feeding an image to an OCR system, various image processing techniques are applied to improve text visibility and minimize noise or distortions. The basic steps are as follows: 1. Image Acquisition This is the first step, where the image is captured from a source like a scanner, camera, or downloaded from a file. The image could be in various formats such as JPG, PNG, TIFF, etc. 2. Preprocessing The goal of preprocessing is to prepare the image to make it easier for the OCR engine to read the text. Common preprocessing steps include: ...

October 22, 2024 · 2 min · Lin Lin Hlaing

Image Processing Libraries

OpenCV → mainly used in TensorFlow Purpose: Computer vision and image processing. Features: Real-time operations, image transformations, filtering, object detection, edge detection. Installation: pip install opencv-python Pillow (PIL) → PyTorch Purpose: Image manipulation. Features: Open, save, and process many image file formats; resizing, cropping, and rotating images. Installation: pip install Pillow from glob import glob vs import glob from glob import glob: Imports only the glob() function, so you can call it directly as glob(). import glob: Imports the whole glob module, so you need to call the function as glob.glob(). matplotlib.pyplot vs matplotlib.pylab matplotlib.pyplot: Preferred for most plotting tasks; provides a clean, modular interface for creating and customizing plots. matplotlib.pylab: Combines plotting with numerical operations; less commonly used due to its less modular approach and potential for namespace conflicts.

October 22, 2024 · 1 min · Lin Lin Hlaing

Immutable vs mutable object

Pass by Value The function receives a copy of the argument’s value. Modifications to the parameter inside the function do not affect the original argument. Pass by Reference The function receives a reference (or address) to the actual argument. Modifications to the parameter inside the function affect the original argument because both the argument and the parameter refer to the same memory location. Mutable Objects (like lists or dictionaries): The function can modify the object in place, and those changes will be reflected outside the function. ...

October 22, 2024 · 2 min · Lin Lin Hlaing

while loop vs do-while loop

while Loop: This is a standard while loop because: The condition i < 5 is checked before each iteration. If i were greater than or equal to 5 from the start, the loop would not execute even once. do-while Loop: Python does not have a built-in do-while loop like some other programming languages (e.g., C, C++, or Java). However, you can mimic the behavior of a do-while loop using a while loop with a condition that ensures the loop executes at least once. ...

October 22, 2024 · 2 min · Lin Lin Hlaing

Introduction to Python

Python Born on February 20, 1991. An open source (free), high-level, object-oriented, interpreted and general-purpose dynamic programming language. Easiest to learn among programming languages! (But slow!) Gaining popularity over the past ten years, especially for ML and DL. Python version For machine learning, particularly neural network deep learning, it’s recommended to use Python 3.8 due to compatibility issues with TensorFlow in later Python versions. Many versions of TensorFlow work more reliably with Python 3.8, avoiding potential problems found in Python 3.9 or newer Applications of Python Website development Software and Mobile Apps development Scientific and numeric computing, etc. Python libraries NumPy - for numerical computation ...

October 21, 2024 · 2 min · Lin Lin Hlaing