GithubHelp home page GithubHelp logo

spongebob's Introduction

Sponge Bob

Calculate porosity by processing microscopic images using openCV.

Instalation

python3 setup.py bdist_wheel
cd dist
pip3 install --upgrade spongeBob-0.1-py3-none-any.whl

Usage

spongeBob [-h] --output-file OUTPUT_FILE dataInput

As a dataInput program takes:

  • Path to a directory containing images.
  • Path to a image file.

Program can save results into a CSV file. Option --output-file takes a path to this file.

Example:

python3 -m spongeBob /home/patrik/porositySamples --output-file=/home/patrik/porosity.csv

Example output:

6 images detected in '/home/patrik/porosity'
Loading file /home/patrik/porosity/8bars - center.jpg ...
Loading file /home/patrik/porosity/8bars - edge.jpg ...
Loading file /home/pqtrik/porosity/12bars - center.jpg ...
Loading file /home/patrik/porosity/12bars - edge.jpg ...
Loading file /home/patrik/porosity/15bars - center.jpg ...
Loading file /home/patrik/porosity/15bars - edge.jpg ...
Processing image '/home/patrik/porosity/8bars - center.jpg' ...
Porosity: 39.35546875%
Processing image '/home/patrik/porosity/8bars - edge.jpg' ...
Porosity: 48.59822591145833%
Processing image '/home/patrik/porosity/12bars - center.jpg' ...
Porosity: 45.508544921875%
Processing image '/home/patrik/porosity/12bars - edge.jpg' ...
Porosity: 40.063313802083336%
Processing image '/home/patrik/porosity/15bars - center.jpg' ...
Porosity: 38.288167317708336%
Processing image '/home/patrik/porosity/15bars - edge.jpg' ...
Porosity: 25.493896484375%
Exporting results to /home/patrik/output.csv ...

Example csv output file:

filename porosity
/home/patrik/porosity/8bars - center.jpg 39.35546875
/home/patrik/porosity/8bars - edge.jpg 48.59822591145833
/home/patrik/porosity/12bars - center.jpg 45.508544921875
/home/patrik/porosity/12bars - edge.jpg 40.063313802083336
/home/patrik/porosity/15bars - center.jpg 38.288167317708336
/home/patrik/porosity/15bars - edge.jpg 25.493896484375

How does it work?

Let's consider the sponge image.

Alt text

First the image is converted to a grayscale.

Alt text

Then the avarage brightness of the image is calculated and all pixels with the value below avarage are changed to 0 and all other pixels are changed to 255.

Alt text

Then the program calculates the porosity by calculating what percentage of all pixels in the processed image is taken by the dark pixels (pixels with value 0).

spongebob's People

Contributors

bill2462 avatar

Stargazers

 avatar Yishen (Eason) Zhang avatar

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.