Skip to content

Commit 038627d

Browse files
authored
Merge pull request #7 from Collonville/develop
Version 0.02
2 parents f588b9c + eca758b commit 038627d

29 files changed

+678
-2
lines changed

.coveragerc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[run]
2+
source = ife

.github/ISSUE_TEMPLATE.md

Whitespace-only changes.

.github/PULL_REQUEST_TEMPLATE.md

Whitespace-only changes.

.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Python byte code
2+
__pycache__/
3+
*.py[cod]
4+
5+
# PyCharm
6+
.idea/
7+
8+
.coverage
9+
10+
# Poetry build file
11+
.dist/
12+
dist/
13+
14+
# mypy
15+
.mypy_cache/
16+
.dmypy.json
17+
dmypy.json

.travis.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
language: python
2+
3+
python:
4+
- "3.6"
5+
- "3.6-dev"
6+
- "3.7"
7+
- "3.7-dev"
8+
9+
branches:
10+
only:
11+
- master
12+
- develop
13+
14+
before_install:
15+
- pip install --upgrade pip
16+
- pip install black
17+
- pip install poetry
18+
19+
before_script:
20+
- flake8 ife --ignore E501
21+
- black --diff ife
22+
- mypy --strict-optional --disallow-untyped-defs --disallow-untyped-calls --ignore-missing-imports --no-incremental ife
23+
24+
install:
25+
- poetry install -v
26+
- pip install coveralls
27+
script:
28+
- coverage run -m unittest discover
29+
30+
after_success:
31+
- coverallspoetrey

LICENSE

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Copyright (c) 2019, Collonville. All rights reserved.
2+
3+
Redistribution and use in source and binary forms, with or without
4+
modification, are permitted provided that the following conditions are
5+
met:
6+
7+
* Redistributions of source code must retain the above copyright
8+
notice, this list of conditions and the following disclaimer.
9+
* Redistributions in binary form must reproduce the above
10+
copyright notice, this list of conditions and the following disclaimer
11+
in the documentation and/or other materials provided with the
12+
distribution.
13+
* Neither the name of Collonville nor the names of its
14+
contributors may be used to endorse or promote products derived from
15+
this software without specific prior written permission.
16+
17+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE

MANIFEST.in

Whitespace-only changes.

README.md

