Functions for reading and decoding the data of frames in NV21 format.
Project description
nv21
Functions for reading and decoding the data of frames in NV21 format.
Basically it wraps the cv2-based conversion with some check in order to avoid some confusing cv2 errors.
Available functions
nv21_to_rgbread_nv21_from_fileyuv_to_nv21
Example
import cv2
import matplotlib.pyplot as plt # do not forget to install `matplotlib` first
import nv21
# Check the "data" folder of this repository.
img = cv2.imread('./data/example.png')[..., ::-1] # to RGB
h, w = img.shape[:2]
nv21_data = nv21.yuv_to_nv21(
cv2.cvtColor(img, cv2.COLOR_RGB2YUV)
)
restored_img = nv21.nv21_to_rgb(nv21_data, w, h)
# Draw results
plt.subplot(1, 3, 1)
plt.axis('off')
plt.imshow(img)
plt.subplot(1, 3, 2)
plt.axis('off')
plt.imshow(nv21_data, cmap='gray')
plt.subplot(1, 3, 3)
plt.axis('off')
plt.imshow(restored_img)
plt.show()
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
nv21-1.0.0.tar.gz
(4.3 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
nv21-1.0.0-py3-none-any.whl
(4.4 kB
view details)
File details
Details for the file nv21-1.0.0.tar.gz.
File metadata
- Download URL: nv21-1.0.0.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f127d7c4fb3e66adefde14aaddf203056e347a48f13a36a567493e2e2a3ad70a
|
|
| MD5 |
ce3c1d046f8097ea9248e723d4976f9b
|
|
| BLAKE2b-256 |
df90b9bd2f4ece785bdc7591a787186fcd990663e050cd59c9d823a29cd2c16d
|
File details
Details for the file nv21-1.0.0-py3-none-any.whl.
File metadata
- Download URL: nv21-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab2f1d8ab95b97605ad905a94d048c63cfe328ac6e62c59d3829f6a1463658a1
|
|
| MD5 |
46a933a863e0351e92c8569eff20a752
|
|
| BLAKE2b-256 |
c12f70b39523d6318e010038ad17e9cc4a909db5ad7843b0aba2d4c2bf302549
|