Skip to main content

libcom: everything about image composition


PyPI Downloads Hits Static Badge Static Badge GitHub

Introduction

libcom (the library of image composition) is an image composition toolbox. The goal of image composition is inserting one foreground into a background image to get a realistic composite image, by addressing the inconsistencies (appearance, geometry, and semantic inconsistency) between foreground and background. Generally speaking, image composition could be used to combine the visual elements from different images.


libcom covers a diversity of related tasks in the field of image composition, including image blending, standard/painterly image harmonization, shadow generation, object placement, generative composition, quality evaluation, etc. For each task, we integrate one or two selected methods considering both efficiency and effectiveness. The selected methods will be continuously updated upon the emergence of better methods.

The ultimate goal of this library is solving all the problems related to image composition with simple import libcom.

Main Functions

  • get_composite_image generates composite images using naive copy-and-paste followed by image blending.
  • OPAScoreModel evaluates the rationality of foreground object placement in a composite image.
  • FOPAHeatMapModel can predict the rationality scores for all locations/scales given a background-foreground pair, and output the composite image with optimal location/scale.
  • color_transfer adjusts the foreground color to match the background using traditional color transfer method.
  • ImageHarmonizationModel adjusts the foreground illumination to be compatible the background given photorealistic background and photorealistic foreground.
  • PainterlyHarmonizationModel adjusts the foreground style to be compatible with the background given artistic background and photorealistic foreground.
  • HarmonyScoreModel evaluates the harmony level between foreground and background in a composite image.
  • InharmoniousLocalizationModel localizes the inharmonious region in a synthetic image.
  • FOSScoreModel evaluates the compatibility between foreground and background in a composite image in terms of geometry and semantics.
  • ControlComModel is a generative image composition model, which unifies image blending and image harmonization in one diffusion model.
  • ShadowGenerationModel generates plausible shadow for the inserted object in a composite image.

For the detailed method descriptions, code examples, visualization results, and performance comments, please refer to our [documents].

Requirements

The main branch is built on the Linux system with Python 3.8 and PyTorch>=1.10.1. For other dependencies, please refer to [conda_env] and [runtime_dependencies].

Get Started

Please refer to [Installation] for installation instructions and [documents] for user guidance.

Contributors

License

This project is released under the Apache 2.0 license.

Bibtex

If you use our toolbox, please cite our survey paper using the following BibTeX [arxiv]:

@article{niu2021making,
  title={Making images real again: A comprehensive survey on deep image composition},
  author={Niu, Li and Cong, Wenyan and Liu, Liu and Hong, Yan and Zhang, Bo and Liang, Jing and Zhang, Liqing},
  journal={arXiv preprint arXiv:2106.14490},
  year={2021}
}

Metadata

Release files for libcom 0.0.1.post10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for libcom 0.0.1.post10
File Size Uploaded
libcom-0.0.1.post10.tar.gz 352.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for libcom 0.0.1.post10
File Interpreter ABI Platform
libcom-0.0.1.post10-cp38-cp38-manylinux1_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.5+ x86-64 Details

Total release size: 2.7 MB

Release files / libcom-0.0.1.post10.tar.gz

Download URL libcom-0.0.1.post10.tar.gz
Size 352.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2180ecfdc8efad6ff804e518d1eeb431a5dd672e272ad0b8f9599f8b496b0212
BLAKE2b-256 checksum
How to use checksums
282817cb10fd3e7e3d0c39ecde34b8cc63d5660f988e8a51e33e1ba10a864193
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.5

Release files / libcom-0.0.1.post10-cp38-cp38-manylinux1_x86_64.whl

Download URL libcom-0.0.1.post10-cp38-cp38-manylinux1_x86_64.whl
Size 2.3 MB
Tags CPython 3.8 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
f1f9a85f5cdbe532ae70f93987ad3649946444a744277591fe413b3a021776e6
BLAKE2b-256 checksum
How to use checksums
59c8c0f9b7c93f5679c8508e8a5860d8c0d9c69ffee7767bebf1b671da289856
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.5
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page