Git Product home page Git Product logo

segraph's Introduction

DOI License: GPL v3 Open Source Love dependencies Status Build Status

The segraph library provides modules for creating graphs from SLIC segments. This can be used with PyStruct library for image segmentation using CRF.

:octocat: Link to GitHub Repo

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See examples to see a quick example.

Prerequisites

You will need to have NumPY installed on your system. The segraph library was built with Python 2.7, keeping in mind the stability with Python 3+, but it is not guranteed.

pip install numpy

Installation

There are multiple ways to install segraph on your system:

Python Package Index

segraph is now available at https://pypi.python.org/pypi/segraph/0.5

1. Download the tar/zip from https://pypi.python.org/pypi/segraph/0.5
2. Move the package to your desired location / python version, and unzip the archive. 
Optionally, if you have a linux-based machine (Ubuntu/OSX):
      tar xvzf segraph-0.x.tar.gz -C /path/to/desireddirectory
3. Migrate to the segraph folder, and run
      python setup.py install

Using pip

pip install segraph

To upgrade,

pip install --upgrade segraph

Using segraph

segraph can be very helpful for creating graphs from SLIC segmented images (superpixels). Here is an example usage:

from skimage.segmentation import slic
from skimage.util import img_as_float
from skimage import io as skimageIO
from segraph import create_graph
import numpy as np

image = img_as_float(skimageIO.imread("segraph/data/flowers.png"))
segments = slic(image, n_segments=500, sigma=1.0)
# Create graph of superpixels 
vertices, edges = create_graph(segments)

# Compute centers:
gridx, gridy = np.mgrid[:segments.shape[0], :segments.shape[1]]
centers = dict()
for v in vertices:
    centers[v] = [gridy[segments == v].mean(), gridx[segments == v].mean()]

segraph can be used with PyStruct library for image segmentation using CRF.

Contributing

You are welcome to send a pull-request.

Contributors

Thanks to all the contributors for making it even more awesome !

  • @pinkfloyd06

Authors

License

This project is licensed under the GNU General Public License v3 - see the LICENSE.md file for details

forthebadge

segraph's People

Contributors

alivcor 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.