Skip to content

streanger/vision-stuff

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vision_stuff

Tools for image conversion, which seems to be useful, at least for me.

Info

Collection of functions for convertion images with python opencv. For now one useful function is shrink_image and its derivative shrink_and_store_images_dir. It let us to shrink image(s), to specified size. Useful, when we have a couple of different shape images and want all of them to be e.g. 640x640.

Install

pip install vision_stuff

Usage from python

from vision_stuff import shrink_image

# example
img = cv2.imread('image_to_be_shrinked.png', 1)
out = shrink_image(img, 400, 400)
cv2.imwrite('out.png', out)
from vision_stuff import shrink_and_store_images_dir

directory = 'different_shape_images'
shrink_and_store_images_dir(directory, width=640, height=640, resize=True)
# it convert images and store them into new directory named (directory + "_converted")

Example of "shrink_image" function

examples/shrink_example.png

Example of "roll_layers" function

examples/roll_layers_example.jpg

Example of "gradient_image" function

examples/gradient.png

Example of "margin" function

examples/margin.png

Todo status

03.06.2020, todo:

  • add command line tools
  • add more useful function/classes

02.08.2020, info:

  • shrink_image fixed (it was bug in previous version :))
  • roll_layers function added
  • gradient_image function added
  • margin function added

12.09.2020, info:

  • shrink_and_store_images_dir renamed to shrink_img_dir
  • shrink_image renamed to shrink_img
  • echo added and few changes add to shrink_img_dir
  • when reading img into memory, cv2.IMREAD_UNCHANGED is used; it prevents windows rotation
  • when specified '.' as directory, files from current dir are converted and stored into '_converted' dir

About

tools for image conversion

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages