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()
Metadata
Release files for nv21 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| nv21-1.0.0.tar.gz | 4.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nv21-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.8 kB
Release files / nv21-1.0.0.tar.gz
| Download URL | nv21-1.0.0.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f127d7c4fb3e66adefde14aaddf203056e347a48f13a36a567493e2e2a3ad70a
|
|
BLAKE2b-256 checksum How to use checksums |
df90b9bd2f4ece785bdc7591a787186fcd990663e050cd59c9d823a29cd2c16d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / nv21-1.0.0-py3-none-any.whl
| Download URL | nv21-1.0.0-py3-none-any.whl |
|---|---|
| Size | 4.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ab2f1d8ab95b97605ad905a94d048c63cfe328ac6e62c59d3829f6a1463658a1
|
|
BLAKE2b-256 checksum How to use checksums |
c12f70b39523d6318e010038ad17e9cc4a909db5ad7843b0aba2d4c2bf302549
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|