Giter VIP home page Giter VIP logo

torch-warp's Introduction

torch-warp

This repository contains a torch implementation for automatically applying optical flow deformations to pairs of images in order to morph between images. The optical flow calculation and loading code is from manuelruder/artistic-videos, and is based on DeepFlow. Theoretically, you could drop in another optical flow program which outputs .flo files in the Middlebury format.

This process is inspired by Patrick Feaster's post on Animating Historical Photographs With Image Morphing.

My blog post about this process: Animating Stereograms with Optical Flow Morphing

Examples

New York Skyline Historical Photo Cat and Child

Dependencies

  • torch7
  • DeepFlow and DeepMatching binaries in the current directory, as deepflow2-static and deepmatching-static

Usage

For input, you need two PNG images of the same dimensions named e.g. filename_0.png and filename_1.png. You can then run ./run-torchwarp.sh filename to run all the steps and output the morphing animation as morphed_filename.gif.

You can also use ./run-stereogranimator.sh ID with an image ID from NYPL's Stereogranimator to download an animated GIF at low resolution and run it through the morphing process.

If you sign up for the NYPL Digital Collections API, you can use your API token with the included scripts to work with high-resolution original images. The nypl_recrop.rb script takes a Stereogranimator image ID as an argument and reads the API token from the NYPL_API_TOKEN environment variable, and attempts to apply the Stereogranimator's crop values to the original image. The run-stereogranimator-hi-res.sh script uses this process and passes the high-resolution cropped images to run-torchwarp.sh. You can also pass the NYPL_API_TOKEN environment variable in your docker run command.

Docker Usage

I had very little luck getting DeepFlow to work on OS X, so I'm using Docker to run this with the included Dockerfile.

  • Build the Docker image with docker build -t torch-warp .
  • Run the build with docker run -t -i torch-warp /bin/bash. You may want to map a host directory as a data volume as well, in order to transfer images back and forth.
  • Use the scripts as described above inside the Docker container's shell.

I've also made this repository an automated build on Docker Hub: ryanfb/torch-warp

torch-warp's People

Contributors

ryanfb avatar

Watchers

James Cloos 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.