Giter Club home page Giter Club logo

edge-detect's Introduction

Edge Detection

Sobel edge detection algorithms implemented in Python for grayscale images.

This project intends to serve as a model for future Stochastic Computing applications.

Progress

  • Deterministic
    • Software
    • Hardware
  • Stochastic
    • Software
      • LFSR
      • Module
      • Wrapper
    • Hardware

Quick-start

All commands consider a Linux environment

Deterministic implementation

cd ./sw-sim
python interactiveDetSobel.py
src, edges = detectAndShow('320px-1000_years_Old_Thanjavur_Brihadeeshwara_Temple_View_at_Sunrise.jpg')

This will calculate an edge image in a few seconds and plot the result in a new window. It also returns the source image as a numpy array (src) and the 8-bit edges array. Expected image: Temple View edge image processed by deterministic algorithm

Stochastic implementation

cd ./sw-sim
python interactiveStochSobel.py
src, edges = detectAndShow('320px-1000_years_Old_Thanjavur_Brihadeeshwara_Temple_View_at_Sunrise.jpg')

This version takes more time than the deterministic version since Python types and code have not been optimized to do the bit-wise operations that Stochastic Computer takes advantage of. Expected image: Temple View edge image processed by stochastic algorithm

Parallel processing with Ray

If available, you may opt to use

python interactiveRayStochSobel.py

instead. This version defaults to starting 8 threads to process images, which is about 8 times faster than the single-threaded version on modern CPUs (which already come with 8 threads).

Remarks:

Dependencies

Python dependencies:

  • Python >= 3.9
  • Libraries:
    • opencv-python
    • matplotlib
    • numpy
    • scipy
    • bitarray
    • ray (recommended)
      • for parallel processing in simulation
      • currently, only supported on Linux and MacOS
    • wheel (recommended for bitarray support) Hardware simulation dependencies:
  • Icarus Verilog 10.1
  • make (for ease of executing multiple commands)

This project currently uses stochastic circuits derived from ones synthesized with scsynth/STRAUSS

Installation recommendation:

  • Newer versions of Python 3 (like 3.8.x) come with pip preinstalled. PyPi/pip is a simple package manager for Python (normally aliased as pip3)
  • For this project:
pip3 install --user wheel numpy scipy matplotlib opencv-python bitarray 'ray[default]'

edge-detect's People

Contributors

danilo-bc avatar

Stargazers

Q H avatar Xu Ying avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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.