Skip to content

lessw2020/snowfall

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

snowfall

helpful image handling utils - abstracts various file and opencv and pil features into result oriented functions

usage examples:

from image_handlers import *

load an image - a simple task in theory but often set with details...is the file there? is the argument a string and not a PathLib object, should it be loaded as rgb or bgr format?

cv_load_func

example:
cv_load_usage

toggle channel order with toRgb and toBgr - a common issue with opencv

opencv continues to have BGR as it's channel format, vs PIL and the rest of the world use RGB format. A common source of confusion is thus confusing the channel format, resulting in blue tinted images.

Snowfall thus adds simple cover functions, toRgb and toBgr, to wrap the openCV cvtColor function to switch back and forth.
Note that the numpy trick of [...,::-1] and similar simply switch the view of the data using that can greatly slow down future openCV operations on that image since it's no longer contiguous memory, forcing OpenCV to have to copy the data for every function.

toRgb

vs common mistake:

opencv_load_mistake

About

helpful image handling utils - abstracts various file and opencv and pil features into result oriented functions

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages