Giter VIP home page Giter VIP logo

saifrahmed / rasterfairy Goto Github PK

View Code? Open in Web Editor NEW

This project forked from quasimondo/rasterfairy

0.0 1.0 0.0 61.14 MB

The purpose of Raster Fairy is to transform any kind of 2D point cloud into a regular raster whilst trying to preserve the neighborhood relations that were present in the original cloud. A typical use case is if you have a similarity clustering of images and want to show the images in a regular table structure.

License: BSD 3-Clause "New" or "Revised" License

Python 100.00%

rasterfairy's Introduction

About RasterFairy-Py3

This is a fork of the official RasterFairy that has Python 3 support. Since the official repo isn't maintained (there is an unmerged pull request for Python 3 from April, 2017), I made a Python 3 compatible version on my own.

Below is the README from the official RasterFairy repo.

RasterFairy

The purpose of Raster Fairy is to transform any kind of 2D point cloud into a regular raster whilst trying to preserve the neighborhood relations that were present in the original cloud. A typical use case is if you have a similarity clustering of images and want to show the images in a regular table structure.

Requirements

  • Python 2.7 (Python 3 is not supported yet)
  • numpy > =1.7.1
  • scipy - only for coonswarp and rfoptimizer

Installation

From the root directory, run:

pip install .

Usage

Basic usage:

import rasterfairy

#xy should be a numpy array with a shape (number of points,2) 
grid_xy = rasterfairy.transformPointCloud2D(xy)
#grid_xy will contain the points in the same order but aligned to a grid

To-Do

  • Add hexagonal circle grid
  • Look into further improving splitting process
  • Add Python 3 support

Related Projects

As I learned after publishing there is a very similar earlier developed technique called IsoMatch by O. Fried, S. DiVerdi, M. Halber, E. Sizikova and A. Finkelstein. Unfortunately I was not aware of it during my research and their solution works differently, but you might want to check it out and see if it's better suited to your requirements: IsoMatch Codebase

Another related technique is Kernelized Sorting by Novi Quadrianto, Le Song, Alex J. Smola. from 2009 Kernelized Sorting

Kyle McDonald's CloudToGrid project is a Python-based implementation of the Hungarian method.

A note about porting this to other languages

If you want to port this algorithm to another language like C++, Javascript or COBOL I'm very happy about it. Only there is a little thing about "porting etiquette" I want to mention - yes, it will take you some work to translate those 500+ lines of code into the language of your choice and you might have to change a few things to make it work. Nevertheless, the algorithm stays the same and yes - I'm probably quite vain here - but I like to read my name. In big letters. Bigger than yours. And don't even think about writing anything like "insipired by". So the proper titling for a port will read something like "Raster Fairy by Mario Klingemann, C++ port by YOU".

rasterfairy's People

Contributors

quasimondo avatar genekogan avatar flhorizon avatar staticskies 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.