Giter Club home page Giter Club logo

imagetransform's Introduction

image 3D rotation

Image

Use image_rotation.py to rotate your image!

Before After

Example:

image_rotation.py ${IMPUT_IMAGE} ${OUTPUT_PATH} [--theta] [--phi] [--gamma]
  • theta : rotation around the x axis

  • phi : rotation around the y axis

  • gamma : rotation around the z axis

python image_rotation.py demo/image_demo.jpg demo/img_rotate.jpg --theta 26 --phi 43 --gamma -66

Mask

You can specify [--mask] to export the mask:

Labels

Transform your labels

Before After

Example:

python image_rotation.py \
    ${IMPUT_IMAGE} \
    ${OUTPUT_PATH} \
    [--theta ${THETA}] \
    [--phi ${PHI}] \
    [--gamma ${GAMMA}] \
    [--labels ${TXT_FILE}] \
    [--labels-out ${OUTPTU_TXT_PATH}]
python image_rotation.py demo/image_demo.jpg demo/img_rotate.jpg --theta 26 --phi 43 --gamma -66 --mask demo/img_mask.jpg --labels demo/image_demo_labels.txt --labels-out demo/img_rotate_labels.txt

Other Image transformations

image foreground mask image background

Example:

from transformers import (rotate_layer, blend_layers, scale_layer, 
                          resize_poly, rotate_poly, translate_poly)
                          
scale = 0.8
image_fg = scale_layer(image_fg, scale)
image_fg_mask = scale_layer(image_fg_mask, scale)
poly = data["polygon"]
poly = resize_poly(poly, scale)


dicRotation = {'theta':-5, 'phi':-40, 'gamma':-10}
images_rotated = rotate_layer([image_fg, image_fg_mask], dicRotation)
image_fg, image_fg_mask = images_rotated
poly = rotate_poly(poly)


result = blend_layers(image_fg, image_bg, image_fg_mask, position=(275,70), opacity=0.85)
poly = translate_poly(poly, y=70, x=275)

Result:

image polygones

imagetransform's People

Contributors

danielhry avatar

Stargazers

 avatar  avatar  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.