Skip to content
Extract GLCM, Region Properties, and Moments related features in a line of code and then get those into a data-frame.
Jupyter Notebook Python
Branch: master
Clone or download
Latest commit af3a293 Mar 13, 2019

xtract-features = 0.1


This package is developed to extract GLCM, Region Properties, and Moments related features in a line of code and then get those into a data-frame. This package only works for two channel grayscale images and generally is developed to extract features from X-ray images. The package isn't currently available on PyPi or Anaconda because more CBIR based features will be added to this package.

Installing the package:

The package is tested on python3 and is working as required. You need to have python3 in your systems. Use the following commands to get started with the package.

Installing OpenCV Dependencies

sudo apt-get update

# Opencv-Deps
sudo apt-get install build-essential checkinstall cmake pkg-config yasm
sudo apt-get install git gfortran
sudo apt-get install libjpeg8-dev libjasper-dev libpng12-dev
sudo apt-get install libtiff5-dev
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev
sudo apt-get install libxine2-dev libv4l-dev
sudo apt-get install libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev
sudo apt-get install qt5-default libgtk2.0-dev libtbb-dev
sudo apt-get install libatlas-base-dev
sudo apt-get install libfaac-dev libmp3lame-dev libtheora-dev
sudo apt-get install libvorbis-dev libxvidcore-dev
sudo apt-get install libopencore-amrnb-dev libopencore-amrwb-dev
sudo apt-get install x264 v4l-utils
sudo apt-get install libprotobuf-dev protobuf-compiler
sudo apt-get install libgoogle-glog-dev libgflags-dev
sudo apt-get install libgphoto2-dev libeigen3-dev libhdf5-dev doxygen 
sudo apt-get install python3-dev python3-pip

Installing using pip:

# package installation 
pip3 install git+

Clone and Install:

git clone
cd xrayimage_extractfeatures
python3 install

Getting Started:

The package is divided into six modules.
  1. Helpers
    • Extract-img-array
    • Save Pickle
    • Load Pickle
    • Show
    • Plots
  2. Feature Extraction
    • Shannon's Entropy
    • Simple Entropy
    • Feature Dictionary from Image Path
    • Feature Dictionary from Image Array
    • Get dataframe form Image Path
    • Get dataframe from Image Array
  3. GLCM Features
    • Correlation
    • Homogeneity
    • Energy
    • Contrast
    • All GLCM Features
  4. Moments
    • 24 Variant Moments
    • 7 Hu Moments
  5. Region Properties
    • 27 Region Properties functions
  6. Extras
    • 2D Convolutions
    • Segmentation

1. Helpers

Import Helpers extract-img-array extract-img-array without getID show function plots with titles plots without titles save any data inside a variable load the saved data

2. Feature Extraction

intro feature dictionary dict without ids or names output without ids dict from img array output of the above extract dataframe from path extract dataframe from img array

3. GLCM Features

glcms glcmall

4. Moments

24 moments hu moments

5. Region Properties

region props 1 region props 2 region props 3

6. Extras

a. 2D Convolutions

2d Conv

b. Segmentation

watershed segmentation

Fork the repo and install it and test it through various types of X-Ray images and put it through its paces and lets discuss some issues if present.

You can’t perform that action at this time.