Lines changed: 103 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,103 @@
1-
# ImageFeatureExtractor
2-
Want a great image features??? Use IFE package!!!
1+
# Image Feature Extractor(IFE)
2+
[![Coverage Status](https://coveralls.io/repos/github/Collonville/ImageFeatureExtractor/badge.svg)](https://coveralls.io/github/Collonville/ImageFeatureExtractor)
3+
[![Build Status](https://travis-ci.org/Collonville/ImageFeatureExtractor.svg?branch=develop)](https://travis-ci.org/Collonville/ImageFeatureExtractor)
4+
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/115c65043153459cbfc5026ea53be08d)](https://www.codacy.com/app/Collonville/ImageFeatureExtractor?utm_source=github.com&utm_medium=referral&utm_content=Collonville/ImageFeatureExtractor&utm_campaign=Badge_Grade)
5+
6+
## What is this?
7+
`IFE` is a package to get an image feature more easily for Python. It contains many kinds of feature extract algorithms.
8+
9+
## 1. Features
10+
### Color Moment
11+
- Mean, Median, Variance, Skewness, Kurtosis of `RGB, HSV, HSL, CMY`
12+
13+
## 2. Examples
14+
Import the basic image reader of IFE.
15+
```python
16+
from ife.io.io import ImageReader
17+
```
18+
19+
### 2.1 Get Moment
20+
Add a image file path to `read_from_single_file()`. This will return basic features class.
21+
22+
And now! You can get a RGB color moment feature from image!!
23+
```python
24+
>>> features = ImageReader.read_from_single_file("ife/data/small_rgb.jpg")
25+
>>> features.moment()
26+
array([[ 0.57745098, 0.52156863, 0.55980392],
27+
[ 0.58823529, 0.48823529, 0.54901961],
28+
[ 0.15220588, 0.12136101, 0.12380911],
29+
[-0.01944425, 0.18416571, 0.04508015],
30+
[-1.94196824, -1.55209335, -1.75586748]])
31+
```
32+
33+
Also, you can get an `flatten vector, dictionary, or pandas`
34+
```python
35+
>>> features.moment(output_type="one_col")
36+
array([ 0.57745098, 0.52156863, 0.55980392, 0.58823529, 0.48823529,
37+
0.54901961, 0.15220588, 0.12136101, 0.12380911, -0.01944425,
38+
0.18416571, 0.04508015, -1.94196824, -1.55209335, -1.75586748])
39+
40+
>>> features.moment(output_type="dict")
41+
defaultdict(<class 'dict'>, {'mean': {'R': 0.57745098039215681, 'G': 0.52156862745098043, 'B': 0.55980392156862746}, 'median': {'R': 0.58823529411764708, 'G': 0.48823529411764705, 'B': 0.5490196078431373}, 'var': {'R': 0.15220588235294119, 'G': 0.12136101499423299, 'B': 0.12380911188004615}, 'skew': {'R': -0.019444250980856902, 'G': 0.18416570783012232, 'B': 0.045080152334687214}, 'kurtosis': {'R': -1.9419682406751135, 'G': -1.5520933544103905, 'B': -1.7558674751807395}})
42+
43+
>>> features.moment(output_type="pandas")
44+
mean median var skew kurtosis
45+
R 0.577451 0.588235 0.152206 -0.019444 -1.941968
46+
G 0.521569 0.488235 0.121361 0.184166 -1.552093
47+
B 0.559804 0.549020 0.123809 0.045080 -1.755867
48+
```
49+
50+
> No! I want a HSV Color space feature :(
51+
52+
It can set another color space! Default will be RGB.
53+
```python
54+
>>> features.moment(output_type="one_col", color_space="CMY")
55+
array([ 0.42254902, 0.47843137, 0.44019608, 0.41176471, 0.51176471,
56+
0.45098039, 0.15220588, 0.12136101, 0.12380911, 0.01944425,
57+
-0.18416571, -0.04508015, -1.94196824, -1.55209335, -1.75586748])
58+
59+
>>> features.moment(output_type="dict", color_space="HSL")
60+
defaultdict(<class 'dict'>, {'mean': {'H': 0.50798329143793874, 'S': 0.52775831413836383, 'L': 0.61421568627450984}, 'median': {'H': 0.51915637553935423, 'S': 0.62898601603182969, 'L': 0.52156862745098043}, 'var': {'H': 0.13290200013401141, 'S': 0.10239897927552907, 'L': 0.051550124951941563}, 'skew': {'H': -0.078898095002588917, 'S': -0.83203104238315984, 'L': 1.0202366337483093}, 'kurtosis': {'H': -1.2599104562470791, 'S': -0.87111810912637022, 'L': -0.7502836585891588}})
61+
62+
>>> features.moment(output_type="pandas", color_space="HSV")
63+
mean median var skew kurtosis
64+
H 0.507983 0.519156 0.132902 -0.078898 -1.259910
65+
S 0.595236 0.749543 0.122723 -1.028366 -0.768867
66+
V 0.855882 0.864706 0.013867 -0.155656 -1.498179
67+
```
68+
69+
## 3. Future work
70+
### IO
71+
- Read from URL links
72+
- Read from Base64
73+
- Sliding window
74+
- Video files
75+
76+
### Color space
77+
- CMYK
78+
- CIE Lab
79+
- XYZ
80+
81+
### Features
82+
- Value normalize
83+
- Average Gradient
84+
- LBP
85+
- Histogram
86+
- Color harmony
87+
- Entropy
88+
- Brightness measure
89+
- Contrast measure
90+
- Saturation measure
91+
- Colourfulness
92+
- Naturalness
93+
- Color fidelity metric
94+
- Saliency map
95+
- Fisher vector
96+
- VGG16, 19 layer feature
97+
- and more...
98+
99+
## 4. Author
100+
@Collonville
101+
102+
## 5. Licence
103+
BSD-3-Clause

ife/__init__.py

Whitespace-only changes.

ife/data/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)