Code Monkey home page Code Monkey logo

kfupm-graduation-book-image-fixer's Introduction

Face Alignment and Adjustment Algorithm

This algorithm takes in images of people and outputs them aligned and centered so that the face is top-centered with a small gap on top. The algorithm uses cv2 face cascade classifier to detect faces in the input image. It then selects the largest face and aligns the image. Finally, it fills in missing pixels using cv2 inpaint and zooms in and resizes the output to a fixed size. The algorithm is written in Python and uses OpenCV and NumPy.

Functions

  1. select_largest_face function selects the largest face in the input image using the cv2 face cascade classifier.

  2. align function aligns the input image by shifting it so that the eyes are level and centered in the image.

  3. zoom function zooms in and resizes the aligned image to a fixed size.

Algorithm Steps

Input Images

Image 3 Image 2 Image 1

Process

flowchart LR
  A(Input Images) --> B{Faces Detected?}
  subgraph Image Processing Steps
    direction LR
    B -->|Yes| C[Select Largest Face]
    B -->|No| D[Output Error]
    C --> E[Align and Shift]
    E --> F[Fill Missing Pixels]
    F --> G[Zoom and Resize]
  end
  D --> z((( )))
  G --> z
Loading

Output Images

Image 3 Image 2 Image 1

Installation

To use this algorithm, you must have the following packages installed:

  • OpenCV (cv2)
  • NumPy

You can install these packages using pip:

pip install opencv-python numpy

After installing the required packages, you can test it via imageFixer.py.

Limitations

This algorithm has some limitations:

  • It may not work well for images with multiple faces.
  • It may not work well for images with faces that are not fully visible or are obstructed.
  • It may not work well for images with low resolution or poor lighting conditions.

kfupm-graduation-book-image-fixer's People

Contributors

faisalalali avatar

Watchers

 avatar

Forkers

diax7

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.