All Projects → lnugraha → Trimap_generator

lnugraha / Trimap_generator

Licence: mit
Generating automatic trimap through pixel dilation and strongly-connected-component algorithms

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Trimap generator

Multiclass Semantic Segmentation Camvid
Tensorflow 2 implementation of complete pipeline for multiclass image semantic segmentation using UNet, SegNet and FCN32 architectures on Cambridge-driving Labeled Video Database (CamVid) dataset.
Stars: ✭ 67 (-43.7%)
Mutual labels:  jupyter-notebook, image-segmentation
Solt
Streaming over lightweight data transformations
Stars: ✭ 249 (+109.24%)
Mutual labels:  jupyter-notebook, image-segmentation
Pixel level land classification
Tutorial demonstrating how to create a semantic segmentation (pixel-level classification) model to predict land cover from aerial imagery. This model can be used to identify newly developed or flooded land. Uses ground-truth labels and processed NAIP imagery provided by the Chesapeake Conservancy.
Stars: ✭ 217 (+82.35%)
Mutual labels:  jupyter-notebook, image-segmentation
Pytorch Unet
Simple PyTorch implementations of U-Net/FullyConvNet (FCN) for image segmentation
Stars: ✭ 470 (+294.96%)
Mutual labels:  jupyter-notebook, image-segmentation
Robot Surgery Segmentation
Wining solution and its improvement for MICCAI 2017 Robotic Instrument Segmentation Sub-Challenge
Stars: ✭ 528 (+343.7%)
Mutual labels:  jupyter-notebook, image-segmentation
Ternausnetv2
TernausNetV2: Fully Convolutional Network for Instance Segmentation
Stars: ✭ 521 (+337.82%)
Mutual labels:  jupyter-notebook, image-segmentation
Tensorflow Segmentation
Semantic image segmentation in Tensorflow
Stars: ✭ 260 (+118.49%)
Mutual labels:  jupyter-notebook, image-segmentation
Concise Ipython Notebooks For Deep Learning
Ipython Notebooks for solving problems like classification, segmentation, generation using latest Deep learning algorithms on different publicly available text and image data-sets.
Stars: ✭ 23 (-80.67%)
Mutual labels:  jupyter-notebook, image-segmentation
Lovaszsoftmax
Code for the Lovász-Softmax loss (CVPR 2018)
Stars: ✭ 1,148 (+864.71%)
Mutual labels:  jupyter-notebook, image-segmentation
Ysda deeplearning17
Yandex SDA classes on deep learning. Version of year 2017
Stars: ✭ 118 (-0.84%)
Mutual labels:  jupyter-notebook
Texture Synthesis Nonparametric Sampling
Implementation of "Texture Synthesis with Non-Parametric Sampling" paper by Alexei A. Efros and Thomas K. Leung
Stars: ✭ 119 (+0%)
Mutual labels:  jupyter-notebook
Qiskit Tutorials
A collection of Jupyter notebooks showing how to use the Qiskit SDK
Stars: ✭ 1,777 (+1393.28%)
Mutual labels:  jupyter-notebook
Tensorflow shiny
A R/Shiny app for interactive RNN tensorflow models
Stars: ✭ 118 (-0.84%)
Mutual labels:  jupyter-notebook
Pydatadc 2018 Tidy
PyData 2018 tutorial for tidying data
Stars: ✭ 119 (+0%)
Mutual labels:  jupyter-notebook
Planet Amazon Deforestation
The open source repository for the Kaggle Amazon forest devastation competition https://www.kaggle.com/c/planet-understanding-the-amazon-from-space
Stars: ✭ 118 (-0.84%)
Mutual labels:  jupyter-notebook
Bayes By Backprop
PyTorch implementation of "Weight Uncertainty in Neural Networks"
Stars: ✭ 119 (+0%)
Mutual labels:  jupyter-notebook
Statistical Learning Method
《统计学习方法》笔记-基于Python算法实现
Stars: ✭ 1,643 (+1280.67%)
Mutual labels:  jupyter-notebook
Pytextrank
Python implementation of TextRank for phrase extraction and summarization of text documents
Stars: ✭ 1,675 (+1307.56%)
Mutual labels:  jupyter-notebook
Linear Attention Recurrent Neural Network
A recurrent attention module consisting of an LSTM cell which can query its own past cell states by the means of windowed multi-head attention. The formulas are derived from the BN-LSTM and the Transformer Network. The LARNN cell with attention can be easily used inside a loop on the cell state, just like any other RNN. (LARNN)
Stars: ✭ 119 (+0%)
Mutual labels:  jupyter-notebook
Kaggle challenge
This is the code for "Kaggle Challenge LIVE" By Siraj Raval on Youtube
Stars: ✭ 119 (+0%)
Mutual labels:  jupyter-notebook

