| # Combined Image Processing Modules: CAT, Deblurring, and Image Translator |
|
|
| ## Overview |
|
|
| This repository provides an integrated set of image-processing modules aimed at enhancing image quality and transforming digital sketches into photo-realistic images. The components include the **Contour Accentuation Technique (CAT)**, a **Deblurring Module**, and an **Image Translator Module**, implemented using modern deep learning frameworks like TensorFlow and PyTorch. |
|
|
| --- |
|
|
| ### **1. Contour Accentuation Technique (CAT)** |
|
|
| **Description**: CAT enhances the visibility of image contours using blending and gamma correction techniques. It is lightweight, effective, and suitable for applications like sketch generation, medical imaging, and image analysis. |
|
|
| **Key Features**: |
| - **Blending**: Converts the input image to grayscale, applies Gaussian blur, and blends it for edge enhancement. |
| - **Gamma Correction**: Adjusts brightness and contrast to improve contour clarity. |
| - **Input/Output**: Processes input images to generate contour-accentuated outputs. |
|
|
| **Usage**: |
| - Install the required libraries: |
| pip install numpy opencv-python |
|
|
| **Steps to run the script:** |
| 1) specify the input_folder that has the faceimages and the output_folder to get the composite sketches |
| 2) python cat.py |
| |
| Adjust gamma in the adjust_gamma() function for brightness/contrast fine-tuning. |
| |
|
|
| ### **2. Deblurring Module** |
|
|
| Description: A GAN-based module implemented in TensorFlow, trained specifically to restore blurred facial sketches. The module leverages a deep convolutional generator and a patch-based discriminator. |
|
|
| **Key Features**: |
| - **Generator**: Transforms blurred images into sharp images using a combination of convolutional, residual, and transposed convolutional layers. |
| - **Discriminator**: Employs convolutional layers to distinguish real and synthetic sketches. |
| - **Loss Function:** Optimized using Wasserstein loss for stability during training. |
|
|
| **Usage:** |
| - Install TensorFlow and required dependencies: |
| pip install tensorflow |
|
|
| **Steps to Train:** |
| 1. Prepare Input data: Place the folder of clear sketches in the root directory of this project. Rename it to clear_sketches |
| 2. Run the blur code to introduce artificial blur (You can choose any blurring technique ). |
| 3. python deblurring.py |
| |
| **Steps for Inference:** |
| 1. place your Blurred sketches in the folder names blurred_input (.jpg, .png ) |
| 2. python deblur_inference.py |
| 3. Deblurred images are saved in a folder named deblurred_output. |
| 4. The filenames will be prefixed with deblurred_. |
| |
| ### **3. Image Translator Module** |
| |
| Description: Converts sketches into photo-realistic images using a GAN architecture, preserving structure and enhancing realism. |
| |
| ## Features |
| - **Generator**: Converts input sketches to realistic images using residual blocks. |
| - **Discriminator**: Distinguishes between real and generated images using a patch-based structure. |
| - **Dataset**: Loads paired sketches and images from folders for training. |
| - **Training Pipeline**: Trains the generator and discriminator alternately to improve the quality of generated images. |
| - **Image Generation**: Saves generated images from input sketches in a specified output folder. |
| |
| **Usage:** |
| Install the following Python libraries: |
| - `torch` |
| - `torchvision` |
| - `Pillow` |
| |
| **Steps to execute** |
| 1. Place input sketches in the sketches folder and place corresponding real images in the images folder for training. |
| 2. python sketch_to_image.py |
| 3. After training, the script automatically processes the sketches in sketches/ and saves the generated images in the generated_images/ folder. |
|
|
| Thank you... |