Giter Club home page Giter Club logo

foreground-extraction's Introduction

Foreground Extraction with OpenCV and GrabCut Algorithm

Il seguente repo contiene il progetto realizzato per il corso di Intelligenza Artificiale 2021/2022.

L’estrazione interattiva in primo piano su un'immagine avviene disegnando un rettangolo contenente la regione in primo piano da estrarre. Tale rettangolo viene dato in input all'algoritmo GrabCut presente all'interno della libreria OpenCV e viene restituita una nuova immagine contenente la regione in primo piano all’interno del rettangolo disegnato.

GrabCut è un metodo di segmentazione delle immagini basato sui tagli dei grafi che non fa uso di tecniche di Machine Learning. Nella Computer Vision la segmentazione è una delle elaborazioni delle immagini cha avviene a livello intermedio.

Testato con:

numpy 1.23.0
opencv_python 4.6.0.66
python 3.9.2

Getting Started

$ git clone https://github.com/mgranchelli/foreground-extraction.git
$ cd ./foreground-extraction
$ pip install -r requirements.txt

Basic Usage

$ python3 foreground-extraction.py -i path-image

Nella finestra che mostrerà l'immagine è possibile disegnare un rettangolo con il mouse che conterrà la regione da estrarre. Una volta disegnato il rettangolo si aprirà una nuova finestra contenente la nuova immagine con la regione in primo piano presente all'interno del rettangolo. Se -i path-image non specificato verrà aperta l'immagine di default avengers.jpeg.

Per chiudere il processo è possibile digitare q.

Example

Test effettuati:

$ python3 foreground-extraction.py

Test 1

$ python3 foreground-extraction.py

Test 2

$ python3 foreground-extraction.py -i assets/images/jon-snow.jpeg

Test 3

foreground-extraction's People

Contributors

mgranchelli avatar

Watchers

 avatar

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.