A mini package for daily tasks
Project description
from tacv.geometry.iou import iou_2d# TACV - A mini package for daily tasks
Installation
pip install tacv
Examples
File utils
Get all file paths from a directory
from tacv.fileUtils import get_all_files
file_paths = get_all_files("dir_name")
Returns a list of file absolute paths, for example
['./venvCondaTest/x86_64-conda_cos6-linux-gnu/bin/ld', './venvCondaTest/conda-meta/_libgcc_mutex-0.1-main.json', './venvCondaTest/conda-meta/xz-5.2.5-h7b6447c_0.json', './venvCondaTest/conda-meta/wheel-0.37.1-pyhd3eb1b0_0.json', './venvCondaTest/conda-meta/setuptools-58.0.4-py36h06a4308_0.json', './venvCondaTest/conda-meta/ca-certificates-2021.10.26-h06a4308_2.json', './venvCondaTest/conda-meta/readline-8.1.2-h7f8727e_1.json', './venvCondaTest/conda-meta/sqlite-3.37.2-hc218d9a_0.json', './venvCondaTest/conda-meta/libgcc-ng-9.3.0-h5101ec6_17.json', './venvCondaTest/conda-meta/ncurses-6.3-h7f8727e_2.json']
Save/load json data to/from file
from tacv.fileUtils import save_json,load_json
json_file = "myfile.json"
json_data = {"name":"Ta","age":100}
# save json
save_json(json_file,json_data)
# load json
json_data = load_json(json_file)
Visual
Draw 2D points onto an image
import cv2
from tacv.visual import draw_points
image = cv2.imread("myimage.jpg")
points = [(18,19),(55,55),(102,22),(66,22)]
draw_points(image,points,circular=True,color=(0,255,0),thickness=2)
cv2.imwrite("new_image.jpg",image)
Video
Synthesize a video from images
from tacv.video import images2video
image_dir = "my_images" #directory containing images in the same format
video_path = "tacv_test.mp4" #path to save the synthesized video
images2video(image_dir,video_path)
Extract images from a video
from tacv.video import video2images
video_path = "tacv_test.mp4" #path to video to be extracted to images
image_dir = "my_images" #directory to save the extracted images
video2images(video_path,image_dir)
Geometry
Calculate 2D IOU of two polygons
from tacv.geometry import iou_2d
polygon_1 = [[0,0],[10,10],[0,10]]
polygon_2 = [[0, 20], [10, 10], [0, 0]]
print(iou_2d(polygon_1,polygon_2))
Command Line Interface
Synthesize a video from images
tacv_i2v image_dir video_path [optional: fps image_ext]
Extract images from a video
tacv_v2i video_path image_dir
For more
- Visit args description in source code
- Visit
test.pyfile
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tacv-1.0.8.tar.gz
(6.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
tacv-1.0.8-py3-none-any.whl
(8.4 kB
view details)
File details
Details for the file tacv-1.0.8.tar.gz.
File metadata
- Download URL: tacv-1.0.8.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.7.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
017b34801c94972af1aad29b5ac5681a7bf7c7acdd26f7d3596e70ba2f368a82
|
|
| MD5 |
7f4bcc43319b075a4075ae37351c50bd
|
|
| BLAKE2b-256 |
b25f1d2d10a3126568c75906618c4f3be3f0a1ed8be900f098722f4cb8ac8d20
|
File details
Details for the file tacv-1.0.8-py3-none-any.whl.
File metadata
- Download URL: tacv-1.0.8-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.7.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a9fda55375e3e4cf5ae918d6c11019226b8a36c69ced29b3d9ea71cb6648524
|
|
| MD5 |
54fd4a3afc1ec6a8ac56d3af75a94681
|
|
| BLAKE2b-256 |
cb5029ee0ad8d38c5cde122ad55766e450bdc58b4ad19fa1501fd215ba820f40
|