Code Monkey home page Code Monkey logo

seam-erasure's Introduction

Seam Erasure

Seamlessly erase seams from your favorite 3D models.

Textures seams often produce errors when bi-linearly interpolated. This results in a visible seam line or other undesired artifacts. The goal of this project is to devise a numerical solution to this problem by minimizing the difference between interpolated values of edge pairs. Works for various texture maps regardless of useage (e.g. color maps, normal maps, displacement maps, ambient occlusion, geometry images, and skinning weight textures).

Read more:

Installation

To install Seam Erasure use the following command in your terminal:

pip install seam-erasure

This is the preferred method to install Seam Erasure.

If you perfer to use Seam Erasure without installing it, you can clone the repo:

git clone https://github.com/zfergus/seam-erasure.git

Dependencies

If you install Seam Erasure using pip all dependencies will be installed. If you choose to use Seam Erasure without installing, you can install all required dependencies using pip install -r requirements.txt.

Dependencies include:

  • numpy: linear algebra
  • scipy: sparse matrix operations
  • pillow: saving/loading texture image files
  • recordclass: simple data objects
  • tqdm: fancy progressbars

Usage

If you install using pip a seam-erasure tool will be installed. You can use Seam Erase from the command line using the following command:

seam-erasure path/to/input_model path/to/input_texture [-h] [-o path/to/output_texture] [-g] [--sv {none,texture,lerp}] [-d]

Positional arguments:

  • path/to/input_model: Path to input mesh file.
  • path/to/input_texture: Path to input texture image or directory to load all textures from.

Optional arguments:

  • -o path/to/output_texture, --output path/to/output_texture: Name of output texture or directory to save batch textures.
  • -g, --global: Should the minimization have global effects? (default: False)
    • This should be used if the texture has global discontinuities. This will propagate changes from the seam inward (see the teaser image for a example of global discontinties).
  • --sv {none,texture,lerp}: What method should be used to compute the seam value energy? (default: none)
    • none: do not use a seam value term
    • texture: use difference in original texture
    • lerp: use linearly interpolated values along the edge
      • Values are provided at the vertices in the .obj as additional entries after the xyz triplet (e.g. v <x> <y> <z> [<r>] [<g>] [<b>] [<a>] ... where the additional channels are optional and must match the number of channels in the texture image).
  • -d, --data: Should the input texture(s) be loaded as a .data files? (default: False)

Note: if you did not install the code replace seam-erasure in the above command with python main.py.

Files

  • seam_erasure/: Python package for Seam-Erasure
  • main.py: Command-line interface for seam erasure.
  • server.py: Flask based Python code for handling web inputs.
  • examples/: examples 3D model and texture files for testing
  • static/: Static web page content including style sheets
  • templates/: HTML template pages

Web Browser UI

This repository also includes a Flask based server implementation that can be run locally. This provides a simple webpage interface to provide model/texture input and select options. To get this user interface run:

python server.py

This will start a server on the localhost. Navigate to the outputted address in your choice of web browser to view the interface.

Examples

Diffuse Textures

Before After

Normal Maps

Before After

Ambient Occlusion

Before After

Geometry Images

Before After

seam-erasure's People

Contributors

zfergus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

seam-erasure's Issues

Unable to generate output

Hi, I am using Python 2.7.16. When I build it using flask and hit submit with default values with a mesh and png texture. I get this error Error: Unable to erase the texture (erase_seam() got an unexpected keyword argument 'display_energy_file').

image

Taking too long for processing

Thanks for sharing the code base. ! I am trying to run the command line application on my data and Its taking a while to process.
May I ask if there is any thing I can do to expedite the process. I am running this on intel i7 , with 16 GB ram.
seam-erasure 08077..obj images/ -o out/
Loading OBJ: /home/lonewolf/Desktop/ttt/aa/08077..obj
Loading Texture: /home/lonewolf/Desktop/ttt/aa/images/back.jpg
Loading Texture: /home/lonewolf/Desktop/ttt/aa/images/bottom.jpg
Loading Texture: /home/lonewolf/Desktop/ttt/aa/images/front.jpg
Loading Texture: /home/lonewolf/Desktop/ttt/aa/images/left.jpg
Loading Texture: /home/lonewolf/Desktop/ttt/aa/images/right.jpg
Loading Texture: /home/lonewolf/Desktop/ttt/aa/images/top.jpg
Model: 08077..obj
Texture:

Finding seam of model
Done

Number of edges along the seam: 530
Number of edges along the boundary: 0
Number of foldover edges: 36

Computing seam edge lengths
Done

Building Bilinear Energy Matrix: 100%|██████████████████████████████████| 265/265 [00:08<00:00, 32.77edge pairs/s]
Building Seam Gradient Matrix: 100%|████████████████████████████████████| 265/265 [00:09<00:00, 27.28edge pairs/s]
Seam Value Energy: N/a
Building Least Squares Constraints: 100%|█████████████████████████████████| 5000/5000 [00:19<00:00, 256.97faces/s]
Building Dirichlet Energy: 100%|██████████████████████████████████████████| 5000/5000 [00:12<00:00, 396.75faces/s]

Solving for minimal energy solution
Using iterative solver for large system (nnz=5472096)
Solving channel 0

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.