Automatic Trimap Generator

Keywords: Alpha Compositioning,Trimap
關鍵: Alpha合成、三分圖
キーワード:アルファチャンネル、マスク画像

Introduction

  • In image matting, trimap estimates foreground from background by inscribing unknown region
  • Mathematically, an image can be represented by the following equation:

In this equation, Ip denotes the entire image, Fp denotes a definite foreground, and Bp denotes a definite background.
On the other hand, is an alpha matte constant with a value ranging between 0 and 1. An value of 0 indicates that the pixel belongs to a background; whereas an value of 1 indicates otherwise. Any value in between means a mixed pixel that has to be determined.

Descriptions

  • Generate a trimap (foreground, background, and unknown regions) from an input of binary (mask) image
  • Foreground has a pixel value of 255; background has a pixel value of 0; and unknown has a pixel value of 127
  • In this example, the trimap is generated by extending a binary image of a previously segmented tumor
  • A binary image consists of two parts: foreground (white) which is the tumor and background (black) which is the surrounding region
  • Keep in mind that the unknown region is simply an approximation rather than an exact delineation. Therefore, matting process becomes a crucial key to extract foreground images with exact precision
  • All binary images in this repository were generated from U-Net with a Jaccard's Coefficient of 0.94 (out of 1), indicating a high agreement between the ground truth and segmented mask images
  • Image erosion feature is added which may anticipate any overestimating foreground issue

Input: a binary image (from a segmented lesion)
Output: a trimap with unknown region (gray) from tumor dilation

Flow Chart


TO DO:

  • [ ] Finding The Most Dominant Foreground -- automatic kernel design (generate an odd-sized matrix from an integer)
  • [ ] Contour Detection Module -- an alternative method to circumscribe foreground without U-Net segmentation
  • [ ] Mask Contour Module -- create a binary mask from contour point polygon

Examples

1 Dilating the binary image (trimap_module.py)

import cv2, os, sys
from trimap_module import trimap

path    = "./image/samples/seg_image.png";
image   = extractImage(path);
name    = "testImage";
size    = 10; # how many pixel extension do you want to dilate
number  = 1;  # numbering purpose 
trimap(image, name, size, number, erosion=False)
FULL IMAGE MASK IMAGE FOREGROUND BACKGROUND
alt text alt text alt text alt text
BINARY IMAGE TRIMAP (10 PX) TRIMAP (20 PX) TRIMAP (30 PX)
alt text alt text alt text alt text

2 Handling Non-Dominant Foreground (trimap_module.py)

import cv2, os, sys
from trimap_module import trimap
path    = "./image/test_images/test_image_10.png";
image   = extractImage(path);

kernel  = np.ones( (9,9), np.uint8 ); 
opening = unit01.morph_close(image,kernel);
trimap(opening, "trimap_result", 10, 1, erosion=False)
NOISES ORIGINAL IMAGES TRIMAPS PREVIOUS TRIMAPS NEW
Outside FG alt text alt text alt text
Inside FG alt text alt text alt text

3 Impact of Eroding or Expanding Foreground (trimap_class.py)

import cv2, os, sys
from trimap_class import trimap
path    = "./image/test_images/test_image_12.png";
image   = extractImage(path);
    
trimap(image, ""trimap_result, 10, 1, DEFG=Erosion, num_iter=3);

The illustration starts with zero erosion/dilation; followed with one, three, five, until eleven iterations (an increment of two).

Erosion Expansion

4 Image Processing using Feature Extraction Module (feature_extraction.py)
Coming Soon

References

  1. Vikas Gupta and Shanmuganathan Raman. (2017). "Automatic Trimap Generation for Image Matting". Indian Institute of Technology, Gandhinagar, IND download
  2. Olivier Juan and Reanud Keriven. (2005). "Trimap Segmentation for Fast and User-Friendly Alpha Matting". FRA download
  3. Jimei Yang, Brian Price, Scott Cohen, Honglak Lee, and Ming-Hsuan Yang. (2016). "Object Contour Detection with a Fully Convolutional Encoder-Decoder Network". Adobe Research, USA download
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].