Coder Social home page Coder Social logo

gabrock94 / pyaesthetics Goto Github PK

View Code? Open in Web Editor NEW
33.0 4.0 6.0 7.19 MB

A python package to extract visual features about the aesthetic appearance from still images.

License: GNU General Public License v3.0

Python 18.44% Jupyter Notebook 81.56%
website feature-extraction aesthetic aesthetic-visual-analysis python human-computer-interaction user-interface webdesign image image-processing

pyaesthetics's Introduction

Logo

pyaesthetics

GitHub release PyPI PyPI pyversions PyPI status PyPI downloads Downloads Documentation Status DOI

Pyaesthetics (formlerly known as PrettyWebsite) is a python package designed to estimate visual features concerning the aesthetic appearance of a still image.

Features

The module can estimate the following features:

  • Brightness (in both the BT709 and BT601 standards)
  • Contrast (RMS or Michelson contrast)
  • Saturation
  • Visual Complexity (either by using the weight of the image or by Quadratic Tree Decomposition)
  • Simmetry (using Quadratic Tree Decomposition)
  • Colorfulness (in both the HSV and RGB color spaces)
  • Presence and number of human faces
  • Color distribution
  • Number of images within the image
  • Surface of visual and textual areas within the image
  • Ratio between visual and textual areas

Installation

pyaesthetics can be installed using pip:

pip install pyaesthetics

or manually by downloading or cloning the repository and, from the root folder of the project, running:

python setup.py pyaesthetics

Tesseract and pytesseract

Tesseract and pytesseract are also required. To install tesseract please visit: https://tesseract-ocr.github.io/tessdoc/Installation.html

Updating the package

To update the package via pip, you can use:

pip install --user --upgrade pyaesthetics

Example

pyaeshtetics modules can be used one at the time to estimate one specific feature, or they can be automatically called using an automated entrypoint that calls all the available modules at once.

Example 1: one single feature (e.g. Brigthness BT601)

#load only the neede functions from the specific module
from pyaesthetics.brightness import relativeLuminance_BT601, sRGB2RGB
import cv2 #to open and handle images

img = "/path/to/image/image.jpg" #path to a sample image

img = cv2.imread(img) #load the image
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) #convert to the RGB colorscheme
img = sRGB2RGB(img) #convert pixels to their linear RGB values
print(relativeLuminance_BT601(img)) #evaluate luminance on the BT601 standard

Example 2: Complete analysis

import pyaesthetics
img = "/path/to/image/image.jpg" #path to a sample image
results = pyaesthetics.analysis.analyzeImage(img, method="complete") #perform all the availabe analysis using standard parameters
print(results)

Or for a faster analysis:

import pyaesthetics
img = "/path/to/image/image.jpg" #path to a sample image
results = pyaesthetics.analysis.analyzeImage(img, method="fast") #perform a subset of the analysis using standard parameters.
print(results)

Documentation

You can check the full documentation here: https://prettywebsite.readthedocs.io/en/latest/

Requirements

  • numpy
  • scipy
  • matplotlib
  • pandas
  • opencv-python
  • imutils
  • pytesseract

Contacts

Feel free to contact me for questions, suggestions or to give me advice as well at: [email protected] or [email protected]

Scientific Publications that used pyaesthetic

  • Gabrieli, G., Bornstein, M. H., Setoh, P., & Esposito, G. (2022). Machine learning estimation of users’ implicit and explicit aesthetic judgments of web-pages. Behaviour & Information Technology, 1-11.
  • Bizzego, A., Gabrieli, G., Azhari, A., Lim, M., & Esposito, G. (2022). Dataset of parent-child hyperscanning functional near-infrared spectroscopy recordings. Scientific Data, 9(1), 625.
  • Cianfanelli, B., Esposito, A., Spataro, P., Santirocchi, A., Cestari, V., Rossi-Arnaud, C., & Costanzi, M. (2023). The binding of negative emotional stimuli with spatial information in working memory: A possible role for the episodic buffer. Frontiers in Neuroscience, 17, 445.
  • Music A., Maerten A., Wagemans J. (2023).Beautification of images by generative adversarial networks. Journal of Vision 2023;23(10):14.

Presentation

  • Gabrieli, G., Scapin, G., & Esposito, G. (2022). Pyaesthetic, a python package for empirical aesthetic analysis. XXVII Conference of the International Association of Empirical Aesthetics, Philadelphia, United States. https://giuliogabrieli.it/posters/iaea2022/

Sponsors

The project has been sponsored by Gitkraken.

Coffee?

Buy Me a Coffee at ko-fi.com

pyaesthetics's People

Contributors

gabrock94 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

Watchers

 avatar  avatar  avatar  avatar

pyaesthetics's Issues

ToDo

  • Fix warning in text / image ratio when area of the image == 0
    /usr/local/lib/python3.5/dist-packages/prettywebsite-0.0.4-py3.5.egg/prettywebsite/spaceBasedDecomposition.py:63: RuntimeWarning: divide by zero encountered in long_scalars return({"textImageRatio":sum(text) / sum(image),"textArea":sum(text),"imageArea":sum(image),"nImages":len(image)})

Improve Text/Image Area dection

At the moment, one of the bottleneck of the package is the detection of the ratio between visual and textual areas.
The process involves the detection of areas by means of a Space Based Decomposition, followed by an OCR detection for each area. The module should be rewritten to avoid the need of running the OCR algorithm several times such as in https://www.geeksforgeeks.org/text-localization-detection-and-recognition-using-pytesseract/, and then compare empirically the areas detected via the space based decomposition

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.