PHP Classes

How to Use a PHP Image Processing Library to Tell if a Image is Simple or Complex Using the Package Shannon Entropy Calculator: Measure image complexity using Shannon entropy

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2025-04-01 (6 days ago) RSS 2.0 feedNot yet rated by the usersTotal: Not yet counted Not yet ranked
Version License PHP version Categories
shannonentropycalcul 1.0MIT/X Consortium ...5Algorithms, PHP 5, Graphics
Description 

Author

This package can measure image complexity using Shannon entropy.

It can take the path of an image file and perform entropy analysis.

The class returns an array with a number that is the entropy level and a text string that explains the meaning of the returned entropy level.

Picture of Roberto Aleman
  Performance   Level  
Name: Roberto Aleman <contact>
Classes: 25 packages by
Country: Venezuela Venezuela
Innovation award
Innovation award
Nominee: 14x

Winner: 1x

Instructions

Please check this example script to learn how to use this package.

Example

<?php

/* Author: Roberto Aleman, ventics.com , license: GNU AGPLv3 */

echo "Author: Roberto Aleman, ventics.com , license: GNU AGPLv3 <br/><br/>";

include
'ShannonEntropyCalculator.php';



// Ejemplo de uso
$imagePath = 'img0.png'; // Reemplaza con la ruta de tu imagen
$calculator = new ShannonEntropyCalculator($imagePath);
$resultado = $calculator->calcularEntropia();
echo
"<img src='img0.png' style='width: 150px;height: 150px;'><br/>";
echo
"Shannon Entropy: " . $resultado['entropia'] . "\n";
echo
"Results: " . $resultado['diagnostico'] . "\n";
echo
"<br/>------------------------------------<br/><br/>";


$imagePath = 'img1.png'; // Reemplaza con la ruta de tu imagen
$calculator = new ShannonEntropyCalculator($imagePath);
$resultado = $calculator->calcularEntropia();
echo
"<img src='img1.png' style='width: 150px;height: 150px;'><br/>";
echo
"Shannon Entropy: " . $resultado['entropia'] . "\n";
echo
"Results: " . $resultado['diagnostico'] . "\n";
echo
"<br/>------------------------------------<br/><br/>";


$imagePath = 'img2.png'; // Reemplaza con la ruta de tu imagen
$calculator = new ShannonEntropyCalculator($imagePath);
$resultado = $calculator->calcularEntropia();
echo
"<img src='img2.png' style='width: 150px;height: 150px;'><br/>";
echo
"Shannon Entropy: " . $resultado['entropia'] . "\n";
echo
"Results: " . $resultado['diagnostico'] . "\n";
echo
"<br/>------------------------------------<br/><br/>";



$imagePath = 'img3.png'; // Reemplaza con la ruta de tu imagen
$calculator = new ShannonEntropyCalculator($imagePath);
$resultado = $calculator->calcularEntropia();
echo
"<img src='img3.png' style='width: 150px;height: 150px;'><br/>";
echo
"Shannon Entropy: " . $resultado['entropia'] . "\n";
echo
"Results: " . $resultado['diagnostico'] . "\n";
echo
"<br/>------------------------------------<br/><br/>";


$imagePath = 'img4.png'; // Reemplaza con la ruta de tu imagen
$calculator = new ShannonEntropyCalculator($imagePath);
$resultado = $calculator->calcularEntropia();
echo
"<img src='img4.png' style='width: 150px;height: 150px;'><br/>";
echo
"Shannon Entropy: " . $resultado['entropia'] . "\n";
echo
"Results: " . $resultado['diagnostico'] . "\n";
echo
"<br/>------------------------------------<br/><br/>";


?>


  Files folder image Files (10)  
File Role Description
Plain text file example_sec.php Example Example script
Image file img0.png Output Icon image
Image file img1.png Output Icon image
Image file img2.png Output Icon image
Image file img3.png Icon Icon image
Image file img4.png Output Icon image
Plain text file LICENSE Lic. License text
HTML file README.md Doc. Documentation
Plain text file ShannonEntropyCalculator.php Class Class source
HTML file ShannonEntropyCalc..._documentation.html Doc. Documentation

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads  
 100%
Total:0
This week:0