Skip to main content

Image Composition Toolbox

Project description


libcom: everything about image composition


PyPI Downloads Hits Static Badge Static Badge Static Badge

We co-founded a startup company miguo.ai, dedicated to accelerating the production of comics and animations using AIGC technology. If you are seeking internship or full-time positions, please feel free to send your resume to hr@miguocomics.com.


Introduction

libcom (the library of image composition) is an image composition toolbox. The goal of image composition (object insertion) 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 [OPA] evaluates the rationality of foreground object placement in a composite image.
  • FOPAHeatMapModel [FOPA] 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 [CDTNet] [PCTNet] adjusts the foreground illumination to be compatible the background given photorealistic background and photorealistic foreground.
  • PainterlyHarmonizationModel [PHDNet] [PHDiffusion] adjusts the foreground style to be compatible with the background given artistic background and photorealistic foreground.
  • HarmonyScoreModel [BargainNet] evaluates the harmony level between foreground and background in a composite image.
  • InharmoniousLocalizationModel [MadisNet] localizes the inharmonious region in a synthetic image.
  • FOSScoreModel [DiscoFOS] evaluates the compatibility between foreground and background in a composite image in terms of geometry and semantics.
  • ShadowGenerationModel [GPSDiffusion] generates plausible shadow for the inserted object in a composite image. This model is unstable and you can pick the most satisfactory one from multiple generated results.
  • ControlComModel [ControlCom] is a generative image composition model which unifies image blending and image harmonization. The pose and view of foreground stay unchanged.
  • MureObjectStitchModel [MureObjectStitch] is another generative image composition model which can adjust the pose and view of foreground. It supports multiple reference images of one foreground object. If you have a few images containing the foreground object, we suggest finetuning MureObjectStitch using these images for better detail preservation.

For the detailed method descriptions, code examples, visualization results, and performance comments, please refer to our [documents]. If the model performance is not satisfactory, you can finetune the pretrained model on your own dataset using the source repository and replace the original model.

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}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

libcom-0.1.0.tar.gz (432.2 kB view details)

Uploaded Source

Built Distribution

libcom-0.1.0-cp38-cp38-manylinux1_x86_64.whl (3.0 MB view details)

Uploaded CPython 3.8

File details

Details for the file libcom-0.1.0.tar.gz.

File metadata

  • Download URL: libcom-0.1.0.tar.gz
  • Upload date:
  • Size: 432.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.5

File hashes

Hashes for libcom-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1d56dc0c7468e6ff274fe421710f4aa4b2bc20753e840c744d48aff3cadebff0
MD5 ea410842a237f96459f305b03e8c0765
BLAKE2b-256 ff4d6bc11e36375757bce9e25ff8a8306fc2281667c0a40f71469bd668cae112

See more details on using hashes here.

File details

Details for the file libcom-0.1.0-cp38-cp38-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for libcom-0.1.0-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 1f6944377534af29ec2988521570135599bf11462e42ea5700a60d4eb12e670a
MD5 16b4c7e496f1b08bfe2055efe7b8ae7d
BLAKE2b-256 9b06208b6b8cc2af32f0efd10a35c2be2a7d11bef1196c03806eac89fab1131c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page