Package: kano-cv
🦌 Kano - Tools for Computer Vision TasksKanois a Python package providing utility functions for Computer Vision tasks. Its primary focus is simplifying lengthy functions, allowing developers to concentrate more on the main processes.📥 InstallationThe latest released versionis available on PyPI. You can install it by running the following command in your terminal:pipinstallkano-cv🚀 UsageComputer vision tasks:Object Detection (In progress)Object Segmentation (In progress)YOLO Datasets Splitting/MergingFiles/Folders ManipulatingImages ProcessingVideos Processing🗃️ YOLO Datasets Splitting/MergingTest these utilities here:If you are using Roboflow to label and struggling to merge many Workspaces or YOLO format projects,Kanoprovides a utility to merge them with just one command:fromkano.complex.roboflowimportmerge_datasets# Each dataset folder contains two folders "images" and "labels"folders=["Dataset_1","Dataset_2",]merge_datasets(folders,merged_folder_path="dataset")You can also split a dataset into train/valid/test with your own split ratio with only one command:fromkano.complex.roboflowimportsplit_dataset# Split a dataset (contains "images" and "labels")# into train, valid, test folders with a given ratiosplit_dataset(dataset_path="dataset/train",train_percent=80,valid_percent=20,target_folder="splitted_dataset",)📁 Files/Folders ManipulatingTest these utilities here:Kanois designed to run many common functions in just one line:fromkano.file_utilsimportcreate_folder,print_foldertree,remove_folder# Create a folder and its subfolder without errorscreate_folder("folder_A/subfolder")foriinrange(2):withopen(f"folder_A/subfolder/file_{i}.txt","w")asf:passprint_foldertree("folder_A")# folder_A (2 files)# |-- subfolder (2 files)# Remove a folder with its content without errorsremove_folder("folder_A/subfolder")You can even zip many folders (and files) by providing their paths and the destination path in a function call:zip_paths(["folder_A","folder_B"],"zipfile.zip")🖼️ Images ProcessingTest these utilities here:You can quickly download an image using a URL and show it in IPython notebooks or Python files:fromkano.image_utilsimportdownload_image,show_imageimage=download_image("https://avatars.githubusercontent.com/u/77763935?v=4","image.jpg")# using a numpy arrayshow_image(image)# using a file pathshow_image("image.jpg")or you can get a random image with a specific size:fromkano.image_utilsimportget_random_pictureimage=get_random_picture(width=400,height=300,save_path="random_image.jpg")# using a numpy arrayshow_image(image)# using a file pathshow_image("random_image.jpg")🎞️ Videos ProcessingTest these utilities here:Kanohelps you extract images from a video. For demo purposes, I will download a video from YouTube usingpytube. If you find this function helpful, please give a star tothe original repo.fromkano.video_utilsimportdownload_youtube_video,extract_framesdownload_youtube_video("https://www.youtube.com/watch?v=<VIDEOID>","video.mp4")# Get 1 image per 2 secondsextract_frames(video_path="video.mp4",target_folder="frames",seconds_interval=2,)🙋‍♂️ Contributing to KanoAll contributions, bug reports, bug fixes, enhancements, and ideas are welcome. Feel free to create pull requests or issues so that we can improve this library together.🔑 LicenseKano is licensed under theMITlicense.