Coder Social home page Coder Social logo

1044197988 / python-image-feature-extraction Goto Github PK

View Code? Open in Web Editor NEW
379.0 4.0 93.0 873 KB

Python实现提取图像的纹理、颜色特征,包含快速灰度共现矩阵(GLCM)、LBP特征、颜色矩、颜色直方图。

License: Apache License 2.0

Python 100.00%
python image image-processing glcm lbp rgb rgb-histogram python-glcm-lbp histogram py-lbp

python-image-feature-extraction's Introduction

Python-Image-feature-extraction

Python实现提取图像的纹理、颜色特征,包含快速灰度共现矩阵(GLCM)、LBP特征、颜色矩、颜色直方图。

原始图片

image

纹理特征

GLCM

numpy的快速灰度共现矩阵(GLCM)。该脚本在没有每个像素For循环的情况下计算GLCM,并且在scikit-image上比GLCM更快地工作。

import fast_glcm
from skimage import data

if __name__ == '__main__':
    img = data.camera()
    glcm_mean = fast_glcm.fast_glcm_mean(img)

GLCM

LBP

获取图像的LBP特征:对图像的原始LBP模式、等价LBP模式、旋转不变LBP模式,以及等价旋转不变LBP模式的LBP特征进行提取以及显示。
get_LBP_from_Image.py 主要文件 获取图像的LBP特征。
get_resolve_map.py和get_uniform_map.py主要是做降维后新的像素值的映射。已经将求出的结果写入了get_LBP_from_Image.py中,这两个主要是帮助理解算法降维后新的像素值怎么得到的。 LBP

颜色特征

颜色矩

颜色是彩色图像最重要的内容之一,被广泛用于图像检索中。但从图像中提取颜色特征时,很多算法都先要对图像进行量化处理。量化处理容易导致误检,并且产生的图像特征维数较高,不利于检索。AMA Stricker和M Orengo提出了颜色矩的方法,颜色矩是一种简单有效的颜色特征表示方法,有一阶矩(均值,mean)、二阶矩(方差, variance)和三阶矩(斜度,skewness)等,由于颜色信息主要分布于低阶矩中,所以用一阶矩,二阶矩和三阶矩足以表达图像的颜色分布,颜色矩已证明可有效地表示图像中的颜色分布,该方法的优点在于:不需要颜色空间量化,特征向量维数低;但实验发现该方法的检索效率比较低,因而在实际应用中往往用来过滤图像以缩小检索范围。

颜色直方图

RGB-histogram gray-histogram histogram

参考

python-image-feature-extraction's People

Contributors

1044197988 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

python-image-feature-extraction's Issues

the displayed picture

大佬,你好,
首先感谢你的代码,看过你的代码后对我帮助颇大,但是我在你的代码里发现一点小瘕疵,在 纹理特征文件夹下的GLCM下的sample.py代码里,使用plt显示转换后的图片时,并没有显示正确的灰度图片,而是错误的将灰度图片以三通道形式的图片显示。

glcm angle issue

Hi I have a quick question for you. Since you already worked in GLCM and calculated glcm for 4 directions.
So I am trying to calculate the texture features of my 1 image using GLCM. Now if I use these properties properties = ['contrast', 'energy','ASM', 'homogeneity', 'correlation', 'dissimilarity'] and calculate GLCM in 4 direction angles like [0, np.pi / 4, np.pi / 2, 3 * np.pi / 4] then I get 4 *6=24 feature values. Now my professor is saying 24 features are not enough for the feature selection so calculate GLCM in more directions to get more feature values like previously my directions were [0, 45,90,135] now he is asking me to calculate in [120, 180, 270], etc just to get more features. But everywhere on google, I have seen people are calculating GLCM in the standard four directions that is [0, np.pi / 4, np.pi / 2, 3 * np.pi / 4] so is this correct if I calculate GLCM in the other directions which he mentioned?

